Commit 63ccc7d4997b3aa00fae4cfe68ac6c511ef0f846

Authored by Nicolás Guarnieri
1 parent 939dcb4c17
Exists in master and in 1 other branch develop

seguimiento de cobranza

src/js/osm-directive.js
1 angular.module('focaAdminSeguimiento').directive('osm', function() { 1 angular.module('focaAdminSeguimiento').directive('osm', function() {
2 return { 2 return {
3 restrict: 'E', 3 restrict: 'E',
4 link: function(scope, el, attrs) { 4 link: function(scope, el, attrs) {
5 var contenedor = document.createElement('div'); 5 var contenedor = document.createElement('div');
6 el.append(contenedor); 6 el.append(contenedor);
7 scope.map = L.map(contenedor).setView([attrs.latitud, attrs.longitud], attrs.zoom); 7 scope.map = L.map(contenedor).setView([attrs.latitud, attrs.longitud], attrs.zoom);
8 L.tileLayer('https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png').addTo(scope.map); 8 L.tileLayer('https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png').addTo(scope.map);
9 }, 9 },
10 controller: ['$scope', '$filter', function($scope, $filter) { 10 controller: ['$scope', '$filter', function($scope, $filter) {
11 $scope.markers = []; 11 $scope.markers = [];
12 $scope.$watch('marcadores', function() { 12 $scope.$watch('marcadores', function() {
13 for(var i in $scope.markers) { 13 for(var i in $scope.markers) {
14 $scope.map.removeLayer($scope.markers[i]); 14 $scope.map.removeLayer($scope.markers[i]);
15 } 15 }
16 16
17 $scope.markers = []; 17 $scope.markers = [];
18 angular.forEach($scope.marcadores, function(marcador) { 18 angular.forEach($scope.marcadores, function(marcador) {
19 var observacion = ''; 19 var observacion = '';
20 20
21 if ($scope.parametros.actividad === 'Nota de pedido') { 21 if ($scope.parametros.actividad === 'Nota de pedido') {
22 observacion += 22 observacion +=
23 'Vendedor: ' + marcador.notaPedido.idVendedor + ' - ' + 23 'Vendedor: ' + marcador.notaPedido.idVendedor + ' - ' +
24 ( 24 (
25 marcador.notaPedido.vendedor ? 25 marcador.notaPedido.vendedor ?
26 marcador.notaPedido.vendedor.NomVen : 26 marcador.notaPedido.vendedor.NomVen :
27 '' 27 ''
28 ) + '<br/>'; 28 ) + '<br/>';
29 observacion += 'Fecha: ' + 29 observacion += 'Fecha: ' +
30 $filter('date')(marcador.fecha.slice(0,10), 'dd/MM/yyyy') + ' ' + 30 $filter('date')(marcador.fecha.slice(0,10), 'dd/MM/yyyy') + ' ' +
31 marcador.fecha.slice(11,19) + '<br/>'; 31 marcador.fecha.slice(11,19) + '<br/>';
32 observacion += 'Nº: ' + $filter('comprobante')([ 32 observacion += 'Nº: ' + $filter('comprobante')([
33 marcador.notaPedido.sucursal, 33 marcador.notaPedido.sucursal,
34 marcador.notaPedido.numeroNotaPedido 34 marcador.notaPedido.numeroNotaPedido
35 ]) + '<br/>'; 35 ]) + '<br/>';
36 observacion += 'Cliente: ' + 36 observacion += 'Cliente: ' +
37 marcador.notaPedido.cliente.NOM + '<br/>'; 37 marcador.notaPedido.cliente.NOM + '<br/>';
38 38
39 if ($scope.parametros.individual) { 39 if ($scope.parametros.individual) {
40 observacion += 40 observacion +=
41 'Total: ' + $filter('currency')(marcador.notaPedido.total, '$'); 41 'Total: ' + $filter('currency')(marcador.notaPedido.total, '$');
42 observacion = 'Orden: ' + marcador.orden + '<br/>' + observacion; 42 observacion = 'Orden: ' + marcador.orden + '<br/>' + observacion;
43 43
44 if (marcador.distancia) { 44 if (marcador.distancia) {
45 observacion += '<br/>Distancia a casa central: ' + 45 observacion += '<br/>Distancia a casa central: ' +
46 marcador.distancia + 'km'; 46 marcador.distancia + 'km';
47 } 47 }
48 } else { 48 } else {
49 observacion += 'Cantidad de nota de pedido: ' + 49 observacion += 'Cantidad de nota de pedido: ' +
50 marcador.cantidad + '<br/>'; 50 marcador.cantidad + '<br/>';
51 observacion += 'Total Vendido: ' + 51 observacion += 'Total Vendido: ' +
52 $filter('currency')(marcador.total, '$'); 52 $filter('currency')(marcador.total, '$');
53 } 53 }
54 } 54 }
55 55
56 if ($scope.parametros.actividad === 'Cobranza') { 56 if ($scope.parametros.actividad === 'Cobranza') {
57 observacion += 'Cobrador: ' + marcador.recibo.CFE + '<br/>'; 57 observacion += 'Cobrador: ' + marcador.recibo.cobrador.id + ' - ' +
58 marcador.recibo.CFE + '<br/>';
59
60 if (!$scope.parametros.individual) {
61 observacion += '<b>Ultima Cobranza</b><br/>';
62 }
63
58 observacion += 'Fecha: ' + 64 observacion += 'Fecha: ' +
59 $filter('date')(marcador.fecha.slice(0,10), 'dd/MM/yyyy') + ' ' + 65 $filter('date')(marcador.fecha.slice(0,10), 'dd/MM/yyyy') + ' ' +
60 marcador.fecha.slice(11,19) + '<br/>'; 66 marcador.fecha.slice(11,19) + '<br/>';
61 observacion += 'Nº: ' + $filter('comprobante')([ 67 observacion += 'Nº: ' + $filter('comprobante')([
62 marcador.sucursal, marcador.idUsuario]) + '<br/>'; 68 marcador.sucursal, marcador.idUsuario]) + '<br/>';
63 observacion += 'Cliente: ' + marcador.recibo.cliente.NOM + '<br/>'; 69 observacion += 'Cliente: ' + marcador.recibo.cliente.NOM + '<br/>';
64 observacion += 'Total Cobrado: $' + marcador.factura.IPA; 70 observacion += 'Total Cobrado: ' +
71 $filter('currency')(marcador.factura.IPA, '$');
72
73 if ($scope.parametros.individual) {
74 if (marcador.distancia) {
75 observacion += '<br/>Distancia a casa central: ' +
76 marcador.distancia + 'km';
77 }
78 }
65 } 79 }
66 80
67 if ($scope.parametros.actividad === 'Entrega de producto') { 81 if ($scope.parametros.actividad === 'Entrega de producto') {
68 observacion += 'Vehiculo: ' + 82 observacion += 'Vehiculo: ' +
69 marcador.remito.hojaRuta.idVehiculo + ' - ' + 83 marcador.remito.hojaRuta.idVehiculo + ' - ' +
70 marcador.remito.hojaRuta.vehiculo.tractor + '<br/>'; 84 marcador.remito.hojaRuta.vehiculo.tractor + '<br/>';
71 observacion += 'Transportista: ' + 85 observacion += 'Transportista: ' +
72 marcador.remito.hojaRuta.transportista.NOM + '<br/>'; 86 marcador.remito.hojaRuta.transportista.NOM + '<br/>';
73 observacion += 'Chofer: ' + 87 observacion += 'Chofer: ' +
74 marcador.remito.hojaRuta.chofer.nombre + '<br/>'; 88 marcador.remito.hojaRuta.chofer.nombre + '<br/>';
75 observacion += 'Fecha: ' + 89 observacion += 'Fecha: ' +
76 $filter('date')(marcador.fecha.slice(0,10), 'dd/MM/yyyy') + ' ' + 90 $filter('date')(marcador.fecha.slice(0,10), 'dd/MM/yyyy') + ' ' +
77 marcador.fecha.slice(11,19) + '<br/>'; 91 marcador.fecha.slice(11,19) + '<br/>';
78 observacion += 'Hoja de ruta: ' + $filter('comprobante')([ 92 observacion += 'Hoja de ruta: ' + $filter('comprobante')([
79 marcador.remito.hojaRuta.sucursal, 93 marcador.remito.hojaRuta.sucursal,
80 marcador.remito.hojaRuta.numeroHojaRuta 94 marcador.remito.hojaRuta.numeroHojaRuta
81 ]) + '<br/>'; 95 ]) + '<br/>';
82 observacion += 'Remito: ' + $filter('comprobante')([ 96 observacion += 'Remito: ' + $filter('comprobante')([
83 marcador.remito.sucursal, 97 marcador.remito.sucursal,
84 marcador.remito.numeroRemito 98 marcador.remito.numeroRemito
85 ]) + '<br/>'; 99 ]) + '<br/>';
86 observacion += 'Cliente: ' + 100 observacion += 'Cliente: ' +
87 marcador.remito.cliente.NOM + '<br/>'; 101 marcador.remito.cliente.NOM + '<br/>';
88 102
89 if ($scope.parametros.individual) { 103 if ($scope.parametros.individual) {
90 observacion += 'Producto: ' + 104 observacion += 'Producto: ' +
91 marcador.remito.articulosRemito[0].descripcion + '<br/>'; 105 marcador.remito.articulosRemito[0].descripcion + '<br/>';
92 observacion += 'Cantidad entregada: ' + 106 observacion += 'Cantidad entregada: ' +
93 marcador.remito.carga + '<br/>'; 107 marcador.remito.carga + '<br/>';
94 108
95 if (marcador.distancia) { 109 if (marcador.distancia) {
96 observacion += 'Distancia a casa central: ' + marcador.distancia + 110 observacion += 'Distancia a casa central: ' + marcador.distancia +
97 'km <br/>'; 111 'km <br/>';
98 } 112 }
99 113
100 if (marcador.observaciones) { 114 if (marcador.observaciones) {
101 observacion += 'Observaciones: ' + marcador.observaciones; 115 observacion += 'Observaciones: ' + marcador.observaciones;
102 } 116 }
103 observacion = 'Orden: ' + marcador.orden + '<br/>' + observacion; 117 observacion = 'Orden: ' + marcador.orden + '<br/>' + observacion;
104 } else { 118 } else {
105 observacion += 'Cantidad de entregas: ' + marcador.cantidad; 119 observacion += 'Cantidad de entregas: ' + marcador.cantidad;
106 } 120 }
107 } 121 }
108 122
109 $scope.markers.push( 123 $scope.markers.push(
110 L.marker([marcador.latitud, marcador.longitud]).addTo($scope.map) 124 L.marker([marcador.latitud, marcador.longitud]).addTo($scope.map)
111 .bindPopup(observacion) 125 .bindPopup(observacion)
112 ); 126 );
113 127
114 $scope.markers[0].openPopup(); 128 $scope.markers[0].openPopup();
115 }); 129 });
116 }); 130 });
117 }], 131 }],
118 scope: { 132 scope: {
119 latitud: '=', 133 latitud: '=',
120 longitud: '=', 134 longitud: '=',
121 zoom: '=', 135 zoom: '=',
122 marcadores: '=', 136 marcadores: '=',
123 parametros: '=' 137 parametros: '='
124 } 138 }
125 }; 139 };
126 }); 140 });
127 141
src/views/foca-admin-seguimiento.html
1 <div class="foca-admin-seguimiento"> 1 <div class="foca-admin-seguimiento">
2 <div class="row"> 2 <div class="row">
3 <div class="offset-1 col-9"> 3 <div class="offset-1 col-9">
4 <osm 4 <osm
5 latitud="-32.89214159952345" 5 latitud="-32.89214159952345"
6 longitud="-68.84572999101856" 6 longitud="-68.84572999101856"
7 zoom="14" 7 zoom="14"
8 marcadores="marcadores" 8 marcadores="marcadores"
9 parametros= "datosBuscados" 9 parametros= "datosBuscados"
10 /> 10 />
11 </div> 11 </div>
12 <div class="col-2 pl-0"> 12 <div class="col-2 pl-0">
13 <input 13 <input
14 type="date" 14 type="date"
15 ng-model="now" 15 ng-model="now"
16 class="btn col-12 my-1" 16 class="btn col-12 my-1"
17 foca-focus="true" 17 foca-focus="true"
18 ng-blur="fecha()" 18 ng-blur="fecha()"
19 hasta-hoy 19 hasta-hoy
20 /> 20 />
21 <button 21 <button
22 type="button" 22 type="button"
23 ng-class="{'active': idUsuario == 0}" 23 ng-class="{'active': idUsuario == 0}"
24 class="btn col-12 my-1" 24 class="btn col-12 my-1"
25 ng-click="general()" 25 ng-click="general()"
26 >General</button> 26 >General</button>
27 <button 27 <button
28 type="button" 28 type="button"
29 ng-class="{'active': idUsuario != 0}" 29 ng-class="{'active': idUsuario != 0}"
30 class="btn col-12 my-1" 30 class="btn col-12 my-1"
31 ng-click="individual()" 31 ng-click="individual()"
32 ng-show="actividad != 'Cobranza'"
33 >Individual</button> 32 >Individual</button>
34 <div class="form-group" ng-show="idUsuario == -1"> 33 <div class="form-group" ng-show="idUsuario == -1">
35 <input 34 <input
36 type="text" 35 type="text"
37 placeholder="Vendedor" 36 placeholder="Vendedor"
38 class="form-control" 37 class="form-control"
39 ng-model="idUsuarioInput" 38 ng-model="idUsuarioInput"
40 ng-keypress="search($event.keyCode)" 39 ng-keypress="search($event.keyCode)"
41 foca-focus="idUsuario == -1" 40 foca-focus="idUsuario == -1"
42 ng-show="actividad == 'Nota de pedido'" 41 ng-show="actividad == 'Nota de pedido'"
43 > 42 >
44 <input 43 <input
45 type="text" 44 type="text"
46 placeholder="Vehiculo" 45 placeholder="Vehiculo"
47 class="form-control" 46 class="form-control"
48 ng-model="idUsuarioInput" 47 ng-model="idUsuarioInput"
49 ng-keypress="search($event.keyCode)" 48 ng-keypress="search($event.keyCode)"
50 foca-focus="idUsuario == -1" 49 foca-focus="idUsuario == -1"
51 ng-show="actividad == 'Entrega de producto'" 50 ng-show="actividad == 'Entrega de producto'"
52 > 51 >
52 <input
53 type="text"
54 placeholder="Cobrador"
55 class="form-control"
56 ng-model="idUsuarioInput"
57 ng-keypress="search($event.keyCode)"
58 foca-focus="idUsuario == -1"
59 ng-show="actividad == 'Cobranza'"
60 >
53 </div> 61 </div>
54 <button 62 <button
55 type="button" 63 type="button"
56 class="btn col-12 my-1 boton-salir" 64 class="btn col-12 my-1 boton-salir"
57 ng-click="salir()" 65 ng-click="salir()"
58 > 66 >
59 Salir 67 Salir
60 </button> 68 </button>
61 </div> 69 </div>
62 </div> 70 </div>
63 </div> 71 </div>