Commit c6df5ebaa04346f007465dc160cd607794e60ddd

Authored by Eric Fernandez
1 parent 262c826ac8
Exists in master and in 2 other branches develop, lab

refactor seguimiento de cobranzas

Showing 1 changed file with 12 additions and 6 deletions   Show diff stats
src/js/osm-directive.js
... ... @@ -24,7 +24,7 @@ angular.module('focaAdminSeguimiento').directive('osm', function() {
24 24  
25 25 if ($scope.parametros.actividad === 'Cobranza') {
26 26 observacion = getCobranza(marcador);
27   - }
  27 + }
28 28  
29 29 if ($scope.parametros.actividad === 'Entrega de producto') {
30 30 observacion = getEntrega(marcador);
... ... @@ -96,7 +96,8 @@ angular.module('focaAdminSeguimiento').directive('osm', function() {
96 96 }
97 97  
98 98 function getCobranza(marcador) {
99   - observacion += 'Cobrador: ' + marcador.recibo.cobrador.id + ' - ' +
  99 + observacion = '';
  100 + observacion += 'Cobrador: ' + marcador.recibo.cobrador.CodVen + ' - ' +
100 101 marcador.recibo.CFE + '<br/>';
101 102  
102 103 if (!$scope.parametros.individual) {
... ... @@ -107,23 +108,28 @@ angular.module(&#39;focaAdminSeguimiento&#39;).directive(&#39;osm&#39;, function() {
107 108 $filter('date')(marcador.fecha.slice(0,10), 'dd/MM/yyyy') + ' ' +
108 109 marcador.fecha.slice(11,19) + '<br/>';
109 110 observacion += 'Nº: ' + $filter('comprobante')([
110   - marcador.sucursal, marcador.idUsuario]) + '<br/>';
  111 + marcador.recibo.PVE, marcador.recibo.NCO]) + '<br/>';
111 112 observacion += 'Cliente: ' + marcador.recibo.cliente.NOM + '<br/>';
  113 + var totalCobrado = 0;
  114 + for (var i = 0; i < marcador.recibo.facturas.length; i++) {
  115 + if (marcador.recibo.facturas[i].LOP === 'P') {
  116 + totalCobrado += marcador.recibo.facturas[i].IMP;
  117 + }
  118 + }
112 119  
113 120 if ($scope.parametros.individual) {
114 121 if (marcador.distancia) {
115 122 observacion += 'Distancia a casa central: ' +
116 123 marcador.distancia + 'km' + '<br/>';
117 124 observacion += 'Total Cobrado: ' +
118   - $filter('currency')(marcador.factura.IPA, '$');
  125 + $filter('currency')(totalCobrado, '$');
119 126 }
120 127 } else {
121 128 observacion += 'Cantidad de cobranzas: ' +
122 129 marcador.cantidad + '<br/>';
123 130 observacion += 'Total Cobrado: ' +
124   - $filter('currency')(marcador.factura.IPA, '$');
  131 + $filter('currency')(totalCobrado, '$');
125 132 }
126   -
127 133 return observacion;
128 134 }
129 135