Commit 673ad2b49283fdd9f5e20d12de437892db0a3ea7
1 parent
4880965f3e
Exists in
master
and in
1 other branch
Cambio en el servicio para traer el resumen de cuenta.
Showing
2 changed files
with
20 additions
and
17 deletions
Show diff stats
src/js/controller.js
... | ... | @@ -6,10 +6,11 @@ angular.module('focaModalResumenCuenta') |
6 | 6 | '$uibModalInstance', |
7 | 7 | 'focaModalResumenCuentaService', |
8 | 8 | 'cliente', |
9 | + 'idMoneda', | |
9 | 10 | '$uibModal', |
10 | 11 | 'focaModalService', |
11 | 12 | function ($timeout, $filter, $scope, $uibModalInstance, |
12 | - focaModalResumenCuentaService, cliente, $uibModal, focaModalService) { | |
13 | + focaModalResumenCuentaService, cliente, idMoneda, $uibModal, focaModalService) { | |
13 | 14 | var fecha = new Date(); |
14 | 15 | $scope.generado = false; |
15 | 16 | $scope.fechaDesde = new Date(fecha.setMonth(fecha.getMonth() - 1)); |
... | ... | @@ -20,15 +21,15 @@ angular.module('focaModalResumenCuenta') |
20 | 21 | |
21 | 22 | $scope.generar = function () { |
22 | 23 | focaModalResumenCuentaService |
23 | - .getResumenCuenta(cliente.COD, $scope.fechaDesde) | |
24 | + .getResumenCuenta(cliente.COD, idMoneda, $scope.fechaDesde) | |
24 | 25 | .then(function (res) { |
25 | - res.data.facturas = res.data.facturas.filter(function(factura){ | |
26 | + res.data = res.data.filter(function(factura){ | |
26 | 27 | return factura.TCO !== "RC" && factura.TCO !== "RE" |
27 | 28 | }) |
28 | - res.data.facturas = calcularSaldos(res.data.facturas); | |
29 | + res.data = calcularSaldos(res.data); | |
29 | 30 | $scope.generado = true; |
30 | 31 | $scope.results = res.data; |
31 | - $scope.results.fechaDesde = $scope.fechaDesde; | |
32 | + // $scope.results.fechaDesde = $scope.fechaDesde; | |
32 | 33 | $scope.search(); |
33 | 34 | }); |
34 | 35 | }; |
... | ... | @@ -96,9 +97,9 @@ angular.module('focaModalResumenCuenta') |
96 | 97 | |
97 | 98 | |
98 | 99 | $scope.search = function () { |
99 | - if ($scope.results.facturas.length) { | |
100 | + if ($scope.results.length) { | |
100 | 101 | $scope.lastPage = Math.ceil( |
101 | - $scope.results.facturas.length / $scope.numPerPage | |
102 | + $scope.results.length / $scope.numPerPage | |
102 | 103 | ); |
103 | 104 | $scope.resetPage(); |
104 | 105 | } |
... | ... | @@ -114,7 +115,7 @@ angular.module('focaModalResumenCuenta') |
114 | 115 | var end = start + $scope.numPerPage; |
115 | 116 | $scope.paginas = []; |
116 | 117 | $scope.paginas = calcularPages(page); |
117 | - $scope.currentPageFacturas = $scope.results.facturas.slice(start, end); | |
118 | + $scope.currentPageFacturas = $scope.results.slice(start, end); | |
118 | 119 | $scope.currentPage = page; |
119 | 120 | }; |
120 | 121 | |
... | ... | @@ -164,7 +165,7 @@ angular.module('focaModalResumenCuenta') |
164 | 165 | factura.saldo_show = Math.abs(saldo); |
165 | 166 | factura.IPA_SHOW = Math.abs(factura.IPA); |
166 | 167 | }); |
167 | - | |
168 | + facturas.saldo = saldo; | |
168 | 169 | return facturas; |
169 | 170 | } |
170 | 171 | }] |
src/js/service.js
1 | 1 | angular.module('focaModalResumenCuenta') |
2 | - .factory('focaModalResumenCuentaService', ['$http', 'API_ENDPOINT', function($http, API_ENDPOINT) { | |
2 | + .factory('focaModalResumenCuentaService', ['$http', 'API_ENDPOINT', function ($http, API_ENDPOINT) { | |
3 | 3 | return { |
4 | - getResumenCuenta: function(idCliente, fechaDesde) { | |
5 | - return $http.get(API_ENDPOINT.URL + | |
6 | - '/factura/resumen/' + idCliente + '/' + fechaDesde); | |
4 | + getResumenCuenta: function (idCliente, idMoneda, fechaDesde) { | |
5 | + return $http.get(API_ENDPOINT.URL + '/factura/cliente/' + idCliente + '/' + idMoneda + '/' + | |
6 | + fechaDesde + '/' + '2100-12-31' + '/' + true); | |
7 | + // '2001-01-01', | |
8 | + // '2100-12-31' | |
7 | 9 | }, |
8 | - enviarFacturaPorMail: function(receiver, factura) { | |
10 | + enviarFacturaPorMail: function (receiver, factura) { | |
9 | 11 | return $http.post(API_ENDPOINT.URL + '/mail', |
10 | - {receiver: receiver, factura: factura}); | |
12 | + { receiver: receiver, factura: factura }); | |
11 | 13 | }, |
12 | - enviarResumenPorMail: function(receiver, resumen) { | |
14 | + enviarResumenPorMail: function (receiver, resumen) { | |
13 | 15 | return $http.post(API_ENDPOINT.URL + '/mail/resumen-cuenta', |
14 | - {receiver: receiver, resumen: resumen}); | |
16 | + { receiver: receiver, resumen: resumen }); | |
15 | 17 | } |
16 | 18 | }; |
17 | 19 | }]); |