Commit f390a93465b3d96d594c59fac3a7763894cde790
Exists in
master
and in
1 other branch
Merge branch 'master' into 'master'
Master(efernandez) See merge request !19
Showing
1 changed file
Show diff stats
src/js/osm-directive.js
... | ... | @@ -13,10 +13,10 @@ angular.module('focaAdminSeguimiento').directive('osm', function() { |
13 | 13 | for(var i in $scope.markers) { |
14 | 14 | $scope.map.removeLayer($scope.markers[i]); |
15 | 15 | } |
16 | - | |
16 | + | |
17 | 17 | $scope.markers = []; |
18 | 18 | var observacion = ''; |
19 | - | |
19 | + | |
20 | 20 | angular.forEach($scope.marcadores, function(marcador) { |
21 | 21 | if ($scope.parametros.actividad === 'Nota de pedido') { |
22 | 22 | observacion = generarObservacion(getNotaPedido(marcador)); |
... | ... | @@ -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); |
... | ... | @@ -35,7 +35,7 @@ angular.module('focaAdminSeguimiento').directive('osm', function() { |
35 | 35 | L.marker([marcador.latitud, marcador.longitud]).addTo($scope.map) |
36 | 36 | .bindPopup(observacion) |
37 | 37 | ); |
38 | - | |
38 | + | |
39 | 39 | $scope.markers[0].openPopup(); |
40 | 40 | } |
41 | 41 | }); |
... | ... | @@ -46,7 +46,7 @@ angular.module('focaAdminSeguimiento').directive('osm', function() { |
46 | 46 | if (!marcador.notaPedido.id) { |
47 | 47 | return false; |
48 | 48 | } |
49 | - | |
49 | + | |
50 | 50 | var notaPedido = marcador.notaPedido; |
51 | 51 | var textVendedor = notaPedido.idVendedor + ' - '; |
52 | 52 | |
... | ... | @@ -59,11 +59,11 @@ angular.module('focaAdminSeguimiento').directive('osm', function() { |
59 | 59 | if (!$scope.parametros.individual) { |
60 | 60 | observacion.push(['Ultima Nota de Pedido', '']); |
61 | 61 | } |
62 | - | |
62 | + | |
63 | 63 | var textFecha = $filter('date')(marcador.fecha.slice(0,10), 'dd/MM/yyyy') + |
64 | 64 | ' ' + marcador.fecha.slice(11,19); |
65 | 65 | observacion.push(['Fecha', textFecha]); |
66 | - | |
66 | + | |
67 | 67 | observacion.push(['Nº', |
68 | 68 | $filter('comprobante')([notaPedido.sucursal, notaPedido.numeroNotaPedido ]) |
69 | 69 | ]); |
... | ... | @@ -71,7 +71,7 @@ angular.module('focaAdminSeguimiento').directive('osm', function() { |
71 | 71 | if (notaPedido.cliente) { |
72 | 72 | observacion.push(['Cliente', notaPedido.cliente.NOM]); |
73 | 73 | } |
74 | - | |
74 | + | |
75 | 75 | if ($scope.parametros.individual) { |
76 | 76 | observacion.push(['Total', $filter('currency')(notaPedido.total, '$')]); |
77 | 77 | observacion.unshift(['Orden', marcador.orden]); |
... | ... | @@ -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('focaAdminSeguimiento').directive('osm', 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/>'; |
112 | - | |
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 | + } | |
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 | |
... | ... | @@ -149,14 +155,14 @@ angular.module('focaAdminSeguimiento').directive('osm', function() { |
149 | 155 | observacion += 'Fecha: ' + |
150 | 156 | $filter('date')(marcador.fecha.slice(0,10), 'dd/MM/yyyy') + ' ' + |
151 | 157 | marcador.fecha.slice(11,19) + '<br/>'; |
152 | - | |
158 | + | |
153 | 159 | observacion += 'Nº: ' + $filter('comprobante')([ |
154 | 160 | remito.sucursal, |
155 | 161 | remito.numeroRemito |
156 | 162 | ]) + '<br/>'; |
157 | 163 | observacion += 'Cliente: ' + |
158 | 164 | remito.cliente.NOM + '<br/>'; |
159 | - | |
165 | + | |
160 | 166 | if ($scope.parametros.individual) { |
161 | 167 | observacion += 'Producto: ' + |
162 | 168 | remito.articulosRemito[0].descripcion + '<br/>'; |