2017-06-27 15:43:02 -05:00
|
|
|
|
|
|
|
|
|
|
|
var toolbar_invoices = [
|
|
|
|
{view: "button", id: "cmd_new_invoice", label: "Nueva", type: "iconButton",
|
|
|
|
autowidth: true, icon: "plus"},
|
2017-10-10 18:49:05 -05:00
|
|
|
{view: "button", id: "cmd_refacturar", label: "Refacturar", type: "iconButton",
|
2017-06-27 15:43:02 -05:00
|
|
|
autowidth: true, icon: "pencil"},
|
2017-10-10 18:49:05 -05:00
|
|
|
{},
|
2017-06-27 15:43:02 -05:00
|
|
|
{view: "button", id: "cmd_delete_invoice", label: "Eliminar", type: "iconButton",
|
|
|
|
autowidth: true, icon: "minus"},
|
2017-10-04 23:22:05 -05:00
|
|
|
]
|
|
|
|
|
|
|
|
|
2017-10-10 18:49:05 -05:00
|
|
|
var toolbar_invoices_util = [
|
|
|
|
{view: 'button', id: 'cmd_invoice_timbrar', label: 'Timbrar',
|
|
|
|
type: 'iconButton', autowidth: true, icon: 'ticket'},
|
|
|
|
]
|
|
|
|
|
|
|
|
|
|
|
|
function get_icon(tipo){
|
2017-10-11 15:18:32 -05:00
|
|
|
var node = "<img src='/static/img/file-" + tipo + ".png' height='20' width='17' style='margin: 5px 0px'/>"
|
2017-10-10 18:49:05 -05:00
|
|
|
return node
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2017-06-27 15:43:02 -05:00
|
|
|
var grid_invoices_cols = [
|
|
|
|
{id: "id", header:"ID", hidden:true},
|
2017-10-04 23:22:05 -05:00
|
|
|
{id: "serie", header: ["Serie", {content: "selectFilter"}], adjust: "data",
|
|
|
|
sort:"string"},
|
|
|
|
{id: "folio", header: ["Folio", {content: "numberFilter"}], adjust: "data",
|
|
|
|
sort:"int", css: "cell_right"},
|
|
|
|
{id: "uuid", header: ["UUID", {content: "textFilter"}], adjust: "data",
|
2017-10-10 18:49:05 -05:00
|
|
|
sort:"string", hidden:true},
|
2017-06-27 15:43:02 -05:00
|
|
|
{id: "fecha", header: ["Fecha y Hora"], adjust: "data", sort:"string"},
|
2017-10-04 23:22:05 -05:00
|
|
|
{id: "tipo_comprobante", header: ["Tipo", {content: "selectFilter"}],
|
|
|
|
adjust: 'header', sort: 'string'},
|
|
|
|
{id: "estatus", header: ["Estatus", {content: "selectFilter"}],
|
|
|
|
adjust: "data", sort:"string"},
|
|
|
|
{id: 'total_mn', header: ['Total M.N.', {content: 'numberFilter'}], width: 150,
|
|
|
|
sort: 'int', format: webix.i18n.priceFormat, css: 'right'},
|
|
|
|
{id: "cliente", header: ["RazĆ³n Social", {content: "selectFilter"}],
|
|
|
|
fillspace:true, sort:"string"},
|
2017-10-10 18:49:05 -05:00
|
|
|
{id: 'xml', header: 'XML', adjust: 'data', template: get_icon('xml')},
|
|
|
|
{id: 'pdf', header: 'PDF', adjust: 'data', template: get_icon('pdf')},
|
|
|
|
{id: 'zip', header: 'ZIP', adjust: 'data', template: get_icon('zip')},
|
|
|
|
{id: 'email', header: '', adjust: 'data', template: get_icon('email')}
|
2017-10-04 23:22:05 -05:00
|
|
|
]
|
2017-06-27 15:43:02 -05:00
|
|
|
|
|
|
|
|
|
|
|
var grid_invoices = {
|
2017-10-10 18:49:05 -05:00
|
|
|
view: 'datatable',
|
|
|
|
id: 'grid_invoices',
|
|
|
|
select: 'row',
|
2017-06-27 15:43:02 -05:00
|
|
|
adjust: true,
|
|
|
|
footer: true,
|
|
|
|
resizeColumn: true,
|
|
|
|
headermenu: true,
|
|
|
|
columns: grid_invoices_cols,
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
var grid_details_cols = [
|
2017-10-04 23:22:05 -05:00
|
|
|
{id: "id", header:"ID", hidden: true},
|
|
|
|
{id: 'delete', header: '', width: 30, css: 'delete'},
|
2017-10-05 15:33:25 -05:00
|
|
|
{id: "clave", header:{text: 'Clave', css: 'center'}, width: 100},
|
|
|
|
{id: "descripcion", header:{text: 'DescripciĆ³n', css: 'center'},
|
2017-10-06 00:10:27 -05:00
|
|
|
fillspace: true, editor: 'text'},
|
2017-10-05 15:33:25 -05:00
|
|
|
{id: "unidad", header:{text: 'Unidad', css: 'center'}, width: 100},
|
|
|
|
{id: 'cantidad', header: {text: 'Cantidad', css: 'center'}, width: 100,
|
2017-10-04 23:22:05 -05:00
|
|
|
format: webix.i18n.numberFormat, css:'right', editor: 'text'},
|
2017-10-05 15:33:25 -05:00
|
|
|
{id: "valor_unitario", header:{text: 'Valor Unitario', css: 'center'}, width: 100,
|
2017-10-04 23:22:05 -05:00
|
|
|
format: webix.i18n.priceFormat, css:'right', editor: 'text'},
|
|
|
|
{id: "importe", header:{text: 'Importe', css: 'center'}, width: 150, format: webix.i18n.priceFormat, css:'right'},
|
|
|
|
]
|
2017-06-27 15:43:02 -05:00
|
|
|
|
|
|
|
|
|
|
|
var grid_details = {
|
2017-10-05 15:33:25 -05:00
|
|
|
view: 'datatable',
|
|
|
|
id: 'grid_details',
|
|
|
|
select: 'row',
|
2017-06-27 15:43:02 -05:00
|
|
|
adjust: true,
|
|
|
|
autoheight: true,
|
2017-10-06 00:10:27 -05:00
|
|
|
editable: true,
|
2017-06-27 15:43:02 -05:00
|
|
|
columns: grid_details_cols,
|
2017-10-04 23:22:05 -05:00
|
|
|
data: []
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
var grid_totals_cols = [
|
|
|
|
{id: 'id', header: 'ID', hidden: true},
|
|
|
|
{id: 'concepto', header: 'Concepto', width: 200,
|
|
|
|
footer: {text: 'TOTAL', css:'right_footer'}, css:'right'},
|
|
|
|
{id: 'importe', header: 'Importe', width: 150,
|
|
|
|
footer: {content: 'summColumn', css:'right_footer'},
|
|
|
|
format: webix.i18n.priceFormat, css:'right'},
|
|
|
|
]
|
|
|
|
|
|
|
|
|
|
|
|
var grid_totals = {
|
|
|
|
view: 'datatable',
|
|
|
|
id: 'grid_totals',
|
|
|
|
select: false,
|
|
|
|
width: 350,
|
|
|
|
header: false,
|
|
|
|
footer: true,
|
|
|
|
autoheight: true,
|
|
|
|
columns: grid_totals_cols,
|
|
|
|
data: [{id: 1, concepto: 'SubTotal', importe: 0}]
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
var suggest_partners = {
|
|
|
|
view: 'gridsuggest',
|
2017-10-05 15:33:25 -05:00
|
|
|
id: 'grid_clients_found',
|
|
|
|
name: 'grid_clients_found',
|
2017-10-04 23:22:05 -05:00
|
|
|
body: {
|
|
|
|
autoConfig: false,
|
|
|
|
header: false,
|
2017-10-05 12:16:20 -05:00
|
|
|
columns: [
|
|
|
|
{id: 'id', hidden: true},
|
|
|
|
{id: 'nombre', adjust: 'data'},
|
2017-10-07 00:16:58 -05:00
|
|
|
{id: 'rfc', adjust: 'data'},
|
|
|
|
{id: 'forma_pago', hidden: true},
|
|
|
|
{id: 'uso_cfdi', hidden: true},
|
|
|
|
],
|
2017-10-04 23:22:05 -05:00
|
|
|
dataFeed:function(text){
|
|
|
|
if (text.length > 2){
|
2017-10-05 15:33:25 -05:00
|
|
|
this.load('/values/client?name=' + text)
|
2017-10-04 23:22:05 -05:00
|
|
|
}else{
|
|
|
|
this.hide()
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
var suggest_products = {
|
|
|
|
view: 'gridsuggest',
|
|
|
|
id: 'grid_products_found',
|
|
|
|
name: 'grid_products_found',
|
|
|
|
body: {
|
|
|
|
autoConfig: false,
|
|
|
|
header: true,
|
|
|
|
columns: [
|
|
|
|
{id: 'id', hidden: true},
|
2017-10-07 00:16:58 -05:00
|
|
|
{id: 'clave', adjust: 'data'},
|
|
|
|
{id: 'descripcion', adjust: 'data'},
|
|
|
|
{id: 'unidad', adjust: 'data'},
|
|
|
|
{id: 'valor_unitario', adjust: 'data',
|
|
|
|
format: webix.i18n.priceFormat}
|
2017-10-04 23:22:05 -05:00
|
|
|
],
|
|
|
|
dataFeed:function(text){
|
|
|
|
if (text.length > 2){
|
|
|
|
this.load('/values/product?name=' + text)
|
|
|
|
}else{
|
|
|
|
this.hide()
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2017-10-07 00:16:58 -05:00
|
|
|
var body_comprobante = {rows: [{
|
|
|
|
cols: [
|
|
|
|
{
|
|
|
|
view: 'richselect',
|
|
|
|
id: 'lst_tipo_comprobante',
|
|
|
|
label: 'Tipo',
|
|
|
|
labelPosition: 'top',
|
|
|
|
required: true,
|
|
|
|
value: 'I',
|
|
|
|
options: [
|
|
|
|
{id: 'I', value: 'Ingreso'},
|
|
|
|
{id: 'E', value: 'Egreso'},
|
|
|
|
{id: 'T', value: 'Traslado'}
|
|
|
|
]
|
|
|
|
},
|
|
|
|
{
|
|
|
|
view: 'richselect',
|
|
|
|
id: 'lst_serie',
|
|
|
|
label: 'Serie',
|
|
|
|
labelPosition: 'top',
|
|
|
|
options: [],
|
|
|
|
},
|
|
|
|
]},
|
|
|
|
{view: 'richselect', id: 'lst_uso_cfdi', name: 'uso_cfdi', required: true,
|
|
|
|
labelPosition: 'top', label: 'Uso del CFDI', options: []},
|
2017-10-04 23:22:05 -05:00
|
|
|
]}
|
|
|
|
|
|
|
|
|
|
|
|
var opt_metodo_pago = [
|
|
|
|
{id: 'PUE', value: 'Pago en una sola exhibiciĆ³n'},
|
|
|
|
{id: 'PPD', value: 'Pago en parcialidades o diferido'}
|
|
|
|
]
|
|
|
|
|
|
|
|
|
|
|
|
var body_opciones = {rows: [
|
2017-10-07 00:16:58 -05:00
|
|
|
{view: 'richselect', id: 'lst_forma_pago', name: 'forma_pago',
|
|
|
|
label: 'Forma de Pago', labelPosition: 'top', required: true,
|
|
|
|
options: []},
|
2017-10-04 23:22:05 -05:00
|
|
|
{view: 'richselect', id: 'lst_metodo_pago', label: 'MĆ©todo de Pago',
|
2017-10-06 00:10:27 -05:00
|
|
|
labelPosition: 'top', options: opt_metodo_pago, readonly: true,
|
|
|
|
value: 'PUE',
|
2017-10-04 23:22:05 -05:00
|
|
|
required: true},
|
|
|
|
{view: 'text', id: 'txt_condicion_pago', label: 'Condiciones de Pago',
|
|
|
|
labelPosition: 'top'},
|
|
|
|
]}
|
|
|
|
|
|
|
|
|
|
|
|
var body_moneda = {cols: [
|
|
|
|
{view: 'richselect', id: 'lst_moneda', label: 'Nombre',
|
|
|
|
labelPosition: 'top', required: true, options: []},
|
|
|
|
{view: 'text', type: 'text', id: 'txt_tipo_cambio', value: '1.00',
|
|
|
|
label: 'Tipo de Cambio', labelPosition: 'top', required: true,
|
|
|
|
invalidMessage: 'Captura un valor nĆŗmerico', inputAlign: 'right',
|
|
|
|
readonly: true}
|
|
|
|
]}
|
|
|
|
|
|
|
|
|
2017-10-06 00:10:27 -05:00
|
|
|
var body_regimen_fiscal = {
|
|
|
|
view: 'richselect',
|
|
|
|
id: 'lst_regimen_fiscal',
|
|
|
|
required: true,
|
|
|
|
options: []
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2017-06-27 15:43:02 -05:00
|
|
|
var controls_generate = [
|
2017-10-04 23:22:05 -05:00
|
|
|
{cols: [ {rows:[
|
|
|
|
{view: 'fieldset', label: 'Buscar Cliente', body: {rows: [
|
|
|
|
{cols: [
|
2017-10-05 15:33:25 -05:00
|
|
|
{view:"search", id:"search_client_id", name:"search_client_id",
|
2017-10-04 23:22:05 -05:00
|
|
|
label:"por Clave", labelPosition:'top', maxWidth:200,
|
|
|
|
placeholder:'Captura la clave'},
|
2017-10-05 15:33:25 -05:00
|
|
|
{view: 'search', id: 'search_client_name',
|
|
|
|
name: 'search_client_name', label: 'por Nombre o RFC',
|
2017-10-05 12:16:20 -05:00
|
|
|
labelPosition: 'top', suggest: suggest_partners,
|
|
|
|
placeholder: 'Captura al menos tres letras'},
|
2017-10-04 23:22:05 -05:00
|
|
|
]},
|
2017-10-05 15:33:25 -05:00
|
|
|
{cols: [{
|
|
|
|
view: 'label', id: 'lbl_client_title',
|
|
|
|
name: "lbl_client_title", label: 'Seleccionado: ',
|
|
|
|
autowidth:true},
|
|
|
|
{view: 'label', id: 'lbl_client', name: 'lbl_client',
|
|
|
|
label: 'Ninguno'},
|
2017-10-04 23:22:05 -05:00
|
|
|
]}
|
|
|
|
]}},
|
|
|
|
{view: 'fieldset', label: 'Buscar Producto', body: {rows: [
|
2017-10-05 15:33:25 -05:00
|
|
|
{cols: [
|
|
|
|
{view: "search", id: "search_product_id",
|
|
|
|
name: "search_product_id", label: "por Clave",
|
|
|
|
labelPosition:'top', maxWidth:200,
|
|
|
|
placeholder:'Captura la clave'},
|
|
|
|
{view: "search", id: "search_product_name",
|
|
|
|
name: "search_product_name", label: "por DescripciĆ³n",
|
|
|
|
labelPosition:'top', suggest: suggest_products,
|
|
|
|
placeholder:'Captura al menos tres letras'},
|
2017-10-04 23:22:05 -05:00
|
|
|
]},
|
|
|
|
]}}
|
|
|
|
]},
|
|
|
|
{maxWidth: 10},
|
|
|
|
{maxWidth: 300, rows: [
|
|
|
|
{view: 'fieldset', label: 'Comprobante', body: body_comprobante},
|
|
|
|
{view: 'fieldset', label: 'Opciones de Pago', body: body_opciones},
|
2017-10-06 00:10:27 -05:00
|
|
|
{view: 'fieldset', id: 'fs_moneda', label: 'Moneda', body: body_moneda},
|
|
|
|
{view: 'fieldset', id: 'fs_regimen_fiscal', label: 'Regimen Fiscal',
|
|
|
|
body: body_regimen_fiscal},
|
2017-10-04 23:22:05 -05:00
|
|
|
]}
|
|
|
|
]},
|
|
|
|
{view: 'label', label: 'Detalle', height: 30, align: 'left'},
|
2017-06-27 15:43:02 -05:00
|
|
|
grid_details,
|
2017-10-04 23:22:05 -05:00
|
|
|
{minHeight: 15, maxHeight: 15},
|
|
|
|
{cols: [{}, grid_totals]}
|
2017-06-27 15:43:02 -05:00
|
|
|
]
|
|
|
|
|
|
|
|
|
|
|
|
var controls_invoices = [
|
|
|
|
{
|
|
|
|
view: "tabview",
|
|
|
|
tabbar: {options: ["Generar"]}, animate: true,
|
|
|
|
cells: [
|
|
|
|
{id: "Generar", rows: controls_generate},
|
|
|
|
]
|
|
|
|
},
|
|
|
|
{rows: [
|
2017-10-06 00:10:27 -05:00
|
|
|
{template:"", type: "section" },
|
|
|
|
{margin: 10, cols: [{},
|
2017-10-04 23:22:05 -05:00
|
|
|
{view: "button", id: "cmd_timbrar", label: "Timbrar",
|
|
|
|
type: "form", autowidth: true, align:"center"},
|
2017-10-06 00:10:27 -05:00
|
|
|
{view: 'button', id: 'cmd_close_invoice', label: 'Cancelar',
|
2017-10-04 23:22:05 -05:00
|
|
|
type: 'danger', autowidth: true, align: 'center'},
|
2017-06-27 15:43:02 -05:00
|
|
|
{}]
|
|
|
|
},
|
|
|
|
]}
|
2017-10-04 23:22:05 -05:00
|
|
|
]
|
2017-06-27 15:43:02 -05:00
|
|
|
|
|
|
|
|
|
|
|
var form_invoice = {
|
2017-10-06 00:10:27 -05:00
|
|
|
type: 'space',
|
2017-06-27 15:43:02 -05:00
|
|
|
cols: [{
|
2017-10-06 00:10:27 -05:00
|
|
|
view: 'form',
|
|
|
|
id: 'form_invoice',
|
2017-06-27 15:43:02 -05:00
|
|
|
complexData: true,
|
|
|
|
elements: controls_invoices,
|
|
|
|
}]
|
2017-10-06 00:10:27 -05:00
|
|
|
}
|
2017-06-27 15:43:02 -05:00
|
|
|
|
|
|
|
|
|
|
|
var multi_invoices = {
|
2017-10-10 18:49:05 -05:00
|
|
|
id: 'multi_invoices',
|
2017-10-04 23:22:05 -05:00
|
|
|
view: 'multiview',
|
2017-06-27 15:43:02 -05:00
|
|
|
animate: true,
|
|
|
|
cells:[
|
2017-10-10 18:49:05 -05:00
|
|
|
{id: 'invoices_home', rows:[
|
|
|
|
{view: 'toolbar', elements: toolbar_invoices},
|
|
|
|
{view: 'toolbar', elements: toolbar_invoices_util},
|
2017-06-27 15:43:02 -05:00
|
|
|
grid_invoices,
|
|
|
|
]},
|
2017-10-10 18:49:05 -05:00
|
|
|
{id: 'invoices_new', rows:[form_invoice, {}]}
|
2017-06-27 15:43:02 -05:00
|
|
|
]
|
2017-10-06 00:10:27 -05:00
|
|
|
}
|
2017-06-27 15:43:02 -05:00
|
|
|
|
|
|
|
|
|
|
|
var app_invoices = {
|
|
|
|
id: "app_invoices",
|
|
|
|
rows:[
|
|
|
|
{view: "template", id: "th_invoices", type: "header", template:"AdministraciĆ³n de Facturas" },
|
|
|
|
multi_invoices
|
|
|
|
]
|
2017-10-07 00:16:58 -05:00
|
|
|
}
|
2017-06-27 15:43:02 -05:00
|
|
|
|
|
|
|
|