diff --git a/source/app/models/main.py b/source/app/models/main.py
index 62f7909..e6e006e 100644
--- a/source/app/models/main.py
+++ b/source/app/models/main.py
@@ -228,8 +228,8 @@ def config_main():
except IndexError:
obj = None
- punto_de_venta = util.get_bool(Configuracion.get_('chk_usar_punto_de_venta'))
- nomina = util.get_bool(Configuracion.get_('chk_usar_nomina'))
+ punto_de_venta = Configuracion.get_bool('chk_usar_punto_de_venta')
+ nomina = Configuracion.get_bool('chk_usar_nomina')
data = {
'empresa': get_title_app(3),
'punto_de_venta': punto_de_venta,
@@ -237,8 +237,9 @@ def config_main():
'nomina': nomina,
'timbres': 0,
'decimales_precios': DECIMALES,
+ 'pagos': Configuracion.get_bool('chk_config_pagos')
}
- dp = util.get_bool(Configuracion.get_('chk_config_decimales_precios'))
+ dp = Configuracion.get_bool('chk_config_decimales_precios')
if dp:
data['decimales_precios'] = DECIMALES_PRECIOS
@@ -368,6 +369,7 @@ class Configuracion(BaseModel):
'chk_llevar_inventario',
'chk_config_ine',
'chk_config_edu',
+ 'chk_config_pagos',
'chk_usar_punto_de_venta',
'chk_ticket_pdf_show',
'chk_ticket_direct_print',
diff --git a/source/static/js/controller/admin.js b/source/static/js/controller/admin.js
index 950ae41..70839f9 100644
--- a/source/static/js/controller/admin.js
+++ b/source/static/js/controller/admin.js
@@ -1,3 +1,20 @@
+//~ Empresa Libre
+//~ Copyright (C) 2016-2018 Mauricio Baeza Servin (web@correolibre.net)
+//~
+//~ This program is free software: you can redistribute it and/or modify
+//~ it under the terms of the GNU General Public License as published by
+//~ the Free Software Foundation, either version 3 of the License, or
+//~ (at your option) any later version.
+//~
+//~ This program is distributed in the hope that it will be useful,
+//~ but WITHOUT ANY WARRANTY; without even the implied warranty of
+//~ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+//~ GNU General Public License for more details.
+//~
+//~ You should have received a copy of the GNU General Public License
+//~ along with this program. If not, see .
+
+
var msg = ''
var tb_options = null
var tb_sat = null
@@ -70,6 +87,7 @@ var controllers = {
$$('chk_config_anticipo').attachEvent('onItemClick', chk_config_item_click)
$$('chk_config_ine').attachEvent('onItemClick', chk_config_item_click)
$$('chk_config_edu').attachEvent('onItemClick', chk_config_item_click)
+ $$('chk_config_pagos').attachEvent('onItemClick', chk_config_item_click)
$$('chk_config_cuenta_predial').attachEvent('onItemClick', chk_config_item_click)
$$('chk_config_codigo_barras').attachEvent('onItemClick', chk_config_item_click)
$$('chk_config_precio_con_impuestos').attachEvent('onItemClick', chk_config_item_click)
@@ -82,6 +100,8 @@ var controllers = {
$$('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)
+ $$('txt_config_cfdipay_serie').attachEvent('onKeyPress', txt_config_cfdipay_serie_press)
+ $$('txt_config_cfdipay_folio').attachEvent('onKeyPress', txt_config_cfdipay_folio_press)
$$('chk_usar_nomina').attachEvent('onItemClick', chk_config_item_click)
$$('cmd_subir_bdfl').attachEvent('onItemClick', cmd_subir_bdfl_click)
@@ -2035,6 +2055,88 @@ function txt_config_nomina_folio_press(code, e){
}
+function txt_config_cfdipay_serie_press(code, e){
+ var value = this.getValue()
+ if(code != 13){
+ return
+ }
+
+ if(!value.trim()){
+ webix.ajax().del('/config', {id: 'txt_config_cfdipay_serie'}, function(text, xml, xhr){
+ var msg = 'Serie de Pagos borrada correctamente'
+ if(xhr.status == 200){
+ msg_ok(msg)
+ }else{
+ msg = 'No se pudo eliminar'
+ msg_error(msg)
+ }
+ })
+ return
+ }
+
+ webix.ajax().post('/config', {'txt_config_cfdipay_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 Pagos guardada correctamente'
+ msg_ok(msg)
+ }else{
+ msg_error(values.msg)
+ }
+ }
+ })
+
+}
+
+
+function txt_config_cfdipay_folio_press(code, e){
+ var value = this.getValue()
+ if(code != 13){
+ return
+ }
+
+ if(!value.trim()){
+ webix.ajax().del('/config', {id: 'txt_config_cfdipay_folio'}, function(text, xml, xhr){
+ var msg = 'Folio de Pagos 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 Pagos debe ser un número'
+ msg_error(msg)
+ return
+ }
+
+ webix.ajax().post('/config', {'txt_config_cfdipay_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 Pagos guardado correctamente'
+ msg_ok(msg)
+ }else{
+ msg_error(values.msg)
+ }
+ }
+ })
+
+}
+
+
function cmd_niveles_educativos_click(){
admin_ui_niveles_educativos.init()
$$('win_niveles_educativos').show()
diff --git a/source/static/js/controller/bancos.js b/source/static/js/controller/bancos.js
index 739bf56..661a0ae 100644
--- a/source/static/js/controller/bancos.js
+++ b/source/static/js/controller/bancos.js
@@ -44,6 +44,7 @@ var bancos_controllers = {
$$('grid_cfdi_pay').attachEvent('onItemClick', grid_cfdi_pay_click)
set_year_month()
+ show('cmd_complemento_pago', get_config('used_cfdi_pays'))
}
}
diff --git a/source/static/js/controller/main.js b/source/static/js/controller/main.js
index de96b83..72a72ac 100644
--- a/source/static/js/controller/main.js
+++ b/source/static/js/controller/main.js
@@ -6,7 +6,7 @@ function configuracion_inicial(){
var values = data.json()
show('cmd_ir_al_admin', values)
})
- webix.ajax().get('/values/main', function(text, data){
+ webix.ajax().sync().get('/values/main', function(text, data){
var values = data.json()
$$('lbl_title_main').setValue(values.empresa)
var pos = 4
@@ -37,6 +37,7 @@ function configuracion_inicial(){
$$('cmd_update_timbres').define('badge', values.timbres)
$$('cmd_update_timbres').refresh()
add_config({'key': 'decimales_precios', 'value': values.decimales_precios})
+ add_config({'key': 'used_cfdi_pays', 'value': values.pagos})
})
get_way_payment()
diff --git a/source/static/js/ui/admin.js b/source/static/js/ui/admin.js
index 7936869..accd424 100644
--- a/source/static/js/ui/admin.js
+++ b/source/static/js/ui/admin.js
@@ -1,3 +1,18 @@
+//~ Empresa Libre
+//~ Copyright (C) 2016-2018 Mauricio Baeza Servin (web@correolibre.net)
+//~
+//~ This program is free software: you can redistribute it and/or modify
+//~ it under the terms of the GNU General Public License as published by
+//~ the Free Software Foundation, either version 3 of the License, or
+//~ (at your option) any later version.
+//~
+//~ This program is distributed in the hope that it will be useful,
+//~ but WITHOUT ANY WARRANTY; without even the implied warranty of
+//~ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+//~ GNU General Public License for more details.
+//~
+//~ You should have received a copy of the GNU General Public License
+//~ along with this program. If not, see .
var form_editar_usuario_elementos = [
@@ -654,6 +669,14 @@ var options_admin_otros = [
{view: 'checkbox', id: 'chk_config_edu', labelWidth: 0,
labelRight: 'Usar el complemento EDU'},
{}]},
+ {cols: [{maxWidth: 15},
+ {view: 'checkbox', id: 'chk_config_pagos', labelWidth: 0,
+ labelRight: 'Usar complemento de pagos'},
+ {view: 'text', id: 'txt_config_cfdipay_serie', name: 'txt_config_cfdipay_serie',
+ label: 'Serie', labelWidth: 50, labelAlign: 'right'},
+ {view: 'text', id: 'txt_config_cfdipay_folio', name: 'txt_config_cfdipay_serie',
+ label: 'Folio', labelWidth: 50, labelAlign: 'right'},
+ {}]},
{maxHeight: 20},
{template: 'Punto de venta', type: 'section'},
{cols: [{maxWidth: 15},