Commit 7157d3b635cc6bdceb4ce61f85da7c3f1feacf0a

Authored by Eric Fernandez
1 parent 4847f917d4
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 57 observacion += 'Cobrador: ' + marcador.recibo.CFE + '<br/>';
58 observacion += 'Fecha: ' +
59 $filter('date')(marcador.fecha.slice(0,10), 'dd/MM/yyyy') + ' ' +
60 marcador.fecha.slice(11,19) + '<br/>';
61 observacion += 'Nº: ' + $filter('comprobante')([
62 marcador.sucursal, marcador.idUsuario]) + '<br/>';
63 observacion += 'Cliente: ' + marcador.recibo.cliente.NOM + '<br/>';
64 observacion += 'Total Cobrado: $' + marcador.factura.IPA;
58 } 65 }
59 66
60 if ($scope.parametros.actividad === 'Entrega de producto') { 67 if ($scope.parametros.actividad === 'Entrega de producto') {
61 observacion += 'Vehiculo: ' + 68 observacion += 'Vehiculo: ' +
62 marcador.remito.hojaRuta.idVehiculo + ' - ' + 69 marcador.remito.hojaRuta.idVehiculo + ' - ' +
63 marcador.remito.hojaRuta.vehiculo.tractor + '<br/>'; 70 marcador.remito.hojaRuta.vehiculo.tractor + '<br/>';
64 observacion += 'Transportista: ' + 71 observacion += 'Transportista: ' +
65 marcador.remito.hojaRuta.transportista.NOM + '<br/>'; 72 marcador.remito.hojaRuta.transportista.NOM + '<br/>';
66 observacion += 'Chofer: ' + 73 observacion += 'Chofer: ' +
67 marcador.remito.hojaRuta.chofer.nombre + '<br/>'; 74 marcador.remito.hojaRuta.chofer.nombre + '<br/>';
68 observacion += 'Fecha: ' + 75 observacion += 'Fecha: ' +
69 $filter('date')(marcador.fecha.slice(0,10), 'dd/MM/yyyy') + ' ' + 76 $filter('date')(marcador.fecha.slice(0,10), 'dd/MM/yyyy') + ' ' +
70 marcador.fecha.slice(11,19) + '<br/>'; 77 marcador.fecha.slice(11,19) + '<br/>';
71 observacion += 'Hoja de ruta: ' + $filter('comprobante')([ 78 observacion += 'Hoja de ruta: ' + $filter('comprobante')([
72 marcador.remito.hojaRuta.sucursal, 79 marcador.remito.hojaRuta.sucursal,
73 marcador.remito.hojaRuta.numeroHojaRuta 80 marcador.remito.hojaRuta.numeroHojaRuta
74 ]) + '<br/>'; 81 ]) + '<br/>';
75 observacion += 'Remito: ' + $filter('comprobante')([ 82 observacion += 'Remito: ' + $filter('comprobante')([
76 marcador.remito.sucursal, 83 marcador.remito.sucursal,
77 marcador.remito.numeroRemito 84 marcador.remito.numeroRemito
78 ]) + '<br/>'; 85 ]) + '<br/>';
79 observacion += 'Cliente: ' + 86 observacion += 'Cliente: ' +
80 marcador.remito.cliente.NOM + '<br/>'; 87 marcador.remito.cliente.NOM + '<br/>';
81 88
82 if ($scope.parametros.individual) { 89 if ($scope.parametros.individual) {
83 observacion += 'Producto: ' + 90 observacion += 'Producto: ' +
84 marcador.remito.articulosRemito[0].descripcion + '<br/>'; 91 marcador.remito.articulosRemito[0].descripcion + '<br/>';
85 observacion += 'Cantidad entregada: ' + 92 observacion += 'Cantidad entregada: ' +
86 marcador.remito.carga + '<br/>'; 93 marcador.remito.carga + '<br/>';
87 94
88 if (marcador.distancia) { 95 if (marcador.distancia) {
89 observacion += 'Distancia a casa central: ' + marcador.distancia + 96 observacion += 'Distancia a casa central: ' + marcador.distancia +
90 'km <br/>'; 97 'km <br/>';
91 } 98 }
92 99
93 if (marcador.observaciones) { 100 if (marcador.observaciones) {
94 observacion += 'Observaciones: ' + marcador.observaciones; 101 observacion += 'Observaciones: ' + marcador.observaciones;
95 } 102 }
96 observacion = 'Orden: ' + marcador.orden + '<br/>' + observacion; 103 observacion = 'Orden: ' + marcador.orden + '<br/>' + observacion;
97 } else { 104 } else {
98 observacion += 'Cantidad de entregas: ' + marcador.cantidad; 105 observacion += 'Cantidad de entregas: ' + marcador.cantidad;
99 } 106 }
100 } 107 }
101 108
102 $scope.markers.push( 109 $scope.markers.push(
103 L.marker([marcador.latitud, marcador.longitud]).addTo($scope.map) 110 L.marker([marcador.latitud, marcador.longitud]).addTo($scope.map)
104 .bindPopup(observacion) 111 .bindPopup(observacion)
105 ); 112 );
106 113
107 $scope.markers[0].openPopup(); 114 $scope.markers[0].openPopup();
108 }); 115 });
109 }); 116 });
110 }], 117 }],
111 scope: { 118 scope: {
112 latitud: '=', 119 latitud: '=',
113 longitud: '=', 120 longitud: '=',
114 zoom: '=', 121 zoom: '=',
115 marcadores: '=', 122 marcadores: '=',
116 parametros: '=' 123 parametros: '='
117 } 124 }
118 }; 125 };
119 }); 126 });
120 127
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'"
32 >Individual</button> 33 >Individual</button>
33 <div class="form-group" ng-show="idUsuario == -1"> 34 <div class="form-group" ng-show="idUsuario == -1">
34 <input 35 <input
35 type="text" 36 type="text"
36 placeholder="Vendedor" 37 placeholder="Vendedor"
37 class="form-control" 38 class="form-control"
38 ng-model="idUsuarioInput" 39 ng-model="idUsuarioInput"
39 ng-keypress="search($event.keyCode)" 40 ng-keypress="search($event.keyCode)"
40 foca-focus="idUsuario == -1" 41 foca-focus="idUsuario == -1"
41 ng-show="actividad == 'Nota de pedido'" 42 ng-show="actividad == 'Nota de pedido'"
42 > 43 >
43 <input 44 <input
44 type="text" 45 type="text"
45 placeholder="Vehiculo" 46 placeholder="Vehiculo"
46 class="form-control" 47 class="form-control"
47 ng-model="idUsuarioInput" 48 ng-model="idUsuarioInput"
48 ng-keypress="search($event.keyCode)" 49 ng-keypress="search($event.keyCode)"
49 foca-focus="idUsuario == -1" 50 foca-focus="idUsuario == -1"
50 ng-show="actividad == 'Entrega de producto'" 51 ng-show="actividad == 'Entrega de producto'"
51 > 52 >
52 </div> 53 </div>
53 <button 54 <button
54 type="button" 55 type="button"
55 class="btn col-12 my-1 boton-salir" 56 class="btn col-12 my-1 boton-salir"
56 ng-click="salir()" 57 ng-click="salir()"
57 > 58 >
58 Salir 59 Salir
59 </button> 60 </button>
60 </div> 61 </div>
61 </div> 62 </div>
62 </div> 63 </div>
63 64