Commit 42a66c12c477f22557b9e2aefee15740a23a9142
Exists in
master
and in
1 other branch
Merge branch 'master' into 'develop'
Master(mpuebla) See merge request !118
Showing
1 changed file
Show diff stats
src/js/controller.js
| ... | ... | @@ -172,7 +172,7 @@ angular.module('focaCrearNotaPedido').controller('notaPedidoCtrl', |
| 172 | 172 | idProveedor: $scope.notaPedido.proveedor.COD, |
| 173 | 173 | idDomicilio: $scope.notaPedido.domicilio.id, |
| 174 | 174 | idCotizacion: $scope.notaPedido.cotizacion.ID, |
| 175 | - idListaPrecio: $scope.notaPedido.idPrecioCondicion, | |
| 175 | + idListaPrecio: $scope.idLista, | |
| 176 | 176 | cotizacion: $scope.notaPedido.cotizacion.VENDEDOR, |
| 177 | 177 | flete: $scope.notaPedido.flete, |
| 178 | 178 | fob: $scope.notaPedido.fob, |
| ... | ... | @@ -196,7 +196,7 @@ angular.module('focaCrearNotaPedido').controller('notaPedidoCtrl', |
| 196 | 196 | notaPedidoBusinessService.addArticulos( |
| 197 | 197 | $scope.notaPedido.articulosNotaPedido, |
| 198 | 198 | data.data.id, $scope.notaPedido.cotizacion.VENDEDOR); |
| 199 | - | |
| 199 | + | |
| 200 | 200 | if ($scope.notaPedido.notaPedidoPuntoDescarga.length > 0) { |
| 201 | 201 | notaPedidoBusinessService.addPuntosDescarga(data.data.id, |
| 202 | 202 | $scope.notaPedido.notaPedidoPuntoDescarga); |
| ... | ... | @@ -248,7 +248,7 @@ angular.module('focaCrearNotaPedido').controller('notaPedidoCtrl', |
| 248 | 248 | } |
| 249 | 249 | } |
| 250 | 250 | ); |
| 251 | - modalInstance.result.then(function(notaPedido) { | |
| 251 | + modalInstance.result.then(function (notaPedido) { | |
| 252 | 252 | |
| 253 | 253 | notaPedido.articulosNotaPedido.forEach(function (articulo) { |
| 254 | 254 | articulo.precio = |
| ... | ... | @@ -484,7 +484,7 @@ angular.module('focaCrearNotaPedido').controller('notaPedidoCtrl', |
| 484 | 484 | templateUrl: 'foca-busqueda-cliente-modal.html', |
| 485 | 485 | controller: 'focaBusquedaClienteModalController', |
| 486 | 486 | resolve: { |
| 487 | - vendedor: function () { return { id: $scope.idVendedor} }, | |
| 487 | + vendedor: function () { return { id: $scope.idVendedor }; }, | |
| 488 | 488 | cobrador: function () { return null; } |
| 489 | 489 | }, |
| 490 | 490 | size: 'lg' |
| ... | ... | @@ -601,7 +601,7 @@ angular.module('focaCrearNotaPedido').controller('notaPedidoCtrl', |
| 601 | 601 | $filter('filter')($scope.botonera, |
| 602 | 602 | { label: 'Cliente' })[0].checked = true; |
| 603 | 603 | $filter('filter')($scope.botonera, |
| 604 | - { label: 'Domicilio de Entrega' })[0].checked = true; | |
| 604 | + { label: 'Domicilio de Entrega' })[0].checked = true; | |
| 605 | 605 | }) |
| 606 | 606 | .catch(function (e) { console.log(e); }); |
| 607 | 607 | }, function () { |
| ... | ... | @@ -630,9 +630,7 @@ angular.module('focaCrearNotaPedido').controller('notaPedidoCtrl', |
| 630 | 630 | |
| 631 | 631 | $scope.seleccionarPreciosYCondiciones = function () { |
| 632 | 632 | |
| 633 | - if (!validarNotaRemitada()) { | |
| 634 | - return; | |
| 635 | - } | |
| 633 | + if (!validarNotaRemitada()) return; | |
| 636 | 634 | |
| 637 | 635 | if (!$scope.notaPedido.cliente.COD) { |
| 638 | 636 | focaModalService.alert('Primero seleccione un cliente'); |
| ... | ... | @@ -642,8 +640,11 @@ angular.module('focaCrearNotaPedido').controller('notaPedidoCtrl', |
| 642 | 640 | } |
| 643 | 641 | |
| 644 | 642 | function abrirModal() { |
| 645 | - var parametros = { idCliente: $scope.notaPedido.cliente.COD, idListaPrecio : $scope.notaPedido.cliente.MOD, | |
| 646 | - notaPedido: $scope.notaPedido }; | |
| 643 | + var parametros = { | |
| 644 | + idCliente: $scope.notaPedido.cliente.COD, | |
| 645 | + idListaPrecio: $scope.notaPedido.cliente.MOD, | |
| 646 | + notaPedido: $scope.notaPedido | |
| 647 | + }; | |
| 647 | 648 | var modalInstance = $uibModal.open( |
| 648 | 649 | { |
| 649 | 650 | ariaLabelledBy: 'Busqueda de Precio Condiciรณn', |
| ... | ... | @@ -656,48 +657,46 @@ angular.module('focaCrearNotaPedido').controller('notaPedidoCtrl', |
| 656 | 657 | } |
| 657 | 658 | ); |
| 658 | 659 | |
| 659 | - modalInstance.result | |
| 660 | - .then(function (precioCondicion) { | |
| 661 | - var cabecera = ''; | |
| 662 | - var plazosConcat = ''; | |
| 663 | - if (!Array.isArray(precioCondicion)) { | |
| 664 | - $scope.notaPedido.notaPedidoPlazo = precioCondicion.plazoPago; | |
| 665 | - $scope.notaPedido.precioCondicion = precioCondicion; | |
| 666 | - $scope.notaPedido.idPrecioCondicion = precioCondicion.listaPrecio.ID; | |
| 667 | - $scope.notaPedido.cliente.MOD = precioCondicion.listaPrecio.ID; | |
| 668 | - $scope.idLista = parseInt(precioCondicion.listaPrecio.ID) ? | |
| 669 | - parseInt(precioCondicion.listaPrecio.ID) : -1; | |
| 670 | - for (var i = 0; i < precioCondicion.plazoPago.length; i++) { | |
| 671 | - plazosConcat += precioCondicion.plazoPago[i].dias + ', '; | |
| 672 | - } | |
| 673 | - plazosConcat = plazosConcat.substring(0, plazosConcat.length - 2); | |
| 674 | - cabecera = $filter('rellenarDigitos')($scope.idLista, 4) + | |
| 675 | - ' - ' + precioCondicion.listaPrecio.DES + ' ' + plazosConcat.trim(); | |
| 676 | - } else { //Cuando se ingresan los plazos manualmente | |
| 677 | - $scope.notaPedido.idPrecioCondicion = 0; | |
| 678 | - //-1, el modal productos busca todos los productos | |
| 679 | - $scope.idLista = -1; | |
| 680 | - $scope.notaPedido.notaPedidoPlazo = precioCondicion; | |
| 681 | - for (var j = 0; j < precioCondicion.length; j++) { | |
| 682 | - plazosConcat += precioCondicion[j].dias + ' '; | |
| 683 | - } | |
| 684 | - cabecera = 'Ingreso manual ' + plazosConcat.trim(); | |
| 660 | + modalInstance.result.then(function (precioCondicion) { | |
| 661 | + var cabecera = ''; | |
| 662 | + var plazosConcat = ''; | |
| 663 | + if (!Array.isArray(precioCondicion)) { | |
| 664 | + $scope.notaPedido.notaPedidoPlazo = precioCondicion.plazoPago; | |
| 665 | + $scope.notaPedido.precioCondicion = precioCondicion; | |
| 666 | + $scope.notaPedido.cliente.MOD = precioCondicion.listaPrecio.ID; | |
| 667 | + $scope.idLista = parseInt(precioCondicion.listaPrecio.ID) ? | |
| 668 | + parseInt(precioCondicion.listaPrecio.ID) : -1; | |
| 669 | + for (var i = 0; i < precioCondicion.plazoPago.length; i++) { | |
| 670 | + plazosConcat += precioCondicion.plazoPago[i].dias + ', '; | |
| 685 | 671 | } |
| 686 | - $scope.cabeceras.push({ | |
| 687 | - label: 'Precios y Condiciones:', | |
| 688 | - valor: $scope.idLista + ' - ' + precioCondicion.listaPrecio.DES + ' ' + | |
| 689 | - notaPedidoBusinessService.plazoToString(precioCondicion.plazoPago) | |
| 690 | - }); | |
| 672 | + plazosConcat = plazosConcat.substring(0, plazosConcat.length - 2); | |
| 673 | + cabecera = $filter('rellenarDigitos')($scope.idLista, 4) + | |
| 674 | + ' - ' + precioCondicion.listaPrecio.DES + | |
| 675 | + ' ' + plazosConcat.trim(); | |
| 676 | + } else { //Cuando se ingresan los plazos manualmente | |
| 677 | + //-1, el modal productos busca todos los productos | |
| 678 | + $scope.idLista = -1; | |
| 679 | + $scope.notaPedido.notaPedidoPlazo = precioCondicion; | |
| 680 | + for (var j = 0; j < precioCondicion.length; j++) { | |
| 681 | + plazosConcat += precioCondicion[j].dias + ' '; | |
| 682 | + } | |
| 683 | + cabecera = 'Ingreso manual ' + plazosConcat.trim(); | |
| 684 | + } | |
| 685 | + $scope.cabeceras.push({ | |
| 686 | + label: 'Precios y Condiciones:', | |
| 687 | + valor: $scope.idLista + ' - ' + precioCondicion.listaPrecio.DES + ' ' + | |
| 688 | + notaPedidoBusinessService.plazoToString(precioCondicion.plazoPago) | |
| 689 | + }); | |
| 690 | + | |
| 691 | + $filter('filter')($scope.botonera, | |
| 692 | + { label: 'Precios y Condiciones' })[0].checked = true; | |
| 691 | 693 | |
| 692 | - $filter('filter')($scope.botonera, | |
| 693 | - { label: 'Precios y Condiciones' })[0].checked = true; | |
| 694 | - | |
| 695 | - addArrayCabecera($scope.cabeceras); | |
| 694 | + addArrayCabecera($scope.cabeceras); | |
| 696 | 695 | |
| 697 | - }) | |
| 696 | + }) | |
| 698 | 697 | .catch(function (e) { |
| 699 | 698 | console.log(e); |
| 700 | - }) | |
| 699 | + }); | |
| 701 | 700 | |
| 702 | 701 | } |
| 703 | 702 | }; |
| ... | ... | @@ -982,12 +981,14 @@ angular.module('focaCrearNotaPedido').controller('notaPedidoCtrl', |
| 982 | 981 | |
| 983 | 982 | function valorPrecioCondicion() { |
| 984 | 983 | if (notaPedido.idListaPrecio > 0) { |
| 985 | - crearNotaPedidoService.getPrecioCondicionById(parseInt(notaPedido.idListaPrecio)) | |
| 984 | + crearNotaPedidoService | |
| 985 | + .getPrecioCondicionById(parseInt(notaPedido.idListaPrecio)) | |
| 986 | 986 | .then(function (res) { |
| 987 | 987 | $scope.cabeceras.push({ |
| 988 | 988 | label: 'Precios y Condiciones:', |
| 989 | - valor: parseInt(res.data[0].ID) + ' - ' + res.data[0].DES + ' ' + | |
| 990 | - notaPedidoBusinessService | |
| 989 | + valor: parseInt(res.data[0].ID) + ' - ' + | |
| 990 | + res.data[0].DES + ' ' + | |
| 991 | + notaPedidoBusinessService | |
| 991 | 992 | .plazoToString(notaPedido.notaPedidoPlazo) |
| 992 | 993 | }); |
| 993 | 994 | addArrayCabecera($scope.cabeceras); |