Commit 3b1d2ee778863e434fe7f75927d160a9bb8e761c
Exists in
master
Merge branch 'master' into 'develop'
Master(mpuebla) See merge request !116
Showing
2 changed files
Show diff stats
src/js/controller.js
... | ... | @@ -160,14 +160,14 @@ angular.module('focaCrearRemito').controller('remitoController', |
160 | 160 | notaPedido.vendedor.NUM, 3 |
161 | 161 | ) + ' - ' + notaPedido.vendedor.NOM |
162 | 162 | }, |
163 | - | |
163 | + | |
164 | 164 | { |
165 | 165 | label: 'Proveedor:', |
166 | 166 | valor: $filter('rellenarDigitos') |
167 | 167 | (notaPedido.proveedor.COD, 5) + ' - ' + |
168 | 168 | notaPedido.proveedor.NOM |
169 | 169 | }, |
170 | - | |
170 | + | |
171 | 171 | { |
172 | 172 | label: 'Flete:', |
173 | 173 | valor: notaPedido.fob === 1 ? 'FOB' : ( |
... | ... | @@ -206,9 +206,10 @@ angular.module('focaCrearRemito').controller('remitoController', |
206 | 206 | .then(function (res) { |
207 | 207 | $scope.cabeceras.push({ |
208 | 208 | label: 'Precios y Condiciones:', |
209 | - valor: parseInt(res.data[0].ID) + ' - ' + | |
210 | - res.data[0].DES + ' ' + | |
211 | - remitoBusinessService | |
209 | + valor: | |
210 | + parseInt(res.data[0].ID) + ' - ' + | |
211 | + res.data[0].DES + ' ' + | |
212 | + remitoBusinessService | |
212 | 213 | .plazoToString(notaPedido.notaPedidoPlazo) |
213 | 214 | }); |
214 | 215 | addArrayCabecera($scope.cabeceras); |
... | ... | @@ -281,7 +282,7 @@ angular.module('focaCrearRemito').controller('remitoController', |
281 | 282 | resolve: { usadoPor: function () { return 'remito'; } } |
282 | 283 | } |
283 | 284 | ); |
284 | - modalInstance.result.then(function(remito) { | |
285 | + modalInstance.result.then(function (remito) { | |
285 | 286 | |
286 | 287 | remito.articulosRemito.forEach(function (articulo) { |
287 | 288 | articulo.precio = |
... | ... | @@ -291,12 +292,13 @@ angular.module('focaCrearRemito').controller('remitoController', |
291 | 292 | setearRemito(remito); |
292 | 293 | |
293 | 294 | }, function () { |
294 | - // funcion ejecutada cuando se cancela el modal | |
295 | - } | |
295 | + // funcion ejecutada cuando se cancela el modal | |
296 | + } | |
296 | 297 | ); |
297 | 298 | }; |
298 | 299 | //validacion por domicilio y por plazo pago |
299 | 300 | $scope.crearRemito = function () { |
301 | + varlidarRemitoFacturado(); | |
300 | 302 | if (!$scope.remito.vendedor.NUM) { |
301 | 303 | focaModalService.alert('Ingrese Vendedor'); |
302 | 304 | return; |
... | ... | @@ -366,7 +368,7 @@ angular.module('focaCrearRemito').controller('remitoController', |
366 | 368 | e_hd: '',//TODO |
367 | 369 | c_hd: '', |
368 | 370 | numeroLiquidoProducto: 0,//TODO |
369 | - estado: 0, | |
371 | + estado: $scope.remito.estado, | |
370 | 372 | destinoVenta: 0,//TODO |
371 | 373 | operacionTipo: 0, //TODO |
372 | 374 | }, |
... | ... | @@ -391,7 +393,7 @@ angular.module('focaCrearRemito').controller('remitoController', |
391 | 393 | } |
392 | 394 | |
393 | 395 | // TODO: updatear plazos |
394 | - if ($scope.remito.id == 0) { | |
396 | + if ($scope.remito.id === 0) { | |
395 | 397 | |
396 | 398 | remitoBusinessService.addArticulos($scope.remito.articulosRemito, |
397 | 399 | data.data.id, $scope.remito.cotizacion.VENDEDOR); |
... | ... | @@ -424,10 +426,11 @@ angular.module('focaCrearRemito').controller('remitoController', |
424 | 426 | } |
425 | 427 | ); |
426 | 428 | }; |
427 | - | |
429 | + | |
428 | 430 | $scope.seleccionarProductos = function () { |
431 | + varlidarRemitoFacturado(); | |
429 | 432 | if ($scope.notaPedido.id !== 0) { |
430 | - $scope.idLista = parseInt($scope.notaPedido.idListaPrecio) | |
433 | + $scope.idLista = parseInt($scope.notaPedido.idListaPrecio); | |
431 | 434 | } |
432 | 435 | if ($scope.idLista === undefined) { |
433 | 436 | focaModalService.alert( |
... | ... | @@ -625,8 +628,10 @@ angular.module('focaCrearRemito').controller('remitoController', |
625 | 628 | controller: 'focaModalDomicilioController', |
626 | 629 | size: 'lg', |
627 | 630 | resolve: { |
628 | - idCliente: function () { return $scope.notaPedido.cliente ? $scope.notaPedido.cliente.COD : | |
629 | - cliente.cod; }, | |
631 | + idCliente: function () { | |
632 | + return $scope.notaPedido.cliente ? $scope.notaPedido.cliente.COD : | |
633 | + cliente.cod; | |
634 | + }, | |
630 | 635 | esNuevo: function () { return cliente.esNuevo; } |
631 | 636 | } |
632 | 637 | } |
... | ... | @@ -720,10 +725,12 @@ angular.module('focaCrearRemito').controller('remitoController', |
720 | 725 | } else { |
721 | 726 | abrirModal(); |
722 | 727 | } |
723 | - | |
728 | + | |
724 | 729 | function abrirModal() { |
725 | - var parametros = { idCliente: $scope.remito.cliente.COD, idListaPrecio : $scope.remito.cliente.MOD, | |
726 | - remito: $scope.remito }; | |
730 | + var parametros = { | |
731 | + idCliente: $scope.remito.cliente.COD, | |
732 | + idListaPrecio: $scope.remito.cliente.MOD | |
733 | + }; | |
727 | 734 | var modalInstance = $uibModal.open( |
728 | 735 | { |
729 | 736 | ariaLabelledBy: 'Busqueda de Precio Condiciรณn', |
... | ... | @@ -749,8 +756,10 @@ angular.module('focaCrearRemito').controller('remitoController', |
749 | 756 | plazosConcat += precioCondicion.plazoPago[i].dias + ', '; |
750 | 757 | } |
751 | 758 | plazosConcat = plazosConcat.substring(0, plazosConcat.length - 2); |
752 | - cabecera = $filter('rellenarDigitos')(parseInt(precioCondicion.listaPrecio.ID), 4) + | |
753 | - ' - ' + precioCondicion.listaPrecio.DES + ' ' + plazosConcat.trim(); | |
759 | + cabecera = $filter('rellenarDigitos') | |
760 | + (parseInt(precioCondicion.listaPrecio.ID), 4) + | |
761 | + ' - ' + precioCondicion.listaPrecio.DES + ' ' + | |
762 | + plazosConcat.trim(); | |
754 | 763 | } else { //Cuando se ingresan los plazos manualmente |
755 | 764 | $scope.remito.idPrecioCondicion = 0; |
756 | 765 | //-1, el modal productos busca todos los productos |
... | ... | @@ -767,14 +776,15 @@ angular.module('focaCrearRemito').controller('remitoController', |
767 | 776 | $scope.cabeceras.push({ |
768 | 777 | label: 'Precios y Condiciones:', |
769 | 778 | valor: parseInt(precioCondicion.listaPrecio.ID) + ' - ' + |
770 | - precioCondicion.listaPrecio.DES + ' ' + remitoBusinessService.plazoToString(precioCondicion.plazoPago) | |
779 | + precioCondicion.listaPrecio.DES + ' ' + | |
780 | + remitoBusinessService.plazoToString(precioCondicion.plazoPago) | |
771 | 781 | }); |
772 | 782 | $scope.remito.idListaPrecio = parseInt(precioCondicion.listaPrecio.ID); |
773 | 783 | |
774 | 784 | } |
775 | 785 | $filter('filter')($scope.cabeceras, |
776 | 786 | { label: 'Precios y Condiciones' })[0].valor = cabecera; |
777 | - | |
787 | + | |
778 | 788 | $scope.remito.precioCondicion = precioCondicion; |
779 | 789 | $filter('filter')($scope.botonera, |
780 | 790 | { label: 'Precios y Condiciones' })[0].checked = true; |
... | ... | @@ -996,7 +1006,7 @@ angular.module('focaCrearRemito').controller('remitoController', |
996 | 1006 | if (!articulo.cantidad || !articulo.precio || !tmpCantidad || !tmpPrecio) { |
997 | 1007 | focaModalService.alert('Los valores deben ser al menos 1'); |
998 | 1008 | return; |
999 | - } else if (tmpCantidad === "0" || tmpPrecio === "0") { | |
1009 | + } else if (tmpCantidad === '0' || tmpPrecio === '0') { | |
1000 | 1010 | focaModalService.alert('Esta ingresando un producto con valor 0'); |
1001 | 1011 | } else if (articulo.cantidad < 0 || articulo.precio < 0) { |
1002 | 1012 | focaModalService.alert('Los valores no pueden ser negativos'); |
... | ... | @@ -1101,8 +1111,8 @@ angular.module('focaCrearRemito').controller('remitoController', |
1101 | 1111 | //aรฑado cabeceras |
1102 | 1112 | if (remito.estado !== 5 && remito.id) { |
1103 | 1113 | |
1104 | - $scope.botonera.forEach(function(boton) { | |
1105 | - | |
1114 | + $scope.botonera.forEach(function (boton) { | |
1115 | + | |
1106 | 1116 | if (boton.label === 'Eliminar Remito') { |
1107 | 1117 | boton.disable = false; |
1108 | 1118 | } |
... | ... | @@ -1185,13 +1195,14 @@ angular.module('focaCrearRemito').controller('remitoController', |
1185 | 1195 | $timeout(function () { |
1186 | 1196 | $scope.cabeceras.push({ |
1187 | 1197 | label: 'Precios y Condiciones:', |
1188 | - valor: parseInt(res.data[0].ID) + ' - ' + res.data[0].DES + ' ' + | |
1189 | - remitoBusinessService | |
1198 | + valor: parseInt(res.data[0].ID) + ' - ' + | |
1199 | + res.data[0].DES + ' ' + | |
1200 | + remitoBusinessService | |
1190 | 1201 | .plazoToString(remito.remitoPlazo) |
1191 | 1202 | }); |
1192 | 1203 | addArrayCabecera($scope.cabeceras); |
1193 | - },true); | |
1194 | - | |
1204 | + }, true); | |
1205 | + | |
1195 | 1206 | }); |
1196 | 1207 | $scope.idLista = parseInt(remito.idListaPrecio); |
1197 | 1208 | } |
src/views/remito.html
... | ... | @@ -68,7 +68,7 @@ |
68 | 68 | ></td> |
69 | 69 | <td class="col text-right"> |
70 | 70 | <input |
71 | - ng-show="articulo.editCantidad" | |
71 | + ng-show="articulo.editCantidad && remito.estado !== 5" | |
72 | 72 | ng-model="tmpCantidad" |
73 | 73 | class="form-control" |
74 | 74 | foca-tipo-input |
... | ... | @@ -82,13 +82,13 @@ |
82 | 82 | <i |
83 | 83 | class="selectable" |
84 | 84 | ng-click="cambioEdit(articulo, 'cantidad')" |
85 | - ng-hide="articulo.editCantidad" | |
85 | + ng-hide="articulo.editCantidad && remito.estado !== 5" | |
86 | 86 | ng-bind="articulo.cantidad"> |
87 | 87 | </i> |
88 | 88 | </td> |
89 | 89 | <td class="col text-right"> |
90 | 90 | <input |
91 | - ng-show="articulo.editPrecio" | |
91 | + ng-show="articulo.editPrecio && remito.estado !== 5" | |
92 | 92 | ng-model="tmpPrecio" |
93 | 93 | class="form-control" |
94 | 94 | foca-tipo-input |
... | ... | @@ -105,7 +105,7 @@ |
105 | 105 | <i |
106 | 106 | class="selectable" |
107 | 107 | ng-click="cambioEdit(articulo, 'precio')" |
108 | - ng-hide="articulo.editPrecio" | |
108 | + ng-hide="articulo.editPrecio && remito.estado !== 5" | |
109 | 109 | ng-bind="articulo.precio | number: 4"> |
110 | 110 | </i> |
111 | 111 | </td> |
... | ... | @@ -115,12 +115,14 @@ |
115 | 115 | </td> |
116 | 116 | <td class="text-center"> |
117 | 117 | <button |
118 | + ng-show="remito.estado !== 5" | |
118 | 119 | class="btn btn-outline-light" |
119 | 120 | ng-click="quitarArticulo(articulo)" |
120 | - > | |
121 | + > | |
121 | 122 | <i class="fa fa-trash"></i> |
122 | 123 | </button> |
123 | 124 | <button |
125 | + ng-show="remito.estado !== 5" | |
124 | 126 | class="btn btn-outline-light" |
125 | 127 | ng-click="editarArticulo(13, articulo, tmpCantidad, tmpPrecio);" |
126 | 128 | ng-show="articulo.editCantidad || articulo.editPrecio" |