Validate tax object

This commit is contained in:
el Mau 2023-03-01 22:24:00 -06:00
parent 0826b0cea2
commit 5f56179ebb
5 changed files with 33 additions and 33 deletions

View File

@ -533,19 +533,31 @@ function validate_invoice(values){
}
var rows = grid.data.getRange()
for (i = 0; i < rows.length; i++) {
var importe = rows[i]['importe']
if(!importe){
var msg = 'No es posible facturar importes en cero, revisa la línea: ' + (i + 1)
var is_global = $$('cmd_show_global_information').isVisible()
if(is_global){
if(values_global==''){
msg = 'Captura los datos de la Factura Global'
msg_error(msg)
return false
}
}
if($$('cmd_show_global_information').isVisible()){
if(values_global==''){
msg = 'Captura los datos de la Factura Global'
var rows = grid.data.getRange()
for (i = 0; i < rows.length; i++) {
if(is_global){
var key_sat = rows[i]['clave_sat']
if(key_sat!=KEY_SAT_01){
var msg = 'Clave SAT inválida para Facturar Global en la línea: ' + (i + 1)
msg_error(msg)
return false
}
}
var importe = rows[i]['importe']
if(!importe){
var msg = 'No es posible facturar importes en cero, revisa la línea: ' + (i + 1)
msg_error(msg)
return false
}

View File

@ -232,18 +232,9 @@ function cmd_save_product_click(id, e, node){
}
var rows = $$('grid_product_taxes').getSelectedId(true, true)
//~ if (rows.length == 0){
//~ msg_error('Selecciona un impuesto')
//~ return
//~ }
var values = form.getValues();
//~ if(!isFinite(values.cant_by_packing)){
//~ msg_error('La cantidad por empaque debe ser un número')
//~ return
//~ }
if(!validate_sat_key_product(values.clave_sat, false)){
msg_error('La clave SAT no existe')
return
@ -254,7 +245,19 @@ function cmd_save_product_click(id, e, node){
return
}
if(values['objeto_impuesto']=='01' && rows.length > 0){
msg = 'Si Objeto de Impuestos = 01, no debes seleccionar ningún impuesto'
msg_error(msg)
return
}
if(values['objeto_impuesto']=='02' && rows.length == 0){
msg = 'Si Objeto de Impuestos = 02, debes de seleccionar al menos un impuesto'
msg_error(msg)
return
}
values['taxes'] = JSON.stringify(rows)
webix.ajax().sync().post('products', values, {
error:function(text, data, XmlHttpRequest){
msg = 'Ocurrio un error, consulta a soporte técnico'

View File

@ -24,6 +24,7 @@ var DECIMALES = 2;
var DECIMALES_TAX = 4;
var CLAVE_ANTICIPOS = '84111506';
var CURRENCY_MN = 'MXN';
var KEY_SAT_01 = '01010101';
var db = new loki('data.db');

View File

@ -153,13 +153,6 @@ var controls_generals = [
width: 500, labelWidth: 150, labelAlign: "right", required: true,
invalidMessage: 'Este campo es requerido', options: opt_tax_object},
{},
//~ {view: 'text', id: 'cant_by_packing', name: 'cant_by_packing',
//~ labelAlign: 'right', labelWidth: 150, inputAlign: "right",
//~ label: 'Cantidad por empaque:'},
//~ {},
//~ {view: 'text', id: 'tags_producto', name: 'tags_producto',
//~ labelAlign: 'right', label: 'Etiquetas',
//~ placeholder: 'Separadas por comas'}
]},
{cols: [
{view: "currency", type: "text", id: "valor_unitario",

View File

@ -233,15 +233,6 @@ var cells_new_ticket = [
]
var opt_periodicidad = [
{id: '01', value: '[01] Diario'},
{id: '02', value: '[02] Semanal'},
{id: '03', value: '[03] Quincenal'},
{id: '04', value: '[04] Mensual'},
//~ {id: '05', value: '[05] Bimestral'},
]
var toolbar_ticket_invoice = {view: 'toolbar', elements: [{},
{view: 'checkbox', id: 'chk_is_invoice_day', labelWidth: 0, width: 150,
labelRight: 'Es factura del día'},