From 7f4b5185596288a0856b34f86893cee7190fc135 Mon Sep 17 00:00:00 2001 From: Jose Pinto Date: Fri, 7 Dec 2018 15:56:12 -0300 Subject: [PATCH] saco buscador, orden y data resultados ok --- src/js/controller.js | 22 +++++++++++++++- src/views/foca-modal-factura.html | 53 +++++++++++---------------------------- 2 files changed, 35 insertions(+), 40 deletions(-) diff --git a/src/js/controller.js b/src/js/controller.js index fcb608a..ab37097 100644 --- a/src/js/controller.js +++ b/src/js/controller.js @@ -69,7 +69,7 @@ angular.module('focaModalFactura') $scope.selectedFactura = -1; $scope.searchLoading = false; $scope.primerBusqueda = true; - $scope.facturas = res.data; + $scope.facturas = calcularSaldos(res.data); $scope.search(); primera(); } @@ -193,6 +193,26 @@ angular.module('focaModalFactura') $scope.selectedFactura = 0; } } + + function calcularSaldos(facturas) { + var saldo = 0; + + facturas.forEach(function(factura) { + if (factura.TCO === 'CI' || + factura.TCO === 'FT' || + factura.TCO === 'ND'){ + factura.IPA = factura.IPA * -1; + }else{ + factura.IPA = factura.IPA; + } + saldo += factura.IPA; + factura.saldo = saldo; + }); + + return facturas; + } + + $scope.busquedaPress(13); } ] ); diff --git a/src/views/foca-modal-factura.html b/src/views/foca-modal-factura.html index 58d7931..3947f1a 100644 --- a/src/views/foca-modal-factura.html +++ b/src/views/foca-modal-factura.html @@ -3,44 +3,16 @@
-
- -
- -
-
-