Nómina - Obtener serie y folio de configuración
This commit is contained in:
parent
4bd5a71008
commit
f9f80a52e7
|
@ -340,8 +340,14 @@ class Configuracion(BaseModel):
|
|||
.where(Configuracion.clave.in_(fields))
|
||||
)
|
||||
values = {r.clave: util.get_bool(r.valor) for r in data}
|
||||
fields = (
|
||||
'txt_ticket_printer',
|
||||
'txt_config_nomina_serie',
|
||||
'txt_config_nomina_folio',
|
||||
)
|
||||
tp = 'txt_ticket_printer'
|
||||
values[tp] = Configuracion.get_(tp)
|
||||
for f in fields:
|
||||
values[f] = Configuracion.get_(f)
|
||||
return values
|
||||
|
||||
if keys['fields'] == 'correo':
|
||||
|
@ -5699,13 +5705,13 @@ class CfdiNomina(BaseModel):
|
|||
order_by = ('fecha',)
|
||||
|
||||
def _get_serie(self):
|
||||
serie = Configuracion.get_('chk_config_serie_nomina')
|
||||
serie = Configuracion.get_('txt_config_nomina_serie')
|
||||
if not serie:
|
||||
serie = DEFAULT_SAT_NOMINA['SERIE']
|
||||
return serie
|
||||
|
||||
def _get_folio(self, serie):
|
||||
folio = int(Configuracion.get_('chk_config_folio_nomina') or '0')
|
||||
folio = int(Configuracion.get_('txt_config_nomina_folio') or '0')
|
||||
inicio = (CfdiNomina
|
||||
.select(fn.Max(CfdiNomina.folio).alias('mf'))
|
||||
.where(CfdiNomina.serie==serie)
|
||||
|
|
|
@ -75,6 +75,8 @@ var controllers = {
|
|||
$$('chk_ticket_edit_cant').attachEvent('onItemClick', chk_config_item_click)
|
||||
$$('chk_ticket_total_up').attachEvent('onItemClick', chk_config_item_click)
|
||||
$$('txt_ticket_printer').attachEvent('onKeyPress', txt_ticket_printer_key_press)
|
||||
$$('txt_config_nomina_serie').attachEvent('onKeyPress', txt_config_nomina_serie_press)
|
||||
$$('txt_config_nomina_folio').attachEvent('onKeyPress', txt_config_nomina_folio_press)
|
||||
$$('chk_usar_nomina').attachEvent('onItemClick', chk_config_item_click)
|
||||
|
||||
$$('cmd_subir_bdfl').attachEvent('onItemClick', cmd_subir_bdfl_click)
|
||||
|
@ -1908,6 +1910,88 @@ function txt_ticket_printer_key_press(code, e){
|
|||
}
|
||||
|
||||
|
||||
function txt_config_nomina_serie_press(code, e){
|
||||
var value = this.getValue()
|
||||
if(code != 13){
|
||||
return
|
||||
}
|
||||
|
||||
if(!value.trim()){
|
||||
webix.ajax().del('/config', {id: 'txt_config_nomina_serie'}, function(text, xml, xhr){
|
||||
var msg = 'Serie de Nómina borrado correctamente'
|
||||
if(xhr.status == 200){
|
||||
msg_ok(msg)
|
||||
}else{
|
||||
msg = 'No se pudo eliminar'
|
||||
msg_error(msg)
|
||||
}
|
||||
})
|
||||
return
|
||||
}
|
||||
|
||||
webix.ajax().post('/config', {'txt_config_nomina_serie': value.toUpperCase()}, {
|
||||
error: function(text, data, xhr) {
|
||||
msg = 'Error al guardar la configuración'
|
||||
msg_error(msg)
|
||||
},
|
||||
success: function(text, data, xhr) {
|
||||
var values = data.json();
|
||||
if (values.ok){
|
||||
msg = 'Serie de Nómina guardada correctamente'
|
||||
msg_ok(msg)
|
||||
}else{
|
||||
msg_error(values.msg)
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
}
|
||||
|
||||
|
||||
function txt_config_nomina_folio_press(code, e){
|
||||
var value = this.getValue()
|
||||
if(code != 13){
|
||||
return
|
||||
}
|
||||
|
||||
if(!value.trim()){
|
||||
webix.ajax().del('/config', {id: 'txt_config_nomina_folio'}, function(text, xml, xhr){
|
||||
var msg = 'Folio de Nómina borrado correctamente'
|
||||
if(xhr.status == 200){
|
||||
msg_ok(msg)
|
||||
}else{
|
||||
msg = 'No se pudo eliminar'
|
||||
msg_error(msg)
|
||||
}
|
||||
})
|
||||
return
|
||||
}
|
||||
|
||||
if(!value.trim().is_number()){
|
||||
msg = 'El Folio de Nómina debe ser un número'
|
||||
msg_error(msg)
|
||||
return
|
||||
}
|
||||
|
||||
webix.ajax().post('/config', {'txt_config_nomina_folio': value}, {
|
||||
error: function(text, data, xhr) {
|
||||
msg = 'Error al guardar la configuración'
|
||||
msg_error(msg)
|
||||
},
|
||||
success: function(text, data, xhr) {
|
||||
var values = data.json();
|
||||
if (values.ok){
|
||||
msg = 'Folio de Nómina guardado correctamente'
|
||||
msg_ok(msg)
|
||||
}else{
|
||||
msg_error(values.msg)
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
}
|
||||
|
||||
|
||||
function cmd_niveles_educativos_click(){
|
||||
admin_ui_niveles_educativos.init()
|
||||
$$('win_niveles_educativos').show()
|
||||
|
|
|
@ -645,6 +645,10 @@ var options_admin_otros = [
|
|||
{cols: [{maxWidth: 15},
|
||||
{view: 'checkbox', id: 'chk_usar_nomina', labelWidth: 0,
|
||||
labelRight: 'Usar timbrado de Nómina'},
|
||||
{view: 'text', id: 'txt_config_nomina_serie', name: 'config_nomina_serie',
|
||||
label: 'Serie', labelWidth: 50, labelAlign: 'right'},
|
||||
{view: 'text', id: 'txt_config_nomina_folio', name: 'config_nomina_folio',
|
||||
label: 'Folio', labelWidth: 50, labelAlign: 'right'},
|
||||
{}]},
|
||||
{}]
|
||||
|
||||
|
|
Loading…
Reference in New Issue