From d70c35b4de0b5ebbb51376315d00e397f3491384 Mon Sep 17 00:00:00 2001 From: Mauricio Baeza Date: Thu, 4 Oct 2018 23:25:52 -0500 Subject: [PATCH] Error #295 --- source/app/models/main.py | 8 ++++---- source/static/js/controller/bancos.js | 16 ++++++++-------- source/static/js/ui/bancos.js | 2 +- 3 files changed, 13 insertions(+), 13 deletions(-) diff --git a/source/app/models/main.py b/source/app/models/main.py index 0a46459..91e4154 100644 --- a/source/app/models/main.py +++ b/source/app/models/main.py @@ -41,6 +41,7 @@ from settings import log, DEBUG, VERSION, PATH_CP, COMPANIES, PRE, CURRENT_CFDI, FORMAT = '{0:.2f}' FORMAT3 = '{0:.3f}' FORMAT4 = '{0:.4f}' +FORMAT6 = '{0:.6f}' FORMAT_TAX = FORMAT4 FORMAT_PRECIO = FORMAT4 RFC_PUBLICO = 'XAXX010101000' @@ -5349,7 +5350,7 @@ class FacturasPagos(BaseModel): fac = Facturas.get(Facturas.id==int(i)) this_pay = values['this_pay'] importe = values['importe'] - type_change = values['type_change'] + type_change = round(this_pay / importe, 6) mov_ant, numero = cls._movimiento_anterior(cls, mov, fac) nuevo = { 'movimiento': mov, @@ -5368,7 +5369,7 @@ class FacturasPagos(BaseModel): else: nuevo['importe'] = this_pay nuevo['saldo'] = nuevo['saldo_anterior'] - this_pay - print('\n\n', nuevo) + FacturasPagos.create(**nuevo) fac.saldo = nuevo['saldo'] @@ -5627,7 +5628,7 @@ class CfdiPagos(BaseModel): r['IdDocumento'] = str(r['IdDocumento']) r['Folio'] = str(r['Folio']) r['NumParcialidad'] = str(r['NumParcialidad']) - r['TipoCambioDR'] = FORMAT4.format(r['TipoCambioDR']) + r['TipoCambioDR'] = FORMAT6.format(r['TipoCambioDR']) r['MetodoDePagoDR'] = DEFAULT_CFDIPAY['WAYPAY'] r['ImpSaldoAnt'] = FORMAT.format(r['ImpSaldoAnt']) r['ImpPagado'] = FORMAT.format(r['ImpPagado']) @@ -5639,7 +5640,6 @@ class CfdiPagos(BaseModel): del r['TipoCambioDR'] if not r['Serie']: del r['Serie'] - print(r) return related diff --git a/source/static/js/controller/bancos.js b/source/static/js/controller/bancos.js index 3f0d423..db6e78e 100644 --- a/source/static/js/controller/bancos.js +++ b/source/static/js/controller/bancos.js @@ -432,9 +432,9 @@ function actualizar_deposito(grid){ } suma += obj.importe.to_float() if(obj.type_change == undefined){ - if(obj.currency==CURRENCY_MN || obj.currency==current_currency){ - obj.type_change = 1.00 - } + //~ if(obj.currency==CURRENCY_MN || obj.currency==current_currency){ + obj.type_change = 1.00 + //~ } } }) @@ -620,11 +620,11 @@ function validate_deposito(values){ if(obj.currency!=CURRENCY_MN && obj.currency!=current_currency){ if(obj.type_change==undefined){ msg_tc = 'Captura el Tipo de Cambio' - //~ }else{ - //~ var tc = obj.type_change - //~ if(tc <= 1.0){ - //~ msg_tc = 'El Tipo de Cambio debe ser mayor a 1.00' - //~ } + }else{ + var tc = obj.type_change + if(tc <= 1.0){ + msg_tc = 'El Tipo de Cambio debe ser mayor a 1.00' + } } } }) diff --git a/source/static/js/ui/bancos.js b/source/static/js/ui/bancos.js index 9900f4d..2f804ae 100644 --- a/source/static/js/ui/bancos.js +++ b/source/static/js/ui/bancos.js @@ -125,7 +125,7 @@ var grid_cfdi_este_deposito_cols = [ {id: 'importe', header: ['Este pago'], width: 125, sort: 'int', format: webix.i18n.priceFormat, css: 'right', editor: 'text'}, {id: 'type_change', header: ['T.C.'], width: 75, hidden: true, - format: format_currency4, css: 'right', editor: 'text'}, + format: format_currency4, css: 'right'}, ]