Commit bd6424ad36d0a2ca7daab02d473f5b4236ee29c1

Authored by Eric Fernandez
Exists in master

Merge branch 'master' into 'master'

guardado hoja ruta

See merge request modulos-npm/foca-crear-hoja-ruta!7
src/js/controller.js
1 angular.module('focaCrearHojaRuta') .controller('hojaRutaCtrl', 1 angular.module('focaCrearHojaRuta') .controller('hojaRutaCtrl',
2 [ 2 [
3 '$scope', '$uibModal', '$location', '$filter', 'crearHojaRutaService', 3 '$scope', '$uibModal', '$location', '$filter', 'crearHojaRutaService', 'focaModalService',
4 'focaModalService', 'focaSeguimientoService', 'hojaRutaBusinessService', 4 function($scope, $uibModal, $location, $filter, crearHojaRutaService, focaModalService) {
5 function(
6 $scope, $uibModal, $location, $filter, crearHojaRutaService, focaModalService,
7 focaSeguimientoService, hojaRutaBusinessService
8 ) {
9 $scope.botonera = [ 5 $scope.botonera = [
10 {texto: 'Transportista', accion: function() {$scope.seleccionarProveedor();}}, 6 {texto: 'Transportista', accion: function() {$scope.seleccionarProveedor();}},
11 {texto: 'Chofer', accion: function() {$scope.seleccionarChofer();}}, 7 {texto: 'Chofer', accion: function() {$scope.seleccionarChofer();}},
12 {texto: 'Vehiculo', accion: function() {$scope.seleccionarVehiculo();}}, 8 {texto: 'Vehiculo', accion: function() {$scope.seleccionarVehiculo();}},
13 {texto: 'Tarifario', accion: function() {$scope.seleccionarTarifario();}}, 9 {texto: 'Tarifario', accion: function() {$scope.seleccionarTarifario();}},
14 {texto: 'Remitos', accion: function() {$scope.seleccionarRemito();}}, 10 {texto: 'Remitos', accion: function() {$scope.seleccionarRemito();}},
15 {texto: '', accion: function() {}}, 11 {texto: '', accion: function() {}},
16 {texto: '', accion: function() {}}, 12 {texto: '', accion: function() {}},
17 {texto: '', accion: function() {}} 13 {texto: '', accion: function() {}}
18 ]; 14 ];
19 $scope.datepickerAbierto = false; 15 $scope.datepickerAbierto = false;
20 16
21 $scope.show = false; 17 $scope.show = false;
22 $scope.cargando = true; 18 $scope.cargando = true;
23 $scope.dateOptions = { 19 $scope.dateOptions = {
24 maxDate: new Date(), 20 maxDate: new Date(),
25 minDate: new Date(2010, 0, 1) 21 minDate: new Date(2010, 0, 1)
26 }; 22 };
27 23
28 $scope.hojaRuta = { 24 $scope.hojaRuta = {
29 fecha: new Date(), 25 fecha: new Date(),
30 litros: 0, 26 litros: 0,
31 chofer: {}, 27 chofer: {},
32 vehiculo: { 28 vehiculo: {
33 capacidad: 0 29 capacidad: 0
34 }, 30 },
35 transportista: {}, 31 transportista: {},
36 tarifario: { 32 tarifario: {
37 costo: null 33 costo: null
38 } 34 }
39 }; 35 };
40 36
41 $scope.cabecera = []; 37 $scope.cabecera = [];
42 $scope.showCabecera = true; 38 $scope.showCabecera = true;
43 39
44 $scope.now = new Date(); 40 $scope.now = new Date();
45 $scope.puntoVenta = '0000'; 41 $scope.puntoVenta = '0000';
46 $scope.comprobante = '00000000'; 42 $scope.comprobante = '00000000';
47 $scope.remitosTabla = []; 43 $scope.remitosTabla = [];
48 $scope.idLista = undefined; 44 $scope.idLista = undefined;
49 //La pantalla solo se usa para cargar pedidos 45 //La pantalla solo se usa para cargar pedidos
50 //var hojaRutaTemp = crearHojaRutaService.getHojaRuta(); 46 //var hojaRutaTemp = crearHojaRutaService.getHojaRuta();
51 47
52 crearHojaRutaService.getNumeroHojaRuta().then( 48 crearHojaRutaService.getNumeroHojaRuta().then(
53 function(res) { 49 function(res) {
54 $scope.puntoVenta = $scope.rellenar(res.data.sucursal, 4); 50 $scope.puntoVenta = $scope.rellenar(res.data.sucursal, 4);
55 $scope.comprobante = $scope.rellenar(res.data.numeroHojaRuta, 8); 51 $scope.comprobante = $scope.rellenar(res.data.numeroHojaRuta, 8);
56 }, 52 },
57 function(err) { 53 function(err) {
58 focaModalService.alert('La terminal no esta configurada correctamente'); 54 focaModalService.alert('La terminal no esta configurada correctamente');
59 console.info(err); 55 console.info(err);
60 } 56 }
61 ); 57 );
62 //La pantalla solo se usa para cargar pedidos 58 //La pantalla solo se usa para cargar pedidos
63 // if (hojaRutaTemp !== undefined) { 59 // if (hojaRutaTemp !== undefined) {
64 // hojaRutaTemp.fechaCarga = new Date(hojaRutaTemp.fechaCarga); 60 // hojaRutaTemp.fechaCarga = new Date(hojaRutaTemp.fechaCarga);
65 // $scope.hojaRuta = hojaRutaTemp; 61 // $scope.hojaRuta = hojaRutaTemp;
66 // $scope.hojaRuta.flete = ($scope.hojaRuta.flete).toString(); 62 // $scope.hojaRuta.flete = ($scope.hojaRuta.flete).toString();
67 // $scope.hojaRuta.bomba = ($scope.hojaRuta.bomba).toString(); 63 // $scope.hojaRuta.bomba = ($scope.hojaRuta.bomba).toString();
68 // $scope.idLista = $scope.hojaRuta.precioCondicion; 64 // $scope.idLista = $scope.hojaRuta.precioCondicion;
69 // crearHojaRutaService 65 // crearHojaRutaService
70 // .getArticulosByIdHojaRuta($scope.hojaRuta.id).then( 66 // .getArticulosByIdHojaRuta($scope.hojaRuta.id).then(
71 // function(res) { 67 // function(res) {
72 // $scope.remitosTabla = res.data; 68 // $scope.remitosTabla = res.data;
73 // } 69 // }
74 // ); 70 // );
75 //TODO DOMICILIOS QUE SE CARGAN AL EDITAR NOTA DE PEDIDO 71 //TODO DOMICILIOS QUE SE CARGAN AL EDITAR NOTA DE PEDIDO
76 //(NO REQUERIDO EN ESTA VERSION) 72 //(NO REQUERIDO EN ESTA VERSION)
77 // crearHojaRutaService.getDomiciliosByIdHojaRuta($scope.hojaRuta.id).then( 73 // crearHojaRutaService.getDomiciliosByIdHojaRuta($scope.hojaRuta.id).then(
78 // function(res) { 74 // function(res) {
79 // $scope.hojaRuta.domicilio = res.data; 75 // $scope.hojaRuta.domicilio = res.data;
80 // } 76 // }
81 // ); 77 // );
82 // } else { 78 // } else {
83 // $scope.hojaRuta.fechaCarga = new Date(); 79 // $scope.hojaRuta.fechaCarga = new Date();
84 // $scope.hojaRuta.bomba = '0'; 80 // $scope.hojaRuta.bomba = '0';
85 // $scope.hojaRuta.flete = '0'; 81 // $scope.hojaRuta.flete = '0';
86 // $scope.idLista = undefined; 82 // $scope.idLista = undefined;
87 // } 83 // }
88 //TO DO - FUNCIONES PARA MULTIPLES DOMICILIOS NO IMPLEMENTADAS EN ESTA DEMO 84 //TO DO - FUNCIONES PARA MULTIPLES DOMICILIOS NO IMPLEMENTADAS EN ESTA DEMO
89 // $scope.addNewDom = function() { 85 // $scope.addNewDom = function() {
90 // $scope.hojaRuta.domicilio.push({ 'id': 0 }); 86 // $scope.hojaRuta.domicilio.push({ 'id': 0 });
91 // }; 87 // };
92 // $scope.removeNewChoice = function(choice) { 88 // $scope.removeNewChoice = function(choice) {
93 // if ($scope.hojaRuta.domicilio.length > 1) { 89 // if ($scope.hojaRuta.domicilio.length > 1) {
94 // $scope.hojaRuta.domicilio.splice($scope.hojaRuta.domicilio.findIndex( 90 // $scope.hojaRuta.domicilio.splice($scope.hojaRuta.domicilio.findIndex(
95 // function(c) { 91 // function(c) {
96 // return c.$$hashKey === choice.$$hashKey; 92 // return c.$$hashKey === choice.$$hashKey;
97 // } 93 // }
98 // ), 1); 94 // ), 1);
99 // } 95 // }
100 // }; 96 // };
101 97
102 $scope.crearHojaRuta = function() { 98 $scope.crearHojaRuta = function() {
103 if(!$scope.hojaRuta.vendedor.codigo) { 99 if($scope.hojaRuta.litros <= 0) {
104 focaModalService.alert('Ingrese Vendedor'); 100 focaModalService.alert('Ingrese Remitos');
105 return; 101 return;
106 } else if(!$scope.hojaRuta.cliente.cod) { 102 }
107 focaModalService.alert('Ingrese Cliente'); 103
108 return; 104 if(!$scope.hojaRuta.chofer.id) {
109 } else if(!$scope.hojaRuta.transportista.codigo) { 105 focaModalService.alert('Ingrese Chofer');
110 focaModalService.alert('Ingrese Transportista');
111 return;
112 } else if(!$scope.hojaRuta.moneda.id) {
113 focaModalService.alert('Ingrese Moneda');
114 return;
115 } else if(!$scope.hojaRuta.cotizacion.ID) {
116 focaModalService.alert('Ingrese Cotización');
117 return; 106 return;
118 } else if(!$scope.plazosPagos) { 107 }
119 focaModalService.alert('Ingrese Precios y Condiciones'); 108
109 if(!$scope.hojaRuta.vehiculo.id) {
110 focaModalService.alert('Ingrese Vehiculo');
120 return; 111 return;
121 } else if( 112 }
122 $scope.hojaRuta.flete === undefined || $scope.hojaRuta.flete === null) 113
123 { 114 if(!$scope.hojaRuta.transportista.codigo) {
124 focaModalService.alert('Ingrese Flete'); 115 focaModalService.alert('Ingrese Transportista');
125 return; 116 return;
126 } else if(!$scope.hojaRuta.domicilio.id) { 117 }
127 focaModalService.alert('Ingrese Domicilio'); 118
119 if($scope.hojaRuta.vehiculo.capacidad < $scope.hojaRuta.litros) {
120 focaModalService.alert(
121 'La capacidad del Vehiculo es menor a lo ingresado en Remitos'
122 );
128 return; 123 return;
129 } else if($scope.remitosTabla.length === 0) { 124 }
130 focaModalService.alert('Debe cargar al menos un articulo'); 125
126 if(!$scope.hojaRuta.tarifario.costo) {
127 focaModalService.alert('Ingrese Tarifario');
131 return; 128 return;
132 } 129 }
130
133 var date = new Date(); 131 var date = new Date();
134 var hojaRuta = { 132 var save = {
135 id: 0, 133 hojaRuta: {
136 fechaCarga: new Date(date.getTime() - (date.getTimezoneOffset() * 60000)) 134 id: 0,
137 .toISOString().slice(0, 19).replace('T', ' '), 135 fechaCreacion:
138 idVendedor: $scope.hojaRuta.vendedor.codigo, 136 new Date(date.getTime() - (date.getTimezoneOffset() * 60000))
139 idCliente: $scope.hojaRuta.cliente.cod, 137 .toISOString().slice(0, 19) .replace('T', ' '),
140 nombreCliente: $scope.hojaRuta.cliente.nom, 138 idTransportista: $scope.hojaRuta.transportista.codigo,
141 cuitCliente: $scope.hojaRuta.cliente.cuit, 139 idChofer: $scope.hojaRuta.chofer.id,
142 idDomicilio: $scope.hojaRuta.domicilio.id, 140 idVehiculo: $scope.hojaRuta.vehiculo.id,
143 idProveedor: $scope.hojaRuta.transportista.codigo, 141 tarifaFlete: $scope.hojaRuta.tarifario.costo
144 idCotizacion: $scope.hojaRuta.cotizacion.ID, 142 },
145 cotizacion: $scope.hojaRuta.cotizacion.COTIZACION, 143 remitos: $scope.remitosTabla
146 flete: $scope.hojaRuta.flete,
147 fob: $scope.hojaRuta.fob,
148 bomba: $scope.hojaRuta.bomba,
149 kilometros: $scope.hojaRuta.kilometros,
150 estado: 0,
151 total: $scope.getTotal()
152 }; 144 };
153 crearHojaRutaService.crearHojaRuta(hojaRuta).then(
154 function(data) {
155 hojaRutaBusinessService.addArticulos($scope.remitosTabla,
156 data.data.id, $scope.hojaRuta.cotizacion.COTIZACION);
157 focaSeguimientoService.guardarPosicion('crear nota pedido', '');
158 var plazos = $scope.plazosPagos;
159
160 for(var j = 0; j < plazos.length; j++) {
161 var json = {
162 idPedido: data.data.id,
163 dias: plazos[j].dias
164 };
165 crearHojaRutaService.crearPlazosParaHojaRuta(json);
166 }
167 hojaRutaBusinessService.addEstado(data.data.id,
168 $scope.hojaRuta.vendedor.codigo);
169 145
170 focaModalService.alert('Nota pedido creada'); 146 crearHojaRutaService.crearHojaRuta(save).then(
171 $scope.cabecera = []; 147 function(data) {
172 addCabecera('Moneda:', $scope.hojaRuta.moneda.detalle); 148 focaModalService.alert(
173 addCabecera( 149 'Hoja ruta creada Nº: ' +
174 'Fecha cotizacion:', 150 $scope.rellenar(data.sucursal, 4) +
175 $filter('date')($scope.hojaRuta.cotizacion.FECHA, 'dd/MM/yyyy') 151 '-' +
152 $scope.rellenar(data.numeroHojaRuta, 8)
176 ); 153 );
177 addCabecera('Cotizacion:', $scope.hojaRuta.cotizacion.COTIZACION); 154 $scope.hojaRuta = {
178 $scope.hojaRuta.vendedor = {}; 155 fecha: new Date(),
179 $scope.hojaRuta.cliente = {}; 156 litros: 0,
180 $scope.hojaRuta.domicilio = {}; 157 chofer: {},
181 $scope.hojaRuta.transportista = {}; 158 vehiculo: {
182 $scope.hojaRuta.flete = null; 159 capacidad: 0
183 $scope.hojaRuta.fob = null; 160 },
184 $scope.hojaRuta.bomba = null; 161 transportista: {},
185 $scope.hojaRuta.kilometros = null; 162 tarifario: {
163 costo: null
164 }
165 };
166
186 $scope.remitosTabla = []; 167 $scope.remitosTabla = [];
168 $scope.cabecera = [];
169
170 crearHojaRutaService.getNumeroHojaRuta().then(function(res) {
171 $scope.comprobante = $scope.rellenar(res.data.numeroHojaRuta, 8);
172 });
187 }, 173 },
188 function(error) { 174 function(error) {
189 focaModalService.alert('Hubo un error al crear la nota de pedido'); 175 focaModalService.alert('Hubo un error al crear la nota de pedido');
190 console.info(error); 176 console.info(error);
191 } 177 }
192 ); 178 );
193 }; 179 };
194 180
195 $scope.seleccionarProveedor = function() { 181 $scope.seleccionarProveedor = function() {
196 var modalInstance = $uibModal.open( 182 var modalInstance = $uibModal.open(
197 { 183 {
198 ariaLabelledBy: 'Busqueda de Transportista', 184 ariaLabelledBy: 'Busqueda de Transportista',
199 templateUrl: 'modal-proveedor.html', 185 templateUrl: 'modal-proveedor.html',
200 controller: 'focaModalProveedorCtrl', 186 controller: 'focaModalProveedorCtrl',
201 size: 'lg', 187 size: 'lg',
202 resolve: { 188 resolve: {
203 transportista: function() { 189 transportista: function() {
204 return true; 190 return true;
205 } 191 }
206 } 192 }
207 } 193 }
208 ); 194 );
209 modalInstance.result.then( 195 modalInstance.result.then(
210 function(proveedor) { 196 function(proveedor) {
211 console.info($scope.hojaRuta); 197 console.info($scope.hojaRuta);
212 $scope.hojaRuta.transportista.codigo = proveedor.COD; 198 $scope.hojaRuta.transportista.codigo = proveedor.COD;
213 addCabecera('Transportista:', proveedor.NOM); 199 addCabecera('Transportista:', proveedor.NOM);
214 }, function() { 200 }, function() {
215 201
216 } 202 }
217 ); 203 );
218 }; 204 };
219 205
220 $scope.seleccionarChofer = function() { 206 $scope.seleccionarChofer = function() {
221 var modalInstance = $uibModal.open( 207 var modalInstance = $uibModal.open(
222 { 208 {
223 ariaLabelledBy: 'Busqueda de Chofer', 209 ariaLabelledBy: 'Busqueda de Chofer',
224 templateUrl: 'modal-chofer.html', 210 templateUrl: 'modal-chofer.html',
225 controller: 'focaModalChoferController', 211 controller: 'focaModalChoferController',
226 size: 'lg' 212 size: 'lg'
227 } 213 }
228 ); 214 );
229 215
230 modalInstance.result.then( 216 modalInstance.result.then(
231 function(chofer) { 217 function(chofer) {
232 $scope.hojaRuta.chofer = chofer; 218 $scope.hojaRuta.chofer = chofer;
233 addCabecera('Chofer: ' + chofer.nombre); 219 addCabecera('Chofer: ' + chofer.nombre);
234 }, function() { 220 }, function() {
235 // funcion ejecutada cuando se cancela el modal 221 // funcion ejecutada cuando se cancela el modal
236 } 222 }
237 ); 223 );
238 }; 224 };
239 225
240 $scope.seleccionarVehiculo = function() { 226 $scope.seleccionarVehiculo = function() {
241 var modalInstance = $uibModal.open( 227 var modalInstance = $uibModal.open(
242 { 228 {
243 ariaLabelledBy: 'Busqueda de Vehiculo', 229 ariaLabelledBy: 'Busqueda de Vehiculo',
244 templateUrl: 'modal-vehiculo.html', 230 templateUrl: 'modal-vehiculo.html',
245 controller: 'focaModalVehiculoController', 231 controller: 'focaModalVehiculoController',
246 size: 'lg' 232 size: 'lg'
247 } 233 }
248 ); 234 );
249 235
250 modalInstance.result.then( 236 modalInstance.result.then(
251 function(vehiculo) { 237 function(vehiculo) {
252 $scope.hojaRuta.vehiculo = vehiculo; 238 $scope.hojaRuta.vehiculo = vehiculo;
253 addCabecera('Tractor: ' + vehiculo.tractor); 239 addCabecera('Tractor: ' + vehiculo.tractor);
254 addCabecera('Semi: ' + vehiculo.semi); 240 addCabecera('Semi: ' + vehiculo.semi);
255 addCabecera('Capacidad: ' + vehiculo.capacidad); 241 addCabecera('Capacidad: ' + vehiculo.capacidad);
256 }, function() { 242 }, function() {
257 // funcion ejecutada cuando se cancela el modal 243 // funcion ejecutada cuando se cancela el modal
258 } 244 }
259 ); 245 );
260 }; 246 };
261 247
262 $scope.seleccionarTarifario = function() { 248 $scope.seleccionarTarifario = function() {
263 var modalInstance = $uibModal.open( 249 var modalInstance = $uibModal.open(
264 { 250 {
265 ariaLabelledBy: 'Busqueda de Tarifario', 251 ariaLabelledBy: 'Busqueda de Tarifario',
266 templateUrl: 'modal-tarifa-flete.html', 252 templateUrl: 'modal-tarifa-flete.html',
267 controller: 'focaModalTarifaFleteController', 253 controller: 'focaModalTarifaFleteController',
268 size: 'lg', 254 size: 'lg',
269 resolve: { 255 resolve: {
270 parametrosTarifaFlete: function() { 256 parametrosTarifaFlete: function() {
271 return $scope.hojaRuta.tarifario.costo; 257 return $scope.hojaRuta.tarifario.costo;
272 } 258 }
273 } 259 }
274 } 260 }
275 ); 261 );
276 262
277 modalInstance.result.then( 263 modalInstance.result.then(
278 function(tarifario) { 264 function(tarifario) {
279 $scope.hojaRuta.tarifario = tarifario; 265 $scope.hojaRuta.tarifario = tarifario;
280 addCabecera('Tarifario: ' + tarifario.costo); 266 addCabecera('Tarifario: ' + tarifario.costo);
281 }, function() { 267 }, function() {
282 // funcion ejecutada cuando se cancela el modal 268 // funcion ejecutada cuando se cancela el modal
283 } 269 }
284 ); 270 );
285 } 271 };
286 272
287 $scope.seleccionarRemito = function() { 273 $scope.seleccionarRemito = function() {
288 var modalInstance = $uibModal.open( 274 var modalInstance = $uibModal.open(
289 { 275 {
290 ariaLabelledBy: 'Busqueda de Remito', 276 ariaLabelledBy: 'Busqueda de Remito',
291 templateUrl: 'foca-modal-remito.html', 277 templateUrl: 'foca-modal-remito.html',
292 controller: 'focaModalRemitoController', 278 controller: 'focaModalRemitoController',
293 size: 'lg' 279 size: 'lg'
294 } 280 }
295 ); 281 );
296 modalInstance.result.then( 282 modalInstance.result.then(
297 function(remito) { 283 function(remito) {
298 for (var i = $scope.remitosTabla.length - 1; i >= 0; i--) { 284 for (var i = $scope.remitosTabla.length - 1; i >= 0; i--) {
299 if ($scope.remitosTabla[i].id == remito.id) { 285 if ($scope.remitosTabla[i].id === remito.id) {
300 focaModalService.alert('Remito ya incluido'); 286 focaModalService.alert('Remito ya incluido');
301 return; 287 return;
302 } 288 }
303 } 289 }
304 290
305 var litros = 0; 291 var litros = 0;
306 for (var i = remito.articulosRemito.length - 1; i >= 0; i--) { 292 for (var j = remito.articulosRemito.length - 1; j >= 0; j--) {
307 litros = litros + parseFloat(remito.articulosRemito[i].cantidad); 293 litros = litros + parseFloat(remito.articulosRemito[j].cantidad);
308 } 294 }
309 295
310 if ($scope.hojaRuta.litros >= $scope.hojaRuta.vehiculo.capacidad) { 296 if ($scope.hojaRuta.litros >= $scope.hojaRuta.vehiculo.capacidad) {
311 focaModalService.alert( 297 focaModalService.alert(
312 'No se puede agregar mas recibos porque la ' + 298 'No se puede agregar mas recibos porque la ' +
313 'capacidad del vehiculo esta llena o no esta definida' 299 'capacidad del vehiculo esta llena o no esta definida'
314 ); 300 );
315 return; 301 return;
316 } 302 }
317 303
318 if ($scope.hojaRuta.litros + litros >= $scope.hojaRuta.vehiculo.capacidad) 304 if ($scope.hojaRuta.litros + litros >= $scope.hojaRuta.vehiculo.capacidad)
319 { 305 {
320 var litrostotales = litros; 306 var litrostotales = litros;
321 litros = $scope.hojaRuta.vehiculo.capacidad - $scope.hojaRuta.litros; 307 litros = $scope.hojaRuta.vehiculo.capacidad - $scope.hojaRuta.litros;
322 focaModalService.alert( 308 focaModalService.alert(
323 'La carga excede la capacidad disponible del vehiculo. ' + 309 'La carga excede la capacidad disponible del vehiculo. ' +
324 'Excedente no cargado: ' + (litrostotales - litros) + ' litros' 310 'Excedente no cargado: ' + (litrostotales - litros) + ' litros'
325 ); 311 );
326 } 312 }
327 313
328 remito.litros = litros; 314 remito.litros = litros;
329 $scope.hojaRuta.litros = $scope.hojaRuta.litros + litros; 315 $scope.hojaRuta.litros = $scope.hojaRuta.litros + litros;
330 $scope.remitosTabla.push(remito); 316 $scope.remitosTabla.push(remito);
331 }, function() { 317 }, function() {
332 // funcion ejecutada cuando se cancela el modal 318 // funcion ejecutada cuando se cancela el modal
333 } 319 }
334 ); 320 );
335 }; 321 };
336 322
337 $scope.getTotal = function() { 323 $scope.getTotal = function() {
338 var total = 0; 324 var total = 0;
339 var arrayTempArticulos = $scope.remitosTabla; 325 var arrayTempArticulos = $scope.remitosTabla;
340 for (var i = 0; i < arrayTempArticulos.length; i++) { 326 for (var i = 0; i < arrayTempArticulos.length; i++) {
341 total += arrayTempArticulos[i].precio * arrayTempArticulos[i].cantidad; 327 total += arrayTempArticulos[i].precio * arrayTempArticulos[i].cantidad;
342 } 328 }
343 return parseFloat(total.toFixed(2)); 329 return parseFloat(total.toFixed(2));
344 }; 330 };
345 331
346 $scope.getSubTotal = function() { 332 $scope.getSubTotal = function() {
347 if($scope.articuloACargar) { 333 if($scope.articuloACargar) {
348 return $scope.articuloACargar.precio * $scope.articuloACargar.cantidad; 334 return $scope.articuloACargar.precio * $scope.articuloACargar.cantidad;
349 } 335 }
350 }; 336 };
351 337
352 $scope.limpiarPantalla = function() { 338 $scope.limpiarPantalla = function() {
353 $scope.limpiarFlete(); 339 $scope.limpiarFlete();
354 $scope.hojaRuta.flete = '0'; 340 $scope.hojaRuta.flete = '0';
355 $scope.hojaRuta.bomba = '0'; 341 $scope.hojaRuta.bomba = '0';
356 $scope.hojaRuta.precioCondicion = ''; 342 $scope.hojaRuta.precioCondicion = '';
357 $scope.remitosTabla = []; 343 $scope.remitosTabla = [];
358 $scope.hojaRuta.vendedor.nombre = ''; 344 $scope.hojaRuta.vendedor.nombre = '';
359 $scope.hojaRuta.cliente = {nombre: ''}; 345 $scope.hojaRuta.cliente = {nombre: ''};
360 $scope.hojaRuta.domicilio = {dom: ''}; 346 $scope.hojaRuta.domicilio = {dom: ''};
361 $scope.hojaRuta.litros = 0; 347 $scope.hojaRuta.litros = 0;
362 $scope.domiciliosCliente = []; 348 $scope.domiciliosCliente = [];
363 }; 349 };
364 //Recibe aviso si el teclado está en uso 350 //Recibe aviso si el teclado está en uso
365 // $rootScope.$on('usarTeclado', function(event, data) { 351 // $rootScope.$on('usarTeclado', function(event, data) {
366 // if(data) { 352 // if(data) {
367 // $scope.mostrarTeclado = true; 353 // $scope.mostrarTeclado = true;
368 // return; 354 // return;
369 // } 355 // }
370 // $scope.mostrarTeclado = false; 356 // $scope.mostrarTeclado = false;
371 // }) 357 // })
372 $scope.selectFocus = function($event) { 358 $scope.selectFocus = function($event) {
373 //Si el teclado esta en uso no selecciona el valor 359 //Si el teclado esta en uso no selecciona el valor
374 // if($scope.mostrarTeclado) { 360 // if($scope.mostrarTeclado) {
375 // return; 361 // return;
376 // } 362 // }
377 $event.target.select(); 363 $event.target.select();
378 }; 364 };
379 365
380 $scope.salir = function() { 366 $scope.salir = function() {
381 $location.path('/'); 367 $location.path('/');
382 }; 368 };
383 369
384 $scope.parsearATexto = function(articulo) { 370 $scope.parsearATexto = function(articulo) {
385 articulo.cantidad = parseFloat(articulo.cantidad); 371 articulo.cantidad = parseFloat(articulo.cantidad);
386 articulo.precio = parseFloat(articulo.precio); 372 articulo.precio = parseFloat(articulo.precio);
387 }; 373 };
388 374
389 $scope.rellenar = function(relleno, longitud) { 375 $scope.rellenar = function(relleno, longitud) {
390 relleno = '' + relleno; 376 relleno = '' + relleno;
391 while (relleno.length < longitud) { 377 while (relleno.length < longitud) {
392 relleno = '0' + relleno; 378 relleno = '0' + relleno;
393 } 379 }
394 380
395 return relleno; 381 return relleno;
396 } 382 };
397 383
398 $scope.quitarArticulo = function(key) { 384 $scope.quitarArticulo = function(key) {
399 $scope.remitosTabla.splice(key, 1); 385 $scope.remitosTabla.splice(key, 1);
400 var litros = 0; 386 var litros = 0;
401 387
402 for (var i = $scope.remitosTabla.length - 1; i >= 0; i--) { 388 for (var i = $scope.remitosTabla.length - 1; i >= 0; i--) {
403 litros += parseFloat($scope.remitosTabla[i].litros); 389 litros += parseFloat($scope.remitosTabla[i].litros);
404 } 390 }
405 391
406 $scope.hojaRuta.litros = litros; 392 $scope.hojaRuta.litros = litros;
407 393
408 }; 394 };
409 395
410 function addCabecera(label, valor) { 396 function addCabecera(label, valor) {
411 var propiedad = $filter('filter')($scope.cabecera, {label: label}, true); 397 var propiedad = $filter('filter')($scope.cabecera, {label: label}, true);
412 if(propiedad.length === 1) { 398 if(propiedad.length === 1) {
413 propiedad[0].valor = valor; 399 propiedad[0].valor = valor;
414 } else { 400 } else {
415 $scope.cabecera.push({label: label, valor: valor}); 401 $scope.cabecera.push({label: label, valor: valor});
416 } 402 }
417 } 403 }
418 404
419 function removeCabecera(label) { 405 /*function removeCabecera(label) {
420 var propiedad = $filter('filter')($scope.cabecera, {label: label}, true); 406 var propiedad = $filter('filter')($scope.cabecera, {label: label}, true);
421 if(propiedad.length === 1){ 407 if(propiedad.length === 1){
422 $scope.cabecera.splice($scope.cabecera.indexOf(propiedad[0]), 1); 408 $scope.cabecera.splice($scope.cabecera.indexOf(propiedad[0]), 1);
423 } 409 }
424 } 410 }*/
425
426
427 } 411 }
428 ] 412 ]
429 ) 413 )
430 .controller('hojaRutaListaCtrl', [ 414 .controller('hojaRutaListaCtrl', [
431 '$scope', 415 '$scope',
432 'crearHojaRutaService', 416 'crearHojaRutaService',
433 '$location', 417 '$location',
434 function($scope, crearHojaRutaService, $location) { 418 function($scope, crearHojaRutaService, $location) {
435 crearHojaRutaService.obtenerHojaRuta().then(function(datos) { 419 crearHojaRutaService.obtenerHojaRuta().then(function(datos) {
436 $scope.hojaRutas = datos.data; 420 $scope.hojaRutas = datos.data;
437 }); 421 });
438 $scope.editar = function(hojaRuta) { 422 $scope.editar = function(hojaRuta) {
439 crearHojaRutaService.setHojaRuta(hojaRuta); 423 crearHojaRutaService.setHojaRuta(hojaRuta);
440 $location.path('/venta-nota-pedido/abm/'); 424 $location.path('/venta-nota-pedido/abm/');
441 }; 425 };
442 $scope.crearPedido = function() { 426 $scope.crearPedido = function() {
443 crearHojaRutaService.clearHojaRuta(); 427 crearHojaRutaService.clearHojaRuta();
444 $location.path('/venta-nota-pedido/abm/'); 428 $location.path('/venta-nota-pedido/abm/');
445 }; 429 };
446 } 430 }
447 ]) 431 ])
1 angular.module('focaCrearHojaRuta') 1 angular.module('focaCrearHojaRuta')
2 .service('crearHojaRutaService', ['$http', 'API_ENDPOINT', function($http, API_ENDPOINT) { 2 .service('crearHojaRutaService', ['$http', 'API_ENDPOINT', function($http, API_ENDPOINT) {
3 var route = API_ENDPOINT.URL; 3 var route = API_ENDPOINT.URL;
4 return { 4 return {
5 crearHojaRuta: function(hojaRuta) { 5 crearHojaRuta: function(hojaRuta) {
6 return $http.post(route + '/hoja-ruta', {hojaRuta: hojaRuta}); 6 return $http.post(route + '/hoja-ruta', hojaRuta);
7 }, 7 },
8 obtenerHojaRuta: function() { 8 obtenerHojaRuta: function() {
9 return $http.get(route +'/hoja-ruta'); 9 return $http.get(route +'/hoja-ruta');
10 }, 10 },
11 setHojaRuta: function(hojaRuta) { 11 setHojaRuta: function(hojaRuta) {
12 this.hojaRuta = hojaRuta; 12 this.hojaRuta = hojaRuta;
13 }, 13 },
14 clearHojaRuta: function() { 14 clearHojaRuta: function() {
15 this.hojaRuta = undefined; 15 this.hojaRuta = undefined;
16 }, 16 },
17 getHojaRuta: function() { 17 getHojaRuta: function() {
18 return this.hojaRuta; 18 return this.hojaRuta;
19 }, 19 },
20 getArticulosByIdHojaRuta: function(id) { 20 getArticulosByIdHojaRuta: function(id) {
21 return $http.get(route+'/articulos/hoja-ruta/'+id); 21 return $http.get(route+'/articulos/hoja-ruta/'+id);
22 }, 22 },
23 crearArticulosParaHojaRuta: function(articuloHojaRuta) { 23 crearArticulosParaHojaRuta: function(articuloHojaRuta) {
24 return $http.post(route + '/articulos/hoja-ruta', 24 return $http.post(route + '/articulos/hoja-ruta',
25 {articuloHojaRuta: articuloHojaRuta}); 25 {articuloHojaRuta: articuloHojaRuta});
26 }, 26 },
27 getDomiciliosByIdHojaRuta: function(id) { 27 getDomiciliosByIdHojaRuta: function(id) {
28 return $http.get(route +'/hoja-ruta/' + id + '/domicilios'); 28 return $http.get(route +'/hoja-ruta/' + id + '/domicilios');
29 }, 29 },
30 getDomiciliosByIdCliente: function(id) { 30 getDomiciliosByIdCliente: function(id) {
31 var idTipoEntrega = 2;//Solo traigo los domicilios que tienen tipo 2 (tipo entrega) 31 var idTipoEntrega = 2;//Solo traigo los domicilios que tienen tipo 2 (tipo entrega)
32 return $http.get(route + '/domicilio/tipo/' + idTipoEntrega + '/cliente/' + id ); 32 return $http.get(route + '/domicilio/tipo/' + idTipoEntrega + '/cliente/' + id );
33 }, 33 },
34 getPrecioCondicion: function() { 34 getPrecioCondicion: function() {
35 return $http.get(route + '/precio-condicion'); 35 return $http.get(route + '/precio-condicion');
36 }, 36 },
37 getPrecioCondicionById: function(id) { 37 getPrecioCondicionById: function(id) {
38 return $http.get(route + '/precio-condicion/' + id); 38 return $http.get(route + '/precio-condicion/' + id);
39 }, 39 },
40 getPlazoPagoByPrecioCondicion: function(id) { 40 getPlazoPagoByPrecioCondicion: function(id) {
41 return $http.get(route + '/plazo-pago/precio-condicion/' + id); 41 return $http.get(route + '/plazo-pago/precio-condicion/' + id);
42 }, 42 },
43 crearFlete: function(flete) { 43 crearFlete: function(flete) {
44 return $http.post(route + '/flete', {flete : flete}); 44 return $http.post(route + '/flete', {flete : flete});
45 }, 45 },
46 crearPlazosParaHojaRuta: function(plazos) { 46 crearPlazosParaHojaRuta: function(plazos) {
47 return $http.post(route + '/plazo-pago/hoja-ruta', plazos); 47 return $http.post(route + '/plazo-pago/hoja-ruta', plazos);
48 }, 48 },
49 getCotizacionByIdMoneda: function(id) { 49 getCotizacionByIdMoneda: function(id) {
50 return $http.get(route + '/moneda/' + id); 50 return $http.get(route + '/moneda/' + id);
51 }, 51 },
52 crearEstadoParaHojaRuta: function(estado) { 52 crearEstadoParaHojaRuta: function(estado) {
53 return $http.post(route + '/estado', {estado: estado}); 53 return $http.post(route + '/estado', {estado: estado});
54 }, 54 },
55 getNumeroHojaRuta: function() { 55 getNumeroHojaRuta: function() {
56 return $http.get(route + '/hoja-ruta/numero-siguiente'); 56 return $http.get(route + '/hoja-ruta/numero-siguiente');
57 } 57 }
58 }; 58 };
59 }]); 59 }]);
60 60
src/views/hoja-ruta.html
1 <div class="crear-nota-pedido"> 1 <div class="crear-nota-pedido">
2 <form name="formCrearNota" ng-submit="crearNotaPedido()" class="mb-0"> 2 <form name="formCrearNota" ng-submit="crearNotaPedido()" class="mb-0">
3 <div class="row"> 3 <div class="row">
4 <div class="col-md-10 offset-md-1 col-lg-8 offset-lg-2"> 4 <div class="col-md-10 offset-md-1 col-lg-8 offset-lg-2">
5 <div class="row p-1 panel-informativo"> 5 <div class="row p-1 panel-informativo">
6 <div class="col-12"> 6 <div class="col-12">
7 <div class="row"> 7 <div class="row">
8 <div class="col-12 col-sm-4 nota-pedido"> 8 <div class="col-12 col-sm-4 nota-pedido">
9 <h5>HOJA RUTA</h5> 9 <h5>HOJA RUTA</h5>
10 </div> 10 </div>
11 <div class="col-5 col-sm-4 numero-pedido" 11 <div class="col-5 col-sm-4 numero-pedido"
12 >Nº {{puntoVenta}}-{{comprobante}} 12 >Nº {{puntoVenta}}-{{comprobante}}
13 </div> 13 </div>
14 <div class="col-7 col-sm-4 text-right"> 14 <div class="col-7 col-sm-4 text-right">
15 Fecha: 15 Fecha:
16 <span 16 <span
17 ng-show="!datepickerAbierto" 17 ng-show="!datepickerAbierto"
18 ng-bind="now | date:'dd/MM/yyyy HH:mm'" 18 ng-bind="now | date:'dd/MM/yyyy HH:mm'"
19 ng-click="datepickerAbierto = true" 19 ng-click="datepickerAbierto = true"
20 > 20 >
21 </span> 21 </span>
22 <input 22 <input
23 ng-show="datepickerAbierto" 23 ng-show="datepickerAbierto"
24 type="date" 24 type="date"
25 ng-model="now" 25 ng-model="now"
26 ng-change="datepickerAbierto = false" 26 ng-change="datepickerAbierto = false"
27 ng-blur="datepickerAbierto = false" 27 ng-blur="datepickerAbierto = false"
28 class="form-control form-control-sm col-8 float-right" 28 class="form-control form-control-sm col-8 float-right"
29 foca-focus="datepickerAbierto" 29 foca-focus="datepickerAbierto"
30 hasta-hoy 30 hasta-hoy
31 /> 31 />
32 </div> 32 </div>
33 </div> 33 </div>
34 <div class="row"> 34 <div class="row">
35 <div class="col-auto" ng-repeat="cab in cabecera" ng-show="showCabecera"> 35 <div class="col-auto" ng-repeat="cab in cabecera" ng-show="showCabecera">
36 <span class="label" ng-bind="cab.label"></span> 36 <span class="label" ng-bind="cab.label"></span>
37 <span class="valor" ng-bind="cab.valor"></span> 37 <span class="valor" ng-bind="cab.valor"></span>
38 </div> 38 </div>
39 <a 39 <a
40 class="btn col-12 btn-secondary d-sm-none" 40 class="btn col-12 btn-secondary d-sm-none"
41 ng-show="cabecera.length > 0" 41 ng-show="cabecera.length > 0"
42 ng-click="showCabecera = !showCabecera" 42 ng-click="showCabecera = !showCabecera"
43 > 43 >
44 <i 44 <i
45 class="fa fa-chevron-down" 45 class="fa fa-chevron-down"
46 ng-hide="showCabecera" 46 ng-hide="showCabecera"
47 aria-hidden="true" 47 aria-hidden="true"
48 > 48 >
49 </i> 49 </i>
50 <i 50 <i
51 class="fa fa-chevron-up" 51 class="fa fa-chevron-up"
52 ng-show="showCabecera" 52 ng-show="showCabecera"
53 aria-hidden="true"> 53 aria-hidden="true">
54 </i> 54 </i>
55 </a> 55 </a>
56 </div> 56 </div>
57 </div> 57 </div>
58 </div> 58 </div>
59 <div class="row p-1 botonera-secundaria"> 59 <div class="row p-1 botonera-secundaria">
60 <div class="col-12"> 60 <div class="col-12">
61 <div class="row"> 61 <div class="row">
62 <div class="col-6 col-sm-3 px-0 py-0" ng-repeat="boton in botonera"> 62 <div class="col-6 col-sm-3 px-0 py-0" ng-repeat="boton in botonera">
63 <button 63 <button
64 type="button" 64 type="button"
65 class="btn btn-default btn-block btn-xs text-left py-2" 65 class="btn btn-default btn-block btn-xs text-left py-2"
66 ng-click="boton.accion()" 66 ng-click="boton.accion()"
67 ng-class="{'d-none d-sm-block': boton.texto == ''}" 67 ng-class="{'d-none d-sm-block': boton.texto == ''}"
68 > 68 >
69 <i 69 <i
70 class="fa fa-arrow-circle-right" 70 class="fa fa-arrow-circle-right"
71 ng-show="boton.texto != ''" 71 ng-show="boton.texto != ''"
72 ></i> 72 ></i>
73 &nbsp; 73 &nbsp;
74 {{boton.texto}} 74 {{boton.texto}}
75 </button> 75 </button>
76 </div> 76 </div>
77 </div> 77 </div>
78 </div> 78 </div>
79 </div> 79 </div>
80 </div> 80 </div>
81 </div> 81 </div>
82 </form> 82 </form>
83 <div class="row"> 83 <div class="row">
84 <div class="col-12 col-md-10 col-lg-8 offset-md-1 offset-lg-2"> 84 <div class="col-12 col-md-10 col-lg-8 offset-md-1 offset-lg-2">
85 <!-- PC --> 85 <!-- PC -->
86 <div class="row grilla-articulo align-items-end d-none d-sm-flex"> 86 <div class="row grilla-articulo align-items-end d-none d-sm-flex">
87 <table class="table tabla-articulo table-striped table-sm table-dark"> 87 <table class="table tabla-articulo table-striped table-sm table-dark">
88 <thead> 88 <thead>
89 <tr class="d-flex"> 89 <tr class="d-flex">
90 <th class="col-auto">#</th> 90 <th class="col-auto">#</th>
91 <th class="col-2">Remito</th> 91 <th class="col-2">Remito</th>
92 <th class="col">Cliente</th> 92 <th class="col">Cliente</th>
93 <th class="col">Dirección</th> 93 <th class="col">Dirección</th>
94 <th class="col-1 text-right">Litros</th> 94 <th class="col-1 text-right">Litros</th>
95 <th class="col-auto"> 95 <th class="col-auto">
96 <button 96 <button
97 class="btn btn-outline-secondary selectable" 97 class="btn btn-outline-secondary selectable"
98 ng-click="show = !show; masMenos()" 98 ng-click="show = !show; masMenos()"
99 > 99 >
100 <i 100 <i
101 class="fa fa-chevron-down" 101 class="fa fa-chevron-down"
102 ng-show="show" 102 ng-show="show"
103 aria-hidden="true" 103 aria-hidden="true"
104 > 104 >
105 </i> 105 </i>
106 <i 106 <i
107 class="fa fa-chevron-up" 107 class="fa fa-chevron-up"
108 ng-hide="show" 108 ng-hide="show"
109 aria-hidden="true"> 109 aria-hidden="true">
110 </i> 110 </i>
111 </button> 111 </button>
112 </th> 112 </th>
113 </th> 113 </th>
114 </tr> 114 </tr>
115 </thead> 115 </thead>
116 <tbody class="tabla-articulo-body"> 116 <tbody class="tabla-articulo-body">
117 <tr 117 <tr
118 ng-repeat="(key, remito) in remitosTabla" 118 ng-repeat="(key, remito) in remitosTabla"
119 class="d-flex" 119 class="d-flex"
120 ng-show="show || key == remitosTabla.length - 1" 120 ng-show="show || key == remitosTabla.length - 1"
121 > 121 >
122 <td ng-bind="key + 1" class="col-auto"></td> 122 <td ng-bind="key + 1" class="col-auto"></td>
123 <td 123 <td
124 class="col-2" 124 class="col-2"
125 ng-bind="rellenar(remito.sucursal, 4) + '-' + rellenar(remito.numeroRemito, 8)" 125 ng-bind="rellenar(remito.sucursal, 4) + '-' + rellenar(remito.numeroRemito, 8)"
126 ></td> 126 ></td>
127 <th class="col" ng-bind="remito.cliente[0].NOM"></th> 127 <th class="col" ng-bind="remito.cliente[0].NOM"></th>
128 <th class="col" ng-bind="remito.domicilioStamp"></th> 128 <th class="col" ng-bind="remito.domicilioStamp"></th>
129 <th class="col-1 text-right" ng-bind="remito.litros"></th> 129 <th class="col-1 text-right" ng-bind="remito.litros"></th>
130 <td class="text-center col-auto"> 130 <td class="text-center col-auto">
131 <button 131 <button
132 class="btn btn-outline-secondary" 132 class="btn btn-outline-secondary"
133 ng-click="quitarArticulo(key)" 133 ng-click="quitarArticulo(key)"
134 > 134 >
135 <i class="fa fa-trash"></i> 135 <i class="fa fa-trash"></i>
136 </button> 136 </button>
137 </td> 137 </td>
138 </tr> 138 </tr>
139 </tbody> 139 </tbody>
140 <tfoot> 140 <tfoot>
141 <tr class="d-flex"> 141 <tr class="d-flex">
142 <td class="col-auto px-1"> 142 <td class="col-auto px-1">
143 <strong>Remitos:</strong> 143 <strong>Remitos:</strong>
144 <a ng-bind="remitosTabla.length"></a> 144 <a ng-bind="remitosTabla.length"></a>
145 </td> 145 </td>
146 <td class="col"></td> 146 <td class="col"></td>
147 <td class="col-auto px-1"> 147 <td class="col-auto px-1">
148 <strong>Litros:</strong> 148 <strong>Litros:</strong>
149 <a ng-bind="hojaRuta.litros"></a> 149 <a ng-bind="hojaRuta.litros"></a>
150 </td> 150 </td>
151 </tr> 151 </tr>
152 </tfoot> 152 </tfoot>
153 </table> 153 </table>
154 </div> 154 </div>
155 155
156 <!-- MOBILE --> 156 <!-- MOBILE -->
157 <div class="row d-sm-none"> 157 <div class="row d-sm-none">
158 <table class="table table-sm table-striped table-dark margin-bottom-mobile"> 158 <table class="table table-sm table-striped table-dark margin-bottom-mobile">
159 <thead> 159 <thead>
160 <tr class="d-flex"> 160 <tr class="d-flex">
161 <th class="">#</th> 161 <th class="">#</th>
162 <th class="col px-0"> 162 <th class="col px-0">
163 <div class="d-flex"> 163 <div class="d-flex">
164 <div class="col-4 px-1">Código</div> 164 <div class="col-4 px-1">Código</div>
165 <div class="col-8 px-1">Descripción</div> 165 <div class="col-8 px-1">Descripción</div>
166 </div> 166 </div>
167 <div class="d-flex"> 167 <div class="d-flex">
168 <div class="col-3 px-1">Cantidad</div> 168 <div class="col-3 px-1">Cantidad</div>
169 <div class="col px-1 text-right">P. Uni.</div> 169 <div class="col px-1 text-right">P. Uni.</div>
170 <div class="col px-1 text-right">Subtotal</div> 170 <div class="col px-1 text-right">Subtotal</div>
171 </div> 171 </div>
172 </th> 172 </th>
173 <th class="text-center tamaño-boton"> 173 <th class="text-center tamaño-boton">
174 &nbsp; 174 &nbsp;
175 </th> 175 </th>
176 </tr> 176 </tr>
177 </thead> 177 </thead>
178 <tbody> 178 <tbody>
179 <tr 179 <tr
180 ng-repeat="(key, articulo) in remitosTabla" 180 ng-repeat="(key, articulo) in remitosTabla"
181 ng-show="show || key == remitosTabla.length - 1" 181 ng-show="show || key == remitosTabla.length - 1"
182 > 182 >
183 <td class="w-100 align-middle d-flex p-0"> 183 <td class="w-100 align-middle d-flex p-0">
184 <div class="align-middle p-1"> 184 <div class="align-middle p-1">
185 <span ng-bind="key+1" class="align-middle"></span> 185 <span ng-bind="key+1" class="align-middle"></span>
186 </div> 186 </div>
187 <div class="col px-0"> 187 <div class="col px-0">
188 <div class="d-flex"> 188 <div class="d-flex">
189 <div class="col-4 px-1"> 189 <div class="col-4 px-1">
190 <span 190 <span
191 ng-bind="articulo.sector + '-' + articulo.codigo" 191 ng-bind="articulo.sector + '-' + articulo.codigo"
192 ></span> 192 ></span>
193 </div> 193 </div>
194 <div class="col-8 px-1"> 194 <div class="col-8 px-1">
195 <span ng-bind="articulo.descripcion"></span> 195 <span ng-bind="articulo.descripcion"></span>
196 </div> 196 </div>
197 </div> 197 </div>
198 <div class="d-flex"> 198 <div class="d-flex">
199 <div class="col-3 px-1"> 199 <div class="col-3 px-1">
200 <span ng-bind="'x' + articulo.cantidad"></span> 200 <span ng-bind="'x' + articulo.cantidad"></span>
201 </div> 201 </div>
202 <div class="col-3 px-1 text-right"> 202 <div class="col-3 px-1 text-right">
203 <span ng-bind="articulo.precio | currency: hojaRuta.moneda.simbolo : 4"></span> 203 <span ng-bind="articulo.precio | currency: hojaRuta.moneda.simbolo : 4"></span>
204 </div> 204 </div>
205 <div class="col px-1 text-right"> 205 <div class="col px-1 text-right">
206 <span 206 <span
207 ng-bind="(articulo.precio * articulo.cantidad) | currency: hojaRuta.moneda.simbolo" 207 ng-bind="(articulo.precio * articulo.cantidad) | currency: hojaRuta.moneda.simbolo"
208 > 208 >
209 </span> 209 </span>
210 </div> 210 </div>
211 </div> 211 </div>
212 </div> 212 </div>
213 <div class="align-middle p-1"> 213 <div class="align-middle p-1">
214 <button 214 <button
215 class="btn btn-outline-secondary" 215 class="btn btn-outline-secondary"
216 ng-click="quitarArticulo(key)" 216 ng-click="quitarArticulo(key)"
217 > 217 >
218 <i class="fa fa-trash"></i> 218 <i class="fa fa-trash"></i>
219 </button> 219 </button>
220 </div> 220 </div>
221 </td> 221 </td>
222 </tr> 222 </tr>
223 </tbody> 223 </tbody>
224 <tfoot> 224 <tfoot>
225 <!-- CARGANDO ITEM --> 225 <!-- CARGANDO ITEM -->
226 <tr ng-show="!cargando" class="d-flex"> 226 <tr ng-show="!cargando" class="d-flex">
227 <td 227 <td
228 class="align-middle p-1" 228 class="align-middle p-1"
229 ng-bind="remitosTabla.length + 1" 229 ng-bind="remitosTabla.length + 1"
230 ></td> 230 ></td>
231 <td class="col p-0"> 231 <td class="col p-0">
232 <div class="d-flex"> 232 <div class="d-flex">
233 <div class="col-4 px-1"> 233 <div class="col-4 px-1">
234 <span 234 <span
235 ng-bind="articuloACargar.sectorCodigo" 235 ng-bind="articuloACargar.sectorCodigo"
236 ></span> 236 ></span>
237 </div> 237 </div>
238 <div class="col-8 px-1"> 238 <div class="col-8 px-1">
239 <span ng-bind="articuloACargar.descripcion"></span> 239 <span ng-bind="articuloACargar.descripcion"></span>
240 </div> 240 </div>
241 </div> 241 </div>
242 <div class="d-flex"> 242 <div class="d-flex">
243 <div class="col-3 px-1 m-1"> 243 <div class="col-3 px-1 m-1">
244 <input 244 <input
245 class="form-control p-1" 245 class="form-control p-1"
246 type="number" 246 type="number"
247 min="1" 247 min="1"
248 ng-model="articuloACargar.cantidad" 248 ng-model="articuloACargar.cantidad"
249 foca-focus="!cargando" 249 foca-focus="!cargando"
250 ng-keypress="agregarATabla($event.keyCode)" 250 ng-keypress="agregarATabla($event.keyCode)"
251 style="height: auto; line-height: 1.1em" 251 style="height: auto; line-height: 1.1em"
252 > 252 >
253 </div> 253 </div>
254 <div class="col-3 px-1 text-right"> 254 <div class="col-3 px-1 text-right">
255 <span ng-bind="articuloACargar.precio | currency: hojaRuta.moneda.simbolo : 4"></span> 255 <span ng-bind="articuloACargar.precio | currency: hojaRuta.moneda.simbolo : 4"></span>
256 </div> 256 </div>
257 <div class="col px-1 text-right"> 257 <div class="col px-1 text-right">
258 <span 258 <span
259 ng-bind="getSubTotal() | currency: hojaRuta.moneda.simbolo" 259 ng-bind="getSubTotal() | currency: hojaRuta.moneda.simbolo"
260 > 260 >
261 </span> 261 </span>
262 </div> 262 </div>
263 </div> 263 </div>
264 </td> 264 </td>
265 <td class="text-center align-middle"> 265 <td class="text-center align-middle">
266 <button 266 <button
267 class="btn btn-outline-secondary" 267 class="btn btn-outline-secondary"
268 ng-click="agregarATabla(13)" 268 ng-click="agregarATabla(13)"
269 > 269 >
270 <i class="fa fa-save"></i> 270 <i class="fa fa-save"></i>
271 </button> 271 </button>
272 </td> 272 </td>
273 </tr> 273 </tr>
274 <!-- SELECCIONAR PRODUCTO --> 274 <!-- SELECCIONAR PRODUCTO -->
275 <tr ng-show="cargando" class="d-flex"> 275 <tr ng-show="cargando" class="d-flex">
276 <td class="col-12"> 276 <td class="col-12">
277 <input 277 <input
278 placeholder="Seleccione Articulo" 278 placeholder="Seleccione Articulo"
279 class="form-control form-control-sm" 279 class="form-control form-control-sm"
280 readonly 280 readonly
281 ng-click="seleccionarArticulo()" 281 ng-click="seleccionarArticulo()"
282 /> 282 />
283 </td> 283 </td>
284 </tr> 284 </tr>
285 <!-- TOOGLE EXPANDIR --> 285 <!-- TOOGLE EXPANDIR -->
286 <tr> 286 <tr>
287 <td class="col"> 287 <td class="col">
288 <button 288 <button
289 class="btn btn-outline-secondary selectable w-100" 289 class="btn btn-outline-secondary selectable w-100"
290 ng-click="show = !show; masMenos()" 290 ng-click="show = !show; masMenos()"
291 ng-show="remitosTabla.length > 0" 291 ng-show="remitosTabla.length > 0"
292 > 292 >
293 <i 293 <i
294 class="fa fa-chevron-down" 294 class="fa fa-chevron-down"
295 ng-hide="show" 295 ng-hide="show"
296 aria-hidden="true" 296 aria-hidden="true"
297 > 297 >
298 </i> 298 </i>
299 <i 299 <i
300 class="fa fa-chevron-up" 300 class="fa fa-chevron-up"
301 ng-show="show" 301 ng-show="show"
302 aria-hidden="true"> 302 aria-hidden="true">
303 </i> 303 </i>
304 </button> 304 </button>
305 </td> 305 </td>
306 </tr> 306 </tr>
307 <!-- FOOTER --> 307 <!-- FOOTER -->
308 <tr class="d-flex"> 308 <tr class="d-flex">
309 <td class="align-middle no-border-top" colspan="2"> 309 <td class="align-middle no-border-top" colspan="2">
310 <strong>Cantidad Items:</strong> 310 <strong>Cantidad Items:</strong>
311 <a ng-bind="remitosTabla.length"></a> 311 <a ng-bind="remitosTabla.length"></a>
312 </td> 312 </td>
313 <td class="text-right ml-auto table-celda-total no-border-top"> 313 <td class="text-right ml-auto table-celda-total no-border-top">
314 <h3>Total:</h3> 314 <h3>Total:</h3>
315 </td> 315 </td>
316 <td class="table-celda-total text-right no-border-top"> 316 <td class="table-celda-total text-right no-border-top">
317 <h3>{{getTotal() | currency: hojaRuta.moneda.simbolo}}</h3> 317 <h3>{{getTotal() | currency: hojaRuta.moneda.simbolo}}</h3>
318 </td> 318 </td>
319 </tr> 319 </tr>
320 </tfoot> 320 </tfoot>
321 </table> 321 </table>
322 </div> 322 </div>
323 </div> 323 </div>
324 <div class="col-auto my-2 col-lg-2 botonera-lateral d-none d-md-block"> 324 <div class="col-auto my-2 col-lg-2 botonera-lateral d-none d-md-block">
325 <div class="row align-items-end"> 325 <div class="row align-items-end">
326 <div class="col-12"> 326 <div class="col-12">
327 <button 327 <button
328 ng-click="crearNotaPedido()" 328 ng-click="crearHojaRuta()"
329 type="submit" 329 type="submit"
330 title="Crear nota pedido" 330 title="Crear nota pedido"
331 class="btn btn-default btn-block mb-2"> 331 class="btn btn-default btn-block mb-2">
332 Guardar 332 Guardar
333 </button> 333 </button>
334 <button 334 <button
335 ng-click="salir()" 335 ng-click="salir()"
336 type="button" 336 type="button"
337 title="Salir" 337 title="Salir"
338 class="btn btn-default btn-block"> 338 class="btn btn-default btn-block">
339 Salir 339 Salir
340 </button> 340 </button>
341 </div> 341 </div>
342 </div> 342 </div>
343 </div> 343 </div>
344 </div> 344 </div>
345 <div class="row d-md-none fixed-bottom"> 345 <div class="row d-md-none fixed-bottom">
346 <div class="w-100 bg-dark d-flex px-3 acciones-mobile"> 346 <div class="w-100 bg-dark d-flex px-3 acciones-mobile">
347 <span class="ml-3 text-muted" ng-click="salir()">Salir</span> 347 <span class="ml-3 text-muted" ng-click="salir()">Salir</span>
348 <span class="mr-3 ml-auto" ng-click="crearNotaPedido()">Guardar</span> 348 <span class="mr-3 ml-auto" ng-click="crearHojaRuta()">Guardar</span>
349 </div> 349 </div>
350 </div> 350 </div>
351 </div> 351 </div>
352 352