Commit 977cd9c32a104c1ef543cb44863b17a2d4be25d8
Exists in
master
Merge branch 'develop' of http://git.focasoftware.com/npm/foca-crear-remito
Showing
3 changed files
Show diff stats
src/js/controller.js
| ... | ... | @@ -531,14 +531,30 @@ angular.module('focaCrearRemito').controller('remitoController', |
| 531 | 531 | templateUrl: 'foca-busqueda-cliente-modal.html', |
| 532 | 532 | controller: 'focaBusquedaClienteModalController', |
| 533 | 533 | resolve: { |
| 534 | - vendedor: function () { return null; }, | |
| 535 | - cobrador: function () { return null; } | |
| 534 | + parametros: function () { | |
| 535 | + return { | |
| 536 | + vendedor: $scope.idVendedor, | |
| 537 | + cobrador: null, | |
| 538 | + searchText: $scope.cliente ? $scope.cliente.nom : '' | |
| 539 | + }; | |
| 540 | + }, | |
| 536 | 541 | }, |
| 537 | 542 | size: 'lg' |
| 538 | 543 | } |
| 539 | 544 | ); |
| 540 | 545 | modalInstance.result.then( |
| 541 | 546 | function (cliente) { |
| 547 | + | |
| 548 | + if (angular.equals({}, cliente.vendedor)) { | |
| 549 | + | |
| 550 | + focaModalService | |
| 551 | + .alert('El cliente seleccionado no tiene tiene ' + | |
| 552 | + 'vendedor asignado.') | |
| 553 | + .then($scope.seleccionarCliente); | |
| 554 | + | |
| 555 | + return; | |
| 556 | + } | |
| 557 | + | |
| 542 | 558 | $scope.cliente = cliente; |
| 543 | 559 | $scope.abrirModalDomicilios(cliente); |
| 544 | 560 | }, function () { |
| ... | ... | @@ -620,7 +636,7 @@ angular.module('focaCrearRemito').controller('remitoController', |
| 620 | 636 | resolve: { |
| 621 | 637 | idCliente: function () { |
| 622 | 638 | return $scope.remito.cliente.COD ? $scope.remito.cliente.COD : |
| 623 | - cliente.cod; | |
| 639 | + cliente.COD; | |
| 624 | 640 | }, |
| 625 | 641 | esNuevo: function () { |
| 626 | 642 | return ($scope.remito.cliente.COD ? false : cliente.esNuevo); |
| ... | ... | @@ -631,62 +647,50 @@ angular.module('focaCrearRemito').controller('remitoController', |
| 631 | 647 | modalInstanceDomicilio.result |
| 632 | 648 | .then(function (domicilio) { |
| 633 | 649 | $scope.remito.domicilio = domicilio; |
| 634 | - if (!$scope.remito.cliente.COD) { | |
| 635 | - $scope.remito.cliente = { | |
| 636 | - COD: cliente.cod, | |
| 637 | - CUIT: cliente.cuit, | |
| 638 | - NOM: cliente.nom, | |
| 639 | - MAIL: cliente.mail, | |
| 640 | - MOD: cliente.mod, | |
| 641 | - IVA: cliente.iva, | |
| 642 | - VEN: cliente.ven | |
| 643 | - }; | |
| 644 | - } | |
| 645 | - crearRemitoService.getVendedorById($scope.remito.cliente.VEN) | |
| 646 | - .then(function (res) { | |
| 647 | - if (res.data !== '') { | |
| 648 | - $scope.remito.vendedor = res.data; | |
| 649 | - $scope.$broadcast('addCabecera', { | |
| 650 | - label: 'Vendedor:', | |
| 651 | - valor: $filter('rellenarDigitos')($scope.remito.vendedor | |
| 652 | - .NUM, 3) + ' - ' + $scope.remito.vendedor.NOM | |
| 653 | - }); | |
| 654 | - } | |
| 655 | - var domicilioStamp = | |
| 656 | - domicilio.Calle + ' ' + domicilio.Numero + ', ' + | |
| 657 | - domicilio.Localidad + ', ' + domicilio.Provincia; | |
| 658 | - $scope.remito.domicilioStamp = domicilioStamp; | |
| 659 | - $scope.$broadcast('addCabecera', { | |
| 660 | - label: 'Cliente:', | |
| 661 | - valor: $filter('rellenarDigitos') | |
| 662 | - ($scope.remito.cliente.COD, 3) + | |
| 663 | - ' - ' + $scope.remito.cliente.NOM | |
| 664 | - }); | |
| 665 | - $scope.$broadcast('addCabecera', { | |
| 666 | - label: 'Domicilio:', | |
| 667 | - valor: domicilioStamp | |
| 650 | + $scope.remito.cliente = cliente; | |
| 651 | + $scope.remito.vendedor = cliente.vendedor; | |
| 652 | + | |
| 653 | + var domicilioStamp = | |
| 654 | + domicilio.Calle + ' ' + domicilio.Numero + ', ' + | |
| 655 | + domicilio.Localidad + ', ' + domicilio.Provincia; | |
| 656 | + | |
| 657 | + $scope.remito.domicilioStamp = domicilioStamp; | |
| 658 | + | |
| 659 | + $scope.$broadcast('addCabecera', { | |
| 660 | + label: 'Vendedor:', | |
| 661 | + valor: $filter('rellenarDigitos')($scope.remito.vendedor | |
| 662 | + .NUM, 3) + ' - ' + $scope.remito.vendedor.NOM | |
| 663 | + }); | |
| 664 | + $scope.$broadcast('addCabecera', { | |
| 665 | + label: 'Cliente:', | |
| 666 | + valor: $filter('rellenarDigitos') | |
| 667 | + ($scope.remito.cliente.COD, 3) + | |
| 668 | + ' - ' + $scope.remito.cliente.NOM | |
| 669 | + }); | |
| 670 | + $scope.$broadcast('addCabecera', { | |
| 671 | + label: 'Domicilio:', | |
| 672 | + valor: domicilioStamp | |
| 673 | + }); | |
| 674 | + | |
| 675 | + if (domicilio.verPuntos) { | |
| 676 | + delete $scope.remito.domicilio.verPuntos; | |
| 677 | + $scope.seleccionarPuntosDeDescarga(); | |
| 678 | + } else { | |
| 679 | + crearRemitoService | |
| 680 | + .getPuntosDescargaByClienDom(domicilio.id, | |
| 681 | + $scope.remito.cliente.COD) | |
| 682 | + .then(function (res) { | |
| 683 | + if (res.data.length) { | |
| 684 | + $scope.seleccionarPuntosDeDescarga(); | |
| 685 | + } | |
| 668 | 686 | }); |
| 687 | + } | |
| 669 | 688 | |
| 670 | - if (domicilio.verPuntos) { | |
| 671 | - delete $scope.remito.domicilio.verPuntos; | |
| 672 | - $scope.seleccionarPuntosDeDescarga(); | |
| 673 | - } else { | |
| 674 | - crearRemitoService | |
| 675 | - .getPuntosDescargaByClienDom(domicilio.id, | |
| 676 | - $scope.remito.cliente.COD) | |
| 677 | - .then(function (res) { | |
| 678 | - if (res.data.length) { | |
| 679 | - $scope.seleccionarPuntosDeDescarga(); | |
| 680 | - } | |
| 681 | - }); | |
| 682 | - } | |
| 689 | + $filter('filter')($scope.botonera, | |
| 690 | + { label: 'Cliente' })[0].checked = true; | |
| 691 | + $filter('filter')($scope.botonera, | |
| 692 | + { label: 'Domicilio de Entrega' })[0].checked = true; | |
| 683 | 693 | |
| 684 | - $filter('filter')($scope.botonera, | |
| 685 | - { label: 'Cliente' })[0].checked = true; | |
| 686 | - $filter('filter')($scope.botonera, | |
| 687 | - { label: 'Domicilio de Entrega' })[0].checked = true; | |
| 688 | - }) | |
| 689 | - .catch(function (e) { console.info(e); }); | |
| 690 | 694 | }) |
| 691 | 695 | .catch(function (e) { |
| 692 | 696 | console.info(e); |
| ... | ... | @@ -777,7 +781,9 @@ angular.module('focaCrearRemito').controller('remitoController', |
| 777 | 781 | remitoBusinessService |
| 778 | 782 | .plazoToString(precioCondicion.plazoPago) |
| 779 | 783 | }); |
| 780 | - $scope.remito.idListaPrecio = parseInt(precioCondicion.listaPrecio.ID); | |
| 784 | + | |
| 785 | + $scope.remito.idListaPrecio = parseInt( | |
| 786 | + precioCondicion.listaPrecio.ID); | |
| 781 | 787 | } |
| 782 | 788 | $filter('filter')($scope.cabeceras, |
| 783 | 789 | { label: 'Precios y Condiciones' })[0].valor = cabecera; |
src/js/service.js
| ... | ... | @@ -66,8 +66,11 @@ angular.module('focaCrearRemito') |
| 66 | 66 | crearEstadoParaRemito: function(estado) { |
| 67 | 67 | return $http.post(route + '/estado', {estado: estado}); |
| 68 | 68 | }, |
| 69 | - getNumeroRemito: function() { | |
| 70 | - return $http.get(route + '/remito/numero-siguiente'); | |
| 69 | + getNumeroRemito: function(tipoComprobante) { | |
| 70 | + | |
| 71 | + var tipo = tipoComprobante ? '/' + tipoComprobante : ''; | |
| 72 | + | |
| 73 | + return $http.get(route + '/remito/numero-siguiente' + tipo); | |
| 71 | 74 | }, |
| 72 | 75 | imprimirRemitoByIdRemito: function(idRemito) { |
| 73 | 76 | return $http.get(route + '/remito/comprobante/' + idRemito , { |
src/views/remito.html
| ... | ... | @@ -122,10 +122,10 @@ |
| 122 | 122 | <i class="fa fa-trash"></i> |
| 123 | 123 | </button> |
| 124 | 124 | <button |
| 125 | - ng-show="remito.estado !== 5 && remito.hojaRuta.abierta !== '1'" | |
| 125 | + ng-show="(articulo.editCantidad || articulo.editPrecio) && | |
| 126 | + (remito.estado !== 5 && remito.hojaRuta.abierta !== '1')" | |
| 126 | 127 | class="btn btn-outline-light" |
| 127 | 128 | ng-click="editarArticulo(13, articulo, tmpCantidad, tmpPrecio);" |
| 128 | - ng-show="articulo.editCantidad || articulo.editPrecio" | |
| 129 | 129 | > |
| 130 | 130 | <i class="fa fa-save"></i> |
| 131 | 131 | </button> |