Commit 6c115ee53c7628dd4740717104b41a3a164bcfff
Exists in
master
Merge branch 'master' into 'develop'
Master See merge request !115
Showing
2 changed files
Show diff stats
src/js/controller.js
| ... | ... | @@ -30,6 +30,7 @@ angular.module('focaCrearNotaPedido').controller('notaPedidoCtrl', |
| 30 | 30 | $scope.datepickerAbierto = false; |
| 31 | 31 | $scope.show = false; |
| 32 | 32 | $scope.cargando = true; |
| 33 | + $scope.cabeceras = []; | |
| 33 | 34 | $scope.botonera = crearNotaPedidoService.getBotonera(); |
| 34 | 35 | $scope.puntoVenta = $filter('rellenarDigitos')(0, 4); |
| 35 | 36 | $scope.comprobante = $filter('rellenarDigitos')(0, 8); |
| ... | ... | @@ -260,7 +261,7 @@ angular.module('focaCrearNotaPedido').controller('notaPedidoCtrl', |
| 260 | 261 | |
| 261 | 262 | $scope.seleccionarProductos = function () { |
| 262 | 263 | |
| 263 | - if ($scope.idLista === undefined) { | |
| 264 | + if ($scope.notaPedido.idListaPrecio === undefined) { | |
| 264 | 265 | focaModalService.alert('Primero seleccione una lista de precio y condición'); |
| 265 | 266 | return; |
| 266 | 267 | } else if (!validarNotaRemitada()) { |
| ... | ... | @@ -274,7 +275,7 @@ angular.module('focaCrearNotaPedido').controller('notaPedidoCtrl', |
| 274 | 275 | controller: 'modalBusquedaProductosCtrl', |
| 275 | 276 | resolve: { |
| 276 | 277 | parametroProducto: { |
| 277 | - idLista: $scope.idLista, | |
| 278 | + idLista: $scope.notaPedido.idListaPrecio, | |
| 278 | 279 | cotizacion: $scope.notaPedido.cotizacion.VENDEDOR, |
| 279 | 280 | simbolo: $scope.notaPedido.cotizacion.moneda.SIMBOLO |
| 280 | 281 | } |
| ... | ... | @@ -637,19 +638,13 @@ angular.module('focaCrearNotaPedido').controller('notaPedidoCtrl', |
| 637 | 638 | if (!$scope.notaPedido.cliente.COD) { |
| 638 | 639 | focaModalService.alert('Primero seleccione un cliente'); |
| 639 | 640 | return; |
| 640 | - } | |
| 641 | - if ($scope.notaPedido.articulosNotaPedido.length !== 0) { | |
| 642 | - focaModalService.confirm('Se perderan los productos ingresados') | |
| 643 | - .then(function (data) { | |
| 644 | - if (data) { | |
| 645 | - abrirModal(); | |
| 646 | - } | |
| 647 | - }); | |
| 648 | - } else if (validarNotaRemitada()) { | |
| 641 | + } else { | |
| 649 | 642 | abrirModal(); |
| 650 | 643 | } |
| 644 | + | |
| 651 | 645 | function abrirModal() { |
| 652 | - var parametros = { idCliente: $scope.notaPedido.cliente.COD, idListaPrecio : $scope.notaPedido.cliente.MOD}; | |
| 646 | + var parametros = { idCliente: $scope.notaPedido.cliente.COD, idListaPrecio : $scope.notaPedido.cliente.MOD, | |
| 647 | + notaPedido: $scope.notaPedido }; | |
| 653 | 648 | var modalInstance = $uibModal.open( |
| 654 | 649 | { |
| 655 | 650 | ariaLabelledBy: 'Busqueda de Precio Condición', |
| ... | ... | @@ -689,14 +684,17 @@ angular.module('focaCrearNotaPedido').controller('notaPedidoCtrl', |
| 689 | 684 | } |
| 690 | 685 | cabecera = 'Ingreso manual ' + plazosConcat.trim(); |
| 691 | 686 | } |
| 692 | - $scope.notaPedido.articulosNotaPedido = []; | |
| 693 | - $scope.$broadcast('addCabecera', { | |
| 694 | - label: 'Precios y condiciones:', | |
| 695 | - valor: cabecera | |
| 696 | - }); | |
| 687 | + | |
| 688 | + $filter('filter')($scope.cabeceras, | |
| 689 | + { label: 'Precios y Condiciones' })[0].valor = cabecera; | |
| 690 | + | |
| 691 | + $scope.notaPedido.precioCondicion = precioCondicion; | |
| 697 | 692 | |
| 698 | 693 | $filter('filter')($scope.botonera, |
| 699 | 694 | { label: 'Precios y Condiciones' })[0].checked = true; |
| 695 | + | |
| 696 | + addArrayCabecera($scope.cabeceras); | |
| 697 | + | |
| 700 | 698 | }) |
| 701 | 699 | .catch(function (e) { |
| 702 | 700 | console.log(e); |
| ... | ... | @@ -915,19 +913,19 @@ angular.module('focaCrearNotaPedido').controller('notaPedidoCtrl', |
| 915 | 913 | $scope.$broadcast('removeCabecera', 'Kilometros:'); |
| 916 | 914 | $scope.$broadcast('cleanCabecera'); |
| 917 | 915 | |
| 918 | - var cabeceras = []; | |
| 916 | + $scope.cabeceras = []; | |
| 919 | 917 | |
| 920 | 918 | if (notaPedido.cotizacion.moneda.CODIGO_AFIP !== 'PES') { |
| 921 | - cabeceras.push({ | |
| 919 | + $scope.cabeceras.push({ | |
| 922 | 920 | label: 'Moneda:', |
| 923 | 921 | valor: notaPedido.cotizacion.moneda.DETALLE |
| 924 | 922 | }); |
| 925 | - cabeceras.push({ | |
| 923 | + $scope.cabeceras.push({ | |
| 926 | 924 | label: 'Fecha cotizacion:', |
| 927 | 925 | valor: $filter('date')(notaPedido.cotizacion.FECHA, |
| 928 | 926 | 'dd/MM/yyyy') |
| 929 | 927 | }); |
| 930 | - cabeceras.push({ | |
| 928 | + $scope.cabeceras.push({ | |
| 931 | 929 | label: 'Cotizacion:', |
| 932 | 930 | valor: $filter('number')(notaPedido.cotizacion.VENDEDOR, |
| 933 | 931 | '2') |
| ... | ... | @@ -939,7 +937,7 @@ angular.module('focaCrearNotaPedido').controller('notaPedidoCtrl', |
| 939 | 937 | } |
| 940 | 938 | |
| 941 | 939 | if (notaPedido.vendedor.NUM) { |
| 942 | - cabeceras.push({ | |
| 940 | + $scope.cabeceras.push({ | |
| 943 | 941 | label: 'Vendedor:', |
| 944 | 942 | valor: $filter('rellenarDigitos')(notaPedido.vendedor.NUM, 3) + |
| 945 | 943 | ' - ' + notaPedido.vendedor.NOM |
| ... | ... | @@ -947,11 +945,11 @@ angular.module('focaCrearNotaPedido').controller('notaPedidoCtrl', |
| 947 | 945 | } |
| 948 | 946 | |
| 949 | 947 | if (notaPedido.cliente.COD) { |
| 950 | - cabeceras.push({ | |
| 948 | + $scope.cabeceras.push({ | |
| 951 | 949 | label: 'Cliente:', |
| 952 | 950 | valor: notaPedido.cliente.NOM |
| 953 | 951 | }); |
| 954 | - cabeceras.push({ | |
| 952 | + $scope.cabeceras.push({ | |
| 955 | 953 | label: 'Domicilio:', |
| 956 | 954 | valor: notaPedido.domicilioStamp |
| 957 | 955 | }); |
| ... | ... | @@ -960,7 +958,7 @@ angular.module('focaCrearNotaPedido').controller('notaPedidoCtrl', |
| 960 | 958 | } |
| 961 | 959 | |
| 962 | 960 | if (notaPedido.proveedor.COD) { |
| 963 | - cabeceras.push({ | |
| 961 | + $scope.cabeceras.push({ | |
| 964 | 962 | label: 'Proveedor:', |
| 965 | 963 | valor: $filter('rellenarDigitos')(notaPedido.proveedor.COD, 5) + |
| 966 | 964 | ' - ' + notaPedido.proveedor.NOM |
| ... | ... | @@ -970,19 +968,13 @@ angular.module('focaCrearNotaPedido').controller('notaPedidoCtrl', |
| 970 | 968 | } |
| 971 | 969 | |
| 972 | 970 | if (notaPedido.notaPedidoPlazo.length) { |
| 973 | - cabeceras.push({ | |
| 974 | - label: 'Precios y condiciones:', | |
| 975 | - valor: valorPrecioCondicion() + ' ' + | |
| 976 | - notaPedidoBusinessService | |
| 977 | - .plazoToString(notaPedido.notaPedidoPlazo) | |
| 978 | - }); | |
| 979 | - | |
| 971 | + valorPrecioCondicion(); | |
| 980 | 972 | $filter('filter')($scope.botonera, |
| 981 | 973 | { label: 'Precios y condiciones' })[0].checked = true; |
| 982 | 974 | } |
| 983 | 975 | |
| 984 | 976 | if (notaPedido.flete !== undefined) { |
| 985 | - cabeceras.push({ | |
| 977 | + $scope.cabeceras.push({ | |
| 986 | 978 | label: 'Flete:', |
| 987 | 979 | valor: notaPedido.fob === 1 ? 'FOB' : ( |
| 988 | 980 | notaPedido.flete === 1 ? 'Si' : 'No') |
| ... | ... | @@ -990,10 +982,17 @@ angular.module('focaCrearNotaPedido').controller('notaPedidoCtrl', |
| 990 | 982 | } |
| 991 | 983 | |
| 992 | 984 | function valorPrecioCondicion() { |
| 993 | - if (notaPedido.idPrecioCondicion > 0) { | |
| 994 | - return notaPedido.precioCondicion.nombre; | |
| 995 | - } else { | |
| 996 | - return 'Ingreso Manual'; | |
| 985 | + if (notaPedido.idListaPrecio > 0) { | |
| 986 | + crearNotaPedidoService.getPrecioCondicionById(parseInt(notaPedido.idListaPrecio)) | |
| 987 | + .then(function (res) { | |
| 988 | + $scope.cabeceras.push({ | |
| 989 | + label: 'Precios y Condiciones:', | |
| 990 | + valor: parseInt(res.data[0].ID) + ' - ' + res.data[0].DES + ' ' + | |
| 991 | + notaPedidoBusinessService | |
| 992 | + .plazoToString(notaPedido.notaPedidoPlazo) | |
| 993 | + }); | |
| 994 | + addArrayCabecera($scope.cabeceras); | |
| 995 | + }); | |
| 997 | 996 | } |
| 998 | 997 | } |
| 999 | 998 | |
| ... | ... | @@ -1007,9 +1006,9 @@ angular.module('focaCrearNotaPedido').controller('notaPedidoCtrl', |
| 1007 | 1006 | label: 'Kilometros:', |
| 1008 | 1007 | valor: notaPedido.kilometros |
| 1009 | 1008 | }; |
| 1010 | - cabeceras.push(cabeceraKilometros); | |
| 1009 | + $scope.cabeceras.push(cabeceraKilometros); | |
| 1011 | 1010 | } |
| 1012 | - cabeceras.push(cabeceraBomba); | |
| 1011 | + $scope.cabeceras.push(cabeceraBomba); | |
| 1013 | 1012 | } |
| 1014 | 1013 | |
| 1015 | 1014 | if (notaPedido.idPrecioCondicion > 0) { |
| ... | ... | @@ -1031,13 +1030,13 @@ angular.module('focaCrearNotaPedido').controller('notaPedidoCtrl', |
| 1031 | 1030 | notaPedido.notaPedidoPuntoDescarga.forEach(function (notaPedidoPuntoDescarga) { |
| 1032 | 1031 | puntos.push(notaPedidoPuntoDescarga.puntoDescarga); |
| 1033 | 1032 | }); |
| 1034 | - cabeceras.push({ | |
| 1033 | + $scope.cabeceras.push({ | |
| 1035 | 1034 | label: 'Puntos de descarga: ', |
| 1036 | 1035 | valor: $filter('rellenarDigitos')(getCabeceraPuntoDescarga(puntos)) |
| 1037 | 1036 | }); |
| 1038 | 1037 | } |
| 1039 | 1038 | |
| 1040 | - addArrayCabecera(cabeceras); | |
| 1039 | + addArrayCabecera($scope.cabeceras); | |
| 1041 | 1040 | } |
| 1042 | 1041 | |
| 1043 | 1042 | function getCabeceraPuntoDescarga(puntoDescarga) { |
src/js/service.js
| ... | ... | @@ -35,7 +35,7 @@ angular.module('focaCrearNotaPedido') |
| 35 | 35 | return $http.get(route + '/precio-condicion'); |
| 36 | 36 | }, |
| 37 | 37 | getPrecioCondicionById: function(id) { |
| 38 | - return $http.get(route + '/precio-condicion/' + id); | |
| 38 | + return $http.get(route + '/lista-precio/' + id); | |
| 39 | 39 | }, |
| 40 | 40 | getPlazoPagoByPrecioCondicion: function(id) { |
| 41 | 41 | return $http.get(route + '/plazo-pago/precio-condicion/'+ id); |