Commit 021594ed3cd91337fd3ce8dba7c8205e0af2d715

Authored by Marcelo Puebla
1 parent 2d5f140c80
Exists in master

Codigo indentado.

Showing 1 changed file with 120 additions and 121 deletions   Show diff stats
src/js/controller.js
1   -angular.module('focaCrearRemito') .controller('remitoController',
  1 +angular.module('focaCrearRemito').controller('remitoController',
2 2 [
3 3 '$scope', '$uibModal', '$location', '$filter', 'crearRemitoService', '$timeout',
4   - 'focaModalService', 'remitoBusinessService', '$rootScope', 'focaBotoneraLateralService',
  4 + 'focaModalService', 'remitoBusinessService', '$rootScope', 'focaBotoneraLateralService',
5 5 '$localStorage',
6   - function(
  6 + function (
7 7 $scope, $uibModal, $location, $filter, crearRemitoService, $timeout, focaModalService,
8   - remitoBusinessService, $rootScope, focaBotoneraLateralService, $localStorage)
9   - {
  8 + remitoBusinessService, $rootScope, focaBotoneraLateralService, $localStorage) {
10 9 config();
11 10  
12 11 function config() {
... ... @@ -27,20 +26,20 @@ angular.module('focaCrearRemito') .controller('remitoController',
27 26  
28 27 var monedaPorDefecto;
29 28 //Trabajo con la cotización más reciente, por eso uso siempre la primera '[0]'
30   - crearRemitoService.getCotizacionByIdMoneda(1).then(function(res) {
  29 + crearRemitoService.getCotizacionByIdMoneda(1).then(function (res) {
31 30 monedaPorDefecto = res.data[0];
32 31  
33 32 $scope.remito.cotizacion = Object.assign(
34   - {moneda: monedaPorDefecto}, monedaPorDefecto.cotizaciones[0]
  33 + { moneda: monedaPorDefecto }, monedaPorDefecto.cotizaciones[0]
35 34 );
36 35 $scope.inicial.cotizacion = $scope.remito.cotizacion;
37 36 $scope.cotizacionPorDefecto = angular.copy($scope.remito.cotizacion);
38 37  
39   - $timeout(function() { getLSRemito(); });
  38 + $timeout(function () { getLSRemito(); });
40 39 });
41 40  
42 41 //SETEO BOTONERA LATERAL
43   - $timeout(function() {
  42 + $timeout(function () {
44 43 focaBotoneraLateralService.showSalir(false);
45 44 focaBotoneraLateralService.showPausar(true);
46 45 focaBotoneraLateralService.showGuardar(true, $scope.crearRemito);
... ... @@ -59,7 +58,7 @@ angular.module('focaCrearRemito') .controller('remitoController',
59 58 vendedor: {},
60 59 cliente: {},
61 60 proveedor: {},
62   - domicilio: {dom: ''},
  61 + domicilio: { dom: '' },
63 62 moneda: {},
64 63 cotizacion: $scope.cotizacionPorDefecto || {},
65 64 articulosRemito: []
... ... @@ -73,11 +72,11 @@ angular.module('focaCrearRemito') .controller('remitoController',
73 72 $scope.idLista = undefined;
74 73  
75 74 crearRemitoService.getNumeroRemito().then(
76   - function(res) {
  75 + function (res) {
77 76 $scope.puntoVenta = rellenar(res.data.sucursal, 4);
78 77 $scope.comprobante = rellenar(res.data.numeroRemito, 8);
79 78 },
80   - function(err) {
  79 + function (err) {
81 80 focaModalService.alert('La terminal no esta configurada correctamente');
82 81 console.info(err);
83 82 }
... ... @@ -86,14 +85,14 @@ angular.module('focaCrearRemito') .controller('remitoController',
86 85 $scope.inicial = angular.copy($scope.remito);
87 86 }
88 87  
89   - $scope.$watch('remito', function(newValue) {
  88 + $scope.$watch('remito', function (newValue) {
90 89 focaBotoneraLateralService.setPausarData({
91 90 label: 'remito',
92 91 val: newValue
93 92 });
94 93 }, true);
95 94  
96   - $scope.seleccionarNotaPedido = function() {
  95 + $scope.seleccionarNotaPedido = function () {
97 96 if (varlidarRemitoFacturado()) {
98 97 var modalInstance = $uibModal.open(
99 98 {
... ... @@ -102,19 +101,19 @@ angular.module('focaCrearRemito') .controller('remitoController',
102 101 controller: 'focaModalNotaPedidoController',
103 102 size: 'lg',
104 103 resolve: {
105   - usadoPor: function() { return 'remito'; },
106   - idVendedor: function() { return null; }
  104 + usadoPor: function () { return 'remito'; },
  105 + idVendedor: function () { return null; }
107 106 }
108 107 }
109 108 );
110 109 modalInstance.result.then(
111   - function(notaPedido) {
  110 + function (notaPedido) {
112 111 //añado cabeceras
113 112 $scope.notaPedido.id = notaPedido.id;
114 113 $scope.$broadcast('removeCabecera', 'Bomba:');
115 114 $scope.$broadcast('removeCabecera', 'Kilometros:');
116 115 var puntosDescarga = [];
117   - notaPedido.notaPedidoPuntoDescarga.forEach(function(notaPedido, idx, arr) {
  116 + notaPedido.notaPedidoPuntoDescarga.forEach(function (notaPedido, idx, arr) {
118 117 puntosDescarga.push(notaPedido.puntoDescarga);
119 118 });
120 119 var cabeceras = [
... ... @@ -149,7 +148,7 @@ angular.module('focaCrearRemito') .controller('remitoController',
149 148 },
150 149 {
151 150 label: 'Proveedor:',
152   - valor: $filter('rellenarDigitos')
  151 + valor: $filter('rellenarDigitos')
153 152 (notaPedido.proveedor.COD, 5) + ' - ' +
154 153 notaPedido.proveedor.NOM
155 154 },
... ... @@ -198,7 +197,7 @@ angular.module('focaCrearRemito') .controller('remitoController',
198 197 $scope.remito.id = 0;
199 198 $scope.remito.remitoPlazo = notaPedido.notaPedidoPlazo;
200 199  
201   - for(var i = notaPedido.articulosNotaPedido.length - 1; i >= 0; i--) {
  200 + for (var i = notaPedido.articulosNotaPedido.length - 1; i >= 0; i--) {
202 201 notaPedido.articulosNotaPedido[i].id = 0;
203 202 notaPedido.articulosNotaPedido[i].idRemito = 0;
204 203 }
... ... @@ -214,32 +213,32 @@ angular.module('focaCrearRemito') .controller('remitoController',
214 213 enableObservaciones(notaPedido.observaciones ? true : false);
215 214 addArrayCabecera(cabeceras);
216 215  
217   - }, function() {
  216 + }, function () {
218 217 // funcion ejecutada cuando se cancela el modal
219 218 }
220 219 );
221 220 }
222 221 };
223 222  
224   - $scope.seleccionarRemito = function() {
  223 + $scope.seleccionarRemito = function () {
225 224 var modalInstance = $uibModal.open(
226 225 {
227 226 ariaLabelledBy: 'Busqueda de Remito',
228 227 templateUrl: 'foca-modal-remito.html',
229 228 controller: 'focaModalRemitoController',
230 229 size: 'lg',
231   - resolve: {usadoPor: function() {return 'remito';}}
  230 + resolve: { usadoPor: function () { return 'remito'; } }
232 231 }
233 232 );
234 233 modalInstance.result.then(
235   - setearRemito, function() {
  234 + setearRemito, function () {
236 235 // funcion ejecutada cuando se cancela el modal
237 236 }
238 237 );
239 238 };
240 239  
241 240 //validacion por domicilio y por plazo pago
242   - $scope.crearRemito = function() {
  241 + $scope.crearRemito = function () {
243 242 if (!$scope.remito.vendedor.NUM) {
244 243 focaModalService.alert('Ingrese Vendedor');
245 244 return;
... ... @@ -250,13 +249,13 @@ angular.module('focaCrearRemito') .controller('remitoController',
250 249 focaModalService.alert('Ingrese Proveedor');
251 250 return;
252 251 } else if (!$scope.remito.cotizacion.moneda.id &&
253   - !$scope.remito.cotizacion.moneda.ID){
  252 + !$scope.remito.cotizacion.moneda.ID) {
254 253 focaModalService.alert('Ingrese Moneda');
255 254 return;
256 255 } else if (!$scope.remito.cotizacion.ID) {
257 256 focaModalService.alert('Ingrese Cotización');
258 257 return;
259   - } else if ($scope.remito.flete === undefined || $scope.remito.flete === null){
  258 + } else if ($scope.remito.flete === undefined || $scope.remito.flete === null) {
260 259 focaModalService.alert('Ingrese Flete');
261 260 return;
262 261 } else if ($scope.articulosFiltro().length === 0) {
... ... @@ -265,7 +264,7 @@ angular.module('focaCrearRemito') .controller('remitoController',
265 264 }
266 265 focaBotoneraLateralService.startGuardar();
267 266 $scope.saveLoading = true;
268   - var save = {
  267 + var save = {
269 268 remito: {
270 269 id: $scope.remito.id,
271 270 fechaRemito: $scope.now.toISOString().slice(0, 19).replace('T', ' '),
... ... @@ -273,7 +272,7 @@ angular.module('focaCrearRemito') .controller('remitoController',
273 272 nombreCliente: $scope.remito.cliente.NOM,
274 273 cuitCliente: $scope.remito.cliente.CUIT,
275 274 responsabilidadIvaCliente: 0,//TODO,
276   - descuento: 0,//TODO,
  275 + descuento: 0,//TODO,
277 276 importeNeto: 0,//TODO
278 277 importeExento: 0,//TODO
279 278 importeIva: 0,//TODO
... ... @@ -316,7 +315,7 @@ angular.module('focaCrearRemito') .controller('remitoController',
316 315 };
317 316  
318 317 crearRemitoService.crearRemito(save).then(
319   - function(data) {
  318 + function (data) {
320 319  
321 320 focaBotoneraLateralService.endGuardar(true);
322 321 $scope.saveLoading = false;
... ... @@ -327,7 +326,7 @@ angular.module('focaCrearRemito') .controller('remitoController',
327 326 remitoBusinessService.addArticulos($scope.remito.articulosRemito,
328 327 $scope.remito.id, $scope.remito.cotizacion.VENDEDOR);
329 328  
330   - if(data.status === 500) {
  329 + if (data.status === 500) {
331 330 focaModalService.alert(data.data);
332 331 return;
333 332 }
... ... @@ -336,7 +335,7 @@ angular.module('focaCrearRemito') .controller('remitoController',
336 335 if ($scope.remito.id === 0) {
337 336 var plazos = $scope.remito.remitoPlazo;
338 337  
339   - for(var j = 0; j < plazos.length; j++) {
  338 + for (var j = 0; j < plazos.length; j++) {
340 339 var json = {
341 340 idRemito: $scope.remito.id,
342 341 dias: plazos[j].dias
... ... @@ -355,7 +354,7 @@ angular.module(&#39;focaCrearRemito&#39;) .controller(&#39;remitoController&#39;,
355 354  
356 355 init();
357 356  
358   - }, function(error) {
  357 + }, function (error) {
359 358 focaModalService.alert(error.data || 'Hubo un error al crear el remito');
360 359 focaBotoneraLateralService.endGuardar();
361 360 $scope.saveLoading = false;
... ... @@ -364,7 +363,7 @@ angular.module(&#39;focaCrearRemito&#39;) .controller(&#39;remitoController&#39;,
364 363 );
365 364 };
366 365  
367   - $scope.seleccionarProductos = function() {
  366 + $scope.seleccionarProductos = function () {
368 367 if ($scope.idLista === undefined) {
369 368 focaModalService.alert(
370 369 'Primero seleccione una lista de precio y condicion');
... ... @@ -386,7 +385,7 @@ angular.module(&#39;focaCrearRemito&#39;) .controller(&#39;remitoController&#39;,
386 385 }
387 386 );
388 387 modalInstance.result.then(
389   - function(producto) {
  388 + function (producto) {
390 389 var newArt =
391 390 {
392 391 id: 0,
... ... @@ -413,13 +412,13 @@ angular.module(&#39;focaCrearRemito&#39;) .controller(&#39;remitoController&#39;,
413 412 };
414 413 $scope.articuloACargar = newArt;
415 414 $scope.cargando = false;
416   - }, function() {
  415 + }, function () {
417 416 // funcion ejecutada cuando se cancela el modal
418 417 }
419 418 );
420 419 };
421 420  
422   - $scope.seleccionarPuntosDeDescarga = function() {
  421 + $scope.seleccionarPuntosDeDescarga = function () {
423 422 if (!$scope.remito.cliente.COD || !$scope.remito.domicilio.id) {
424 423 focaModalService.alert('Primero seleccione un cliente y un domicilio');
425 424 return;
... ... @@ -442,21 +441,21 @@ angular.module(&#39;focaCrearRemito&#39;) .controller(&#39;remitoController&#39;,
442 441 }
443 442 );
444 443 modalInstance.result.then(
445   - function(puntosDescarga) {
  444 + function (puntosDescarga) {
446 445 $scope.remito.domicilio.puntosDescarga = puntosDescarga;
447 446  
448 447 $scope.$broadcast('addCabecera', {
449 448 label: 'Puntos de descarga:',
450 449 valor: getCabeceraPuntoDescarga($scope.remito.domicilio.puntosDescarga)
451 450 });
452   - }, function() {
  451 + }, function () {
453 452 $scope.abrirModalDomicilios($scope.cliente);
454 453 }
455 454 );
456 455 }
457 456 };
458 457  
459   - $scope.seleccionarVendedor = function(callback, ocultarVendedor) {
  458 + $scope.seleccionarVendedor = function (callback, ocultarVendedor) {
460 459 if (ocultarVendedor) {
461 460 callback();
462 461 return;
... ... @@ -483,8 +482,8 @@ angular.module(&#39;focaCrearRemito&#39;) .controller(&#39;remitoController&#39;,
483 482 size: 'md'
484 483 };
485 484 focaModalService.modal(parametrosModal).then(
486   - function(vendedor) {
487   - $scope.$broadcast('addCabecera',{
  485 + function (vendedor) {
  486 + $scope.$broadcast('addCabecera', {
488 487 label: 'Vendedor:',
489 488 valor: $filter('rellenarDigitos')(vendedor.NUM, 3) + ' - ' +
490 489 vendedor.NOM
... ... @@ -493,16 +492,16 @@ angular.module(&#39;focaCrearRemito&#39;) .controller(&#39;remitoController&#39;,
493 492 $scope.remito.vendedor = vendedor;
494 493 deleteCliente();
495 494 callback();
496   - }, function() {
  495 + }, function () {
497 496  
498 497 }
499 498 );
500 499 }
501 500 };
502 501  
503   - $scope.seleccionarCliente = function(ocultarVendedor) {
  502 + $scope.seleccionarCliente = function (ocultarVendedor) {
504 503  
505   - $scope.seleccionarVendedor(function() {
  504 + $scope.seleccionarVendedor(function () {
506 505 if (varlidarRemitoFacturado()) {
507 506 var modalInstance = $uibModal.open(
508 507 {
... ... @@ -510,17 +509,17 @@ angular.module(&#39;focaCrearRemito&#39;) .controller(&#39;remitoController&#39;,
510 509 templateUrl: 'foca-busqueda-cliente-modal.html',
511 510 controller: 'focaBusquedaClienteModalController',
512 511 resolve: {
513   - vendedor: function() { return $scope.remito.vendedor; },
514   - cobrador: function() { return null; }
  512 + vendedor: function () { return $scope.remito.vendedor; },
  513 + cobrador: function () { return null; }
515 514 },
516 515 size: 'lg'
517 516 }
518 517 );
519 518 modalInstance.result.then(
520   - function(cliente) {
  519 + function (cliente) {
521 520 $scope.abrirModalDomicilios(cliente);
522 521 $scope.cliente = cliente;
523   - }, function() {
  522 + }, function () {
524 523 $scope.seleccionarCliente();
525 524 }
526 525 );
... ... @@ -528,7 +527,7 @@ angular.module(&#39;focaCrearRemito&#39;) .controller(&#39;remitoController&#39;,
528 527 }, ocultarVendedor);
529 528 };
530 529  
531   - $scope.seleccionarProveedor = function() {
  530 + $scope.seleccionarProveedor = function () {
532 531 if (varlidarRemitoFacturado()) {
533 532 var parametrosModal = {
534 533 titulo: 'Búsqueda de Proveedor',
... ... @@ -552,17 +551,17 @@ angular.module(&#39;focaCrearRemito&#39;) .controller(&#39;remitoController&#39;,
552 551 }
553 552 ],
554 553 tipo: 'POST',
555   - json: {razonCuitCod: ''}
  554 + json: { razonCuitCod: '' }
556 555 };
557 556 focaModalService.modal(parametrosModal).then(
558   - function(proveedor) {
  557 + function (proveedor) {
559 558 $scope.seleccionarFlete(proveedor);
560   - }, function() { }
  559 + }, function () { }
561 560 );
562 561 }
563 562 };
564 563  
565   - $scope.abrirModalDomicilios = function(cliente) {
  564 + $scope.abrirModalDomicilios = function (cliente) {
566 565 var modalInstanceDomicilio = $uibModal.open(
567 566 {
568 567 ariaLabelledBy: 'Busqueda de Domicilios',
... ... @@ -570,13 +569,13 @@ angular.module(&#39;focaCrearRemito&#39;) .controller(&#39;remitoController&#39;,
570 569 controller: 'focaModalDomicilioController',
571 570 size: 'lg',
572 571 resolve: {
573   - idCliente: function() { return cliente.cod; },
574   - esNuevo: function() { return cliente.esNuevo; }
  572 + idCliente: function () { return cliente.cod; },
  573 + esNuevo: function () { return cliente.esNuevo; }
575 574 }
576 575 }
577 576 );
578 577 modalInstanceDomicilio.result.then(
579   - function(domicilio) {
  578 + function (domicilio) {
580 579 $scope.remito.domicilio = domicilio;
581 580 $scope.remito.cliente = {
582 581 COD: cliente.cod,
... ... @@ -590,11 +589,11 @@ angular.module(&#39;focaCrearRemito&#39;) .controller(&#39;remitoController&#39;,
590 589 domicilio.Calle + ' ' + domicilio.Numero + ', ' +
591 590 domicilio.Localidad + ', ' + domicilio.Provincia;
592 591 $scope.remito.domicilioStamp = domicilioStamp;
593   - $scope.$broadcast('addCabecera',{
  592 + $scope.$broadcast('addCabecera', {
594 593 label: 'Cliente:',
595 594 valor: $filter('rellenarDigitos')(cliente.cod, 3) + ' - ' + cliente.nom
596 595 });
597   - $scope.$broadcast('addCabecera',{
  596 + $scope.$broadcast('addCabecera', {
598 597 label: 'Domicilio:',
599 598 valor: domicilioStamp
600 599 });
... ... @@ -605,40 +604,40 @@ angular.module(&#39;focaCrearRemito&#39;) .controller(&#39;remitoController&#39;,
605 604 } else {
606 605 crearRemitoService
607 606 .getPuntosDescargaByClienDom(domicilio.id, cliente.cod)
608   - .then(function(res) {
  607 + .then(function (res) {
609 608 if (res.data.length) $scope.seleccionarPuntosDeDescarga();
610 609 });
611 610 }
612   - }, function() {
  611 + }, function () {
613 612 $scope.seleccionarCliente(true);
614 613 return;
615 614 }
616 615 );
617 616 };
618 617  
619   - $scope.getTotal = function() {
  618 + $scope.getTotal = function () {
620 619 var total = 0;
621 620 var arrayTempArticulos = $scope.articulosFiltro();
622   - for(var i = 0; i < arrayTempArticulos.length; i++) {
  621 + for (var i = 0; i < arrayTempArticulos.length; i++) {
623 622 total += arrayTempArticulos[i].precio * arrayTempArticulos[i].cantidad;
624 623 }
625 624 return parseFloat(total.toFixed(2));
626 625 };
627 626  
628   - $scope.getSubTotal = function() {
  627 + $scope.getSubTotal = function () {
629 628 if ($scope.articuloACargar) {
630 629 return $scope.articuloACargar.precio * $scope.articuloACargar.cantidad;
631 630 }
632 631 };
633 632  
634   - $scope.seleccionarPreciosYCondiciones = function() {
  633 + $scope.seleccionarPreciosYCondiciones = function () {
635 634 if (!$scope.remito.cliente.COD) {
636 635 focaModalService.alert('Primero seleccione un cliente');
637 636 return;
638 637 }
639 638  
640 639 if ($scope.remito.articulosRemito !== 0) {
641   - focaModalService.confirm('Se perderan los productos ingresados').then(function(data) {
  640 + focaModalService.confirm('Se perderan los productos ingresados').then(function (data) {
642 641 if (data && varlidarRemitoFacturado()) {
643 642 abrirModal();
644 643 }
... ... @@ -655,21 +654,21 @@ angular.module(&#39;focaCrearRemito&#39;) .controller(&#39;remitoController&#39;,
655 654 controller: 'focaModalPrecioCondicionController',
656 655 size: 'lg',
657 656 resolve: {
658   - idListaPrecio: function() {
  657 + idListaPrecio: function () {
659 658 return $scope.remito.cliente.MOD || null;
660 659 }
661 660 }
662 661 }
663 662 );
664 663 modalInstance.result.then(
665   - function(precioCondicion) {
  664 + function (precioCondicion) {
666 665 var cabecera = '';
667 666 var plazosConcat = '';
668 667 if (!Array.isArray(precioCondicion)) {
669 668 $scope.remito.idPrecioCondicion = precioCondicion.id;
670 669 $scope.remito.remitoPlazo = precioCondicion.plazoPago;
671 670 $scope.idLista = precioCondicion.idListaPrecio;
672   - for(var i = 0; i < precioCondicion.plazoPago.length; i++) {
  671 + for (var i = 0; i < precioCondicion.plazoPago.length; i++) {
673 672 plazosConcat += precioCondicion.plazoPago[i].dias + ' ';
674 673 }
675 674 cabecera = $filter('rellenarDigitos')(precioCondicion.id, 4) +
... ... @@ -679,25 +678,25 @@ angular.module(&#39;focaCrearRemito&#39;) .controller(&#39;remitoController&#39;,
679 678 //-1, el modal productos busca todos los productos
680 679 $scope.idLista = -1;
681 680 $scope.remito.remitoPlazo = precioCondicion;
682   - for(var j = 0; j < precioCondicion.length; j++) {
  681 + for (var j = 0; j < precioCondicion.length; j++) {
683 682 plazosConcat += precioCondicion[j].dias + ' ';
684 683 }
685 684 cabecera = 'Ingreso manual ' + plazosConcat.trim();
686 685 }
687 686 $scope.remito.articulosRemito = [];
688   - $scope.$broadcast('addCabecera',{
  687 + $scope.$broadcast('addCabecera', {
689 688 label: 'Precios y condiciones:',
690 689 valor: cabecera
691 690 });
692 691 $scope.remito.precioCondicion = precioCondicion;
693   - }, function() {
  692 + }, function () {
694 693  
695 694 }
696 695 );
697 696 }
698 697 };
699 698  
700   - $scope.seleccionarFlete = function(proveedor) {
  699 + $scope.seleccionarFlete = function (proveedor) {
701 700 if (varlidarRemitoFacturado()) {
702 701 var modalInstance = $uibModal.open(
703 702 {
... ... @@ -707,12 +706,12 @@ angular.module(&#39;focaCrearRemito&#39;) .controller(&#39;remitoController&#39;,
707 706 size: 'lg',
708 707 resolve: {
709 708 parametrosFlete:
710   - function() {
  709 + function () {
711 710 return {
712 711 flete: $scope.remito.flete ? '1' :
713 712 ($scope.remito.fob ? 'FOB' :
714   - ($scope.remito.flete === undefined ?
715   - null : '0')),
  713 + ($scope.remito.flete === undefined ?
  714 + null : '0')),
716 715 bomba: $scope.remito.bomba ? '1' :
717 716 ($scope.remito.bomba === undefined ?
718 717 null : '0'),
... ... @@ -723,11 +722,11 @@ angular.module(&#39;focaCrearRemito&#39;) .controller(&#39;remitoController&#39;,
723 722 }
724 723 );
725 724 modalInstance.result.then(
726   - function(datos) {
  725 + function (datos) {
727 726  
728 727 $scope.remito.proveedor = proveedor;
729 728 $scope.remito.idProveedor = proveedor.COD;
730   - $scope.$broadcast('addCabecera',{
  729 + $scope.$broadcast('addCabecera', {
731 730 label: 'Proveedor:',
732 731 valor: $filter('rellenarDigitos')(proveedor.COD, 5) + ' - ' +
733 732 proveedor.NOM
... ... @@ -738,16 +737,16 @@ angular.module(&#39;focaCrearRemito&#39;) .controller(&#39;remitoController&#39;,
738 737 $scope.remito.bomba = datos.bomba;
739 738 $scope.remito.kilometros = datos.kilometros;
740 739  
741   - $scope.$broadcast('addCabecera',{
  740 + $scope.$broadcast('addCabecera', {
742 741 label: 'Flete:',
743 742 valor: datos.flete ? 'Si' : ($scope.remito.fob ? 'FOB' : 'No')
744 743 });
745 744 if (datos.flete) {
746   - $scope.$broadcast('addCabecera',{
  745 + $scope.$broadcast('addCabecera', {
747 746 label: 'Bomba:',
748 747 valor: datos.bomba ? 'Si' : 'No'
749 748 });
750   - $scope.$broadcast('addCabecera',{
  749 + $scope.$broadcast('addCabecera', {
751 750 label: 'Kilometros:',
752 751 valor: datos.kilometros
753 752 });
... ... @@ -757,14 +756,14 @@ angular.module(&#39;focaCrearRemito&#39;) .controller(&#39;remitoController&#39;,
757 756 $scope.remito.bomba = false;
758 757 $scope.remito.kilometros = null;
759 758 }
760   - }, function() {
  759 + }, function () {
761 760 $scope.seleccionarTransportista();
762 761 }
763 762 );
764 763 }
765 764 };
766 765  
767   - $scope.seleccionarMoneda = function() {
  766 + $scope.seleccionarMoneda = function () {
768 767 if (varlidarRemitoFacturado()) {
769 768 var parametrosModal = {
770 769 titulo: 'Búsqueda de monedas',
... ... @@ -782,16 +781,16 @@ angular.module(&#39;focaCrearRemito&#39;) .controller(&#39;remitoController&#39;,
782 781 size: 'md'
783 782 };
784 783 focaModalService.modal(parametrosModal).then(
785   - function(moneda) {
  784 + function (moneda) {
786 785 $scope.abrirModalCotizacion(moneda);
787   - }, function() {
  786 + }, function () {
788 787  
789 788 }
790 789 );
791 790 }
792 791 };
793 792  
794   - $scope.seleccionarObservaciones = function() {
  793 + $scope.seleccionarObservaciones = function () {
795 794 focaModalService
796 795 .prompt({
797 796 titulo: 'Observaciones',
... ... @@ -799,25 +798,25 @@ angular.module(&#39;focaCrearRemito&#39;) .controller(&#39;remitoController&#39;,
799 798 textarea: true,
800 799 readonly: true
801 800 })
802   - .then(function(observaciones) {
  801 + .then(function (observaciones) {
803 802 $scope.remito.observaciones = observaciones;
804 803 });
805 804 };
806 805  
807   - $scope.abrirModalCotizacion = function(moneda) {
  806 + $scope.abrirModalCotizacion = function (moneda) {
808 807 var modalInstance = $uibModal.open(
809 808 {
810 809 ariaLabelledBy: 'Busqueda de Cotización',
811 810 templateUrl: 'modal-cotizacion.html',
812 811 controller: 'focaModalCotizacionController',
813 812 size: 'lg',
814   - resolve: {idMoneda: function() {return moneda.ID;}}
  813 + resolve: { idMoneda: function () { return moneda.ID; } }
815 814 }
816 815 );
817 816 modalInstance.result.then(
818   - function(cotizacion) {
  817 + function (cotizacion) {
819 818 var articulosTablaTemp = $scope.remito.articulosRemito;
820   - for(var i = 0; i < articulosTablaTemp.length; i++) {
  819 + for (var i = 0; i < articulosTablaTemp.length; i++) {
821 820 articulosTablaTemp[i].precio = articulosTablaTemp[i].precio *
822 821 $scope.remito.cotizacion.VENDEDOR;
823 822 articulosTablaTemp[i].precio = articulosTablaTemp[i].precio /
... ... @@ -831,32 +830,32 @@ angular.module(&#39;focaCrearRemito&#39;) .controller(&#39;remitoController&#39;,
831 830 $scope.$broadcast('removeCabecera', 'Fecha cotizacion:');
832 831 $scope.$broadcast('removeCabecera', 'Cotizacion:');
833 832 } else {
834   - $scope.$broadcast('addCabecera',{
  833 + $scope.$broadcast('addCabecera', {
835 834 label: 'Moneda:',
836 835 valor: moneda.DETALLE
837 836 });
838   - $scope.$broadcast('addCabecera',{
  837 + $scope.$broadcast('addCabecera', {
839 838 label: 'Fecha cotizacion:',
840 839 valor: $filter('date')(cotizacion.FECHA, 'dd/MM/yyyy')
841 840 });
842   - $scope.$broadcast('addCabecera',{
  841 + $scope.$broadcast('addCabecera', {
843 842 label: 'Cotizacion:',
844 843 valor: $filter('number')(cotizacion.VENDEDOR, '2')
845 844 });
846 845 }
847   - }, function() {
  846 + }, function () {
848 847  
849 848 }
850 849 );
851 850 };
852 851  
853   - $scope.agregarATabla = function(key) {
  852 + $scope.agregarATabla = function (key) {
854 853 if (key === 13) {
855 854 if ($scope.articuloACargar.cantidad === undefined ||
856 855 $scope.articuloACargar.cantidad === 0 ||
857   - $scope.articuloACargar.cantidad === null ) {
858   - focaModalService.alert('El valor debe ser al menos 1');
859   - return;
  856 + $scope.articuloACargar.cantidad === null) {
  857 + focaModalService.alert('El valor debe ser al menos 1');
  858 + return;
860 859 }
861 860 delete $scope.articuloACargar.sectorCodigo;
862 861 $scope.remito.articulosRemito.push($scope.articuloACargar);
... ... @@ -864,19 +863,19 @@ angular.module(&#39;focaCrearRemito&#39;) .controller(&#39;remitoController&#39;,
864 863 }
865 864 };
866 865  
867   - $scope.quitarArticulo = function(articulo) {
  866 + $scope.quitarArticulo = function (articulo) {
868 867 articulo.idRemito = -1;
869 868 };
870 869  
871   - $scope.articulosFiltro = function() {
  870 + $scope.articulosFiltro = function () {
872 871  
873   - var result = $scope.remito.articulosRemito.filter(function(articulo) {
  872 + var result = $scope.remito.articulosRemito.filter(function (articulo) {
874 873 return articulo.idRemito >= 0;
875 874 });
876 875 return result;
877 876 };
878 877  
879   - $scope.editarArticulo = function(key, articulo, tmpCantidad, tmpPrecio) {
  878 + $scope.editarArticulo = function (key, articulo, tmpCantidad, tmpPrecio) {
880 879 if (key === 13) {
881 880 if (!articulo.cantidad || !articulo.precio) {
882 881 focaModalService.alert('Los valores deben ser al menos 1');
... ... @@ -892,13 +891,13 @@ angular.module(&#39;focaCrearRemito&#39;) .controller(&#39;remitoController&#39;,
892 891 }
893 892 };
894 893  
895   - $scope.cancelarEditar = function(articulo) {
  894 + $scope.cancelarEditar = function (articulo) {
896 895 $scope.tmpCantidad = articulo.cantidad;
897 896 $scope.tmpPrecio = articulo.precio;
898 897 articulo.editCantidad = articulo.editPrecio = false;
899 898 };
900 899  
901   - $scope.cambioEdit = function(articulo, propiedad) {
  900 + $scope.cambioEdit = function (articulo, propiedad) {
902 901 if (propiedad === 'cantidad') {
903 902 articulo.editCantidad = true;
904 903 } else if (propiedad === 'precio') {
... ... @@ -906,12 +905,12 @@ angular.module(&#39;focaCrearRemito&#39;) .controller(&#39;remitoController&#39;,
906 905 }
907 906 };
908 907  
909   - $scope.resetFilter = function() {
  908 + $scope.resetFilter = function () {
910 909 $scope.articuloACargar = {};
911 910 $scope.cargando = true;
912 911 };
913 912 //Recibe aviso si el teclado está en uso
914   - $rootScope.$on('usarTeclado', function(event, data) {
  913 + $rootScope.$on('usarTeclado', function (event, data) {
915 914 if (data) {
916 915 $scope.mostrarTeclado = true;
917 916 return;
... ... @@ -919,7 +918,7 @@ angular.module(&#39;focaCrearRemito&#39;) .controller(&#39;remitoController&#39;,
919 918 $scope.mostrarTeclado = false;
920 919 });
921 920  
922   - $scope.selectFocus = function($event) {
  921 + $scope.selectFocus = function ($event) {
923 922 // Si el teclado esta en uso no selecciona el valor
924 923 if ($scope.mostrarTeclado) {
925 924 return;
... ... @@ -929,7 +928,7 @@ angular.module(&#39;focaCrearRemito&#39;) .controller(&#39;remitoController&#39;,
929 928  
930 929 function addArrayCabecera(array) {
931 930 for (var i = 0; i < array.length; i++) {
932   - $scope.$broadcast('addCabecera',{
  931 + $scope.$broadcast('addCabecera', {
933 932 label: array[i].label,
934 933 valor: array[i].valor
935 934 });
... ... @@ -963,7 +962,7 @@ angular.module(&#39;focaCrearRemito&#39;) .controller(&#39;remitoController&#39;,
963 962 if (confirmacion) {
964 963 focaModalService.confirm(
965 964 '¿Está seguro de que desea salir? Se perderán todos los datos cargados.'
966   - ).then(function(data) {
  965 + ).then(function (data) {
967 966 if (data) {
968 967 $location.path('/');
969 968 }
... ... @@ -974,7 +973,7 @@ angular.module(&#39;focaCrearRemito&#39;) .controller(&#39;remitoController&#39;,
974 973 }
975 974  
976 975 function enableObservaciones(val) {
977   - var boton = $scope.botonera.filter(function(botonObs) {
  976 + var boton = $scope.botonera.filter(function (botonObs) {
978 977 return botonObs.label === 'Observaciones';
979 978 });
980 979 boton[0].disable = !val;
... ... @@ -995,7 +994,7 @@ angular.module(&#39;focaCrearRemito&#39;) .controller(&#39;remitoController&#39;,
995 994 });
996 995 cabeceras.push({
997 996 label: 'Fecha cotizacion:',
998   - valor: $filter('date')(remito.cotizacion.FECHA,
  997 + valor: $filter('date')(remito.cotizacion.FECHA,
999 998 'dd/MM/yyyy')
1000 999 });
1001 1000 cabeceras.push({
... ... @@ -1094,7 +1093,7 @@ angular.module(&#39;focaCrearRemito&#39;) .controller(&#39;remitoController&#39;,
1094 1093 function deleteCliente() {
1095 1094 delete $scope.remito.domicilioStamp;
1096 1095 delete $scope.remito.puntosDescarga;
1097   - $scope.remito.domicilio = {dom: ''};
  1096 + $scope.remito.domicilio = { dom: '' };
1098 1097 $scope.remito.cliente = {};
1099 1098 $scope.$broadcast('removeCabecera', 'Cliente:');
1100 1099 $scope.$broadcast('removeCabecera', 'Domicilio:');
... ... @@ -1103,7 +1102,7 @@ angular.module(&#39;focaCrearRemito&#39;) .controller(&#39;remitoController&#39;,
1103 1102  
1104 1103 function getCabeceraPuntoDescarga(puntosDescarga) {
1105 1104 var puntosStamp = '';
1106   - puntosDescarga.forEach(function(punto, idx, arr) {
  1105 + puntosDescarga.forEach(function (punto, idx, arr) {
1107 1106 puntosStamp += punto.descripcion;
1108 1107 if ((idx + 1) !== arr.length) puntosStamp += ', ';
1109 1108 });
... ... @@ -1127,13 +1126,13 @@ angular.module(&#39;focaCrearRemito&#39;) .controller(&#39;remitoController&#39;,
1127 1126 }
1128 1127 }
1129 1128 )
1130   - .then(function(res) {
1131   - if (res === false) {
1132   - abrirModalMail(id);
1133   - focaModalService.alert('Descarga o envíe su remito ' +
1134   - 'antes de cerrar esta ventana');
1135   - }
1136   - });
  1129 + .then(function (res) {
  1130 + if (res === false) {
  1131 + abrirModalMail(id);
  1132 + focaModalService.alert('Descarga o envíe su remito ' +
  1133 + 'antes de cerrar esta ventana');
  1134 + }
  1135 + });
1137 1136 }
1138 1137 }
1139 1138 ]);