From ac4df4383532301c91590a95c117b33dfa7f236c Mon Sep 17 00:00:00 2001 From: Mauricio Baeza Date: Mon, 12 Feb 2018 23:51:42 -0600 Subject: [PATCH] Fix - Issue #172 --- source/app/models/main.py | 2 +- source/static/js/controller/bancos.js | 24 +++++++++++++++++++----- source/static/js/ui/bancos.js | 6 +++--- 3 files changed, 23 insertions(+), 9 deletions(-) diff --git a/source/app/models/main.py b/source/app/models/main.py index 0080671..752ef52 100644 --- a/source/app/models/main.py +++ b/source/app/models/main.py @@ -1827,7 +1827,7 @@ class MovimientosBanco(BaseModel): def get_(cls, values): cuenta = int(values['cuenta']) if 'fechas' in values: - rango = values['fechas'] + rango = util.loads(values['fechas']) fd = (MovimientosBanco.fecha.between( util.get_date(rango['start']), util.get_date(rango['end'], True))) diff --git a/source/static/js/controller/bancos.js b/source/static/js/controller/bancos.js index 338e8ef..09e7656 100644 --- a/source/static/js/controller/bancos.js +++ b/source/static/js/controller/bancos.js @@ -17,6 +17,9 @@ var bancos_controllers = { $$('grid_cfdi_por_pagar').attachEvent('onAfterDrop', grid_cfdi_por_pagar_after_drop) $$('grid_cfdi_este_deposito').attachEvent('onBeforeEditStop', grid_cfdi_este_deposito_before_edit_stop) $$('grid_cfdi_este_deposito').attachEvent('onAfterEditStop', grid_cfdi_este_deposito_after_edit_stop) + $$('filter_cuenta_year').attachEvent('onChange', filter_cuenta_change) + $$('filter_cuenta_month').attachEvent('onChange', filter_cuenta_change) + $$('filter_cuenta_dates').attachEvent('onChange', filter_cuenta_dates_change) set_year_month() } } @@ -24,8 +27,8 @@ var bancos_controllers = { function set_year_month(){ var d = new Date() - var y = $$('filtro_cuenta_year') - var m = $$('filtro_cuenta_mes') + var y = $$('filter_cuenta_year') + var m = $$('filter_cuenta_month') webix.ajax().get('/values/cuentayears', { error:function(text, data, XmlHttpRequest){ @@ -77,8 +80,8 @@ function get_estado_cuenta(rango){ if(rango == undefined){ var filtro = { cuenta: $$('lst_cuentas_banco').getValue(), - year: $$('filtro_cuenta_year').getValue(), - mes: $$('filtro_cuenta_mes').getValue(), + year: $$('filter_cuenta_year').getValue(), + mes: $$('filter_cuenta_month').getValue(), } }else{ var filtro = { @@ -120,7 +123,7 @@ function get_saldo_cuenta(){ function lst_cuentas_banco_change(nv, ov){ - //~ showvar('Cuenta change') + get_estado_cuenta() } @@ -656,4 +659,15 @@ function cmd_invoice_payed_click(){ } }) +} + + +function filter_cuenta_change(){ + get_estado_cuenta() +} + +function filter_cuenta_dates_change(range){ + if(range.start != null && range.end != null){ + get_estado_cuenta(range) + } } \ No newline at end of file diff --git a/source/static/js/ui/bancos.js b/source/static/js/ui/bancos.js index a5856fa..b97128b 100644 --- a/source/static/js/ui/bancos.js +++ b/source/static/js/ui/bancos.js @@ -10,11 +10,11 @@ var toolbar_banco = [ var toolbar_filtro_cuenta = [ - {view: 'richselect', id: 'filtro_cuenta_year', label: 'Año', + {view: 'richselect', id: 'filter_cuenta_year', label: 'Año', labelAlign: 'right', labelWidth: 50, width: 150, options: []}, - {view: 'richselect', id: 'filtro_cuenta_mes', label: 'Mes', + {view: 'richselect', id: 'filter_cuenta_month', label: 'Mes', labelAlign: 'right', labelWidth: 50, width: 200, options: months}, - {view: 'daterangepicker', id: 'filtro_cuenta_fechas', label: 'Fechas', + {view: 'daterangepicker', id: 'filter_cuenta_dates', label: 'Fechas', labelAlign: 'right', width: 300}, {}, ]