Commit 7f4b5185596288a0856b34f86893cee7190fc135

Authored by Jose Pinto
1 parent ca15f7c990
Exists in master and in 1 other branch develop

saco buscador, orden y data resultados ok

src/js/controller.js
... ... @@ -69,7 +69,7 @@ angular.module('focaModalFactura')
69 69 $scope.selectedFactura = -1;
70 70 $scope.searchLoading = false;
71 71 $scope.primerBusqueda = true;
72   - $scope.facturas = res.data;
  72 + $scope.facturas = calcularSaldos(res.data);
73 73 $scope.search();
74 74 primera();
75 75 }
... ... @@ -193,6 +193,26 @@ angular.module('focaModalFactura')
193 193 $scope.selectedFactura = 0;
194 194 }
195 195 }
  196 +
  197 + function calcularSaldos(facturas) {
  198 + var saldo = 0;
  199 +
  200 + facturas.forEach(function(factura) {
  201 + if (factura.TCO === 'CI' ||
  202 + factura.TCO === 'FT' ||
  203 + factura.TCO === 'ND'){
  204 + factura.IPA = factura.IPA * -1;
  205 + }else{
  206 + factura.IPA = factura.IPA;
  207 + }
  208 + saldo += factura.IPA;
  209 + factura.saldo = saldo;
  210 + });
  211 +
  212 + return facturas;
  213 + }
  214 +
  215 + $scope.busquedaPress(13);
196 216 }
197 217 ]
198 218 );
src/views/foca-modal-factura.html
... ... @@ -3,44 +3,16 @@
3 3 <div class="col-lg-6">
4 4 <h5 class="modal-title">Búsqueda de Comprobantes</h5>
5 5 </div>
6   - <div class="input-group col-lg-6 pr-0 my-2">
7   - <input
8   - ladda="searchLoading"
9   - type="text"
10   - class="form-control form-control-sm"
11   - placeholder="Búsqueda"
12   - ng-model="filters"
13   - ng-change="search()"
14   - ng-keydown="busquedaDown($event.keyCode)"
15   - ng-keypress="busquedaPress($event.keyCode)"
16   - foca-focus="selectedFactura == -1"
17   - ng-focus="selectedFactura = -1"
18   - teclado-virtual
19   - />
20   - <div class="input-group-append">
21   - <button
22   - ladda="searchLoading"
23   - class="btn btn-outline-secondary"
24   - type="button"
25   - ng-click="busquedaPress(13)"
26   - >
27   - <i class="fa fa-search" aria-hidden="true"></i>
28   - </button>
29   - </div>
30   - </div>
31 6 </div>
32 7 </div>
33   -<div class="modal-body" id="modal-body">
34   - <div ng-show="!primerBusqueda">
35   - Debe realizar una primer búsqueda.
36   - </div>
37   -
  8 +<div class="modal-body" id="modal-body">
38 9 <table ng-show="primerBusqueda" class="table table-striped table-sm">
39 10 <thead>
40 11 <tr>
41   - <th>Fecha</th>
42   - <th>Nro</th>
  12 + <th>Comprobante</th>
  13 + <th>Vencimiento</th>
43 14 <th class="text-right">Importe</th>
  15 + <th class="text-right">Saldo</th>
44 16 <th class="text-right"></th>
45 17 </tr>
46 18 </thead>
... ... @@ -51,13 +23,16 @@
51 23 </td>
52 24 </tr>
53 25 <tr class="selectable"
54   - ng-repeat="(key,factura) in currentPageFacturas">
55   - <td ng-bind="factura.FEP | date : 'dd/MM/yyyy'"></td>
56   - <td ng-bind= "factura.numeroFactura"></td>
57   - <td
58   - class="text-right"
59   - ng-bind="(factura.IPA / parametrosFactura.cotizacion) |
60   - currency: parametrosFactura.simbolo"></td>
  26 + ng-repeat="(key,factura) in currentPageFacturas"
  27 + ng-click="factura.checked = !factura.checked">
  28 + <td>{{factura.numeroFactura}} {{factura.FEP | date : 'dd/MM/yyyy'}}</td>
  29 + <td>{{(factura.TCO == 'FT') ? factura.NCU + ' - ' : ''}}{{factura.FEV | date : 'dd/MM/yyyy'}}</td>
  30 + <td class="text-right">
  31 + <span ng-if="factura.IPA >= 0">+</span>{{(factura.IPA / parametrosFactura.cotizacion) | number:2}}
  32 + </td>
  33 + <td class="text-right">
  34 + <span ng-if="factura.saldo >= 0">+</span>{{factura.saldo | number:2}}
  35 + </td>
61 36 <td class="text-right">
62 37 <input
63 38 ng-class="{