Commit 28575156afc70efe74467049ce781dcf692540f2
1 parent
9231617cb2
Exists in
master
Arreglo en el manejo de un remito que ya ha sido facturado.
Showing
2 changed files
with
46 additions
and
31 deletions
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' : ( |
| ... | ... | @@ -201,12 +201,15 @@ angular.module('focaCrearRemito').controller('remitoController', |
| 201 | 201 | |
| 202 | 202 | function valorPrecioCondicion() { |
| 203 | 203 | if (parseInt(notaPedido.idListaPrecio) > 0) { |
| 204 | - crearRemitoService.getListaPrecioById(parseInt(notaPedido.idListaPrecio)) | |
| 204 | + crearRemitoService | |
| 205 | + .getListaPrecioById(parseInt(notaPedido.idListaPrecio)) | |
| 205 | 206 | .then(function (res) { |
| 206 | 207 | $scope.cabeceras.push({ |
| 207 | 208 | label: 'Precios y Condiciones:', |
| 208 | - valor: parseInt(res.data[0].ID) + ' - ' + res.data[0].DES + ' ' + | |
| 209 | - remitoBusinessService | |
| 209 | + valor: | |
| 210 | + parseInt(res.data[0].ID) + ' - ' + | |
| 211 | + res.data[0].DES + ' ' + | |
| 212 | + remitoBusinessService | |
| 210 | 213 | .plazoToString(notaPedido.notaPedidoPlazo) |
| 211 | 214 | }); |
| 212 | 215 | addArrayCabecera($scope.cabeceras); |
| ... | ... | @@ -279,7 +282,7 @@ angular.module('focaCrearRemito').controller('remitoController', |
| 279 | 282 | resolve: { usadoPor: function () { return 'remito'; } } |
| 280 | 283 | } |
| 281 | 284 | ); |
| 282 | - modalInstance.result.then(function(remito) { | |
| 285 | + modalInstance.result.then(function (remito) { | |
| 283 | 286 | |
| 284 | 287 | remito.articulosRemito.forEach(function (articulo) { |
| 285 | 288 | articulo.precio = |
| ... | ... | @@ -289,12 +292,13 @@ angular.module('focaCrearRemito').controller('remitoController', |
| 289 | 292 | setearRemito(remito); |
| 290 | 293 | |
| 291 | 294 | }, function () { |
| 292 | - // funcion ejecutada cuando se cancela el modal | |
| 293 | - } | |
| 295 | + // funcion ejecutada cuando se cancela el modal | |
| 296 | + } | |
| 294 | 297 | ); |
| 295 | 298 | }; |
| 296 | 299 | //validacion por domicilio y por plazo pago |
| 297 | 300 | $scope.crearRemito = function () { |
| 301 | + varlidarRemitoFacturado(); | |
| 298 | 302 | if (!$scope.remito.vendedor.NUM) { |
| 299 | 303 | focaModalService.alert('Ingrese Vendedor'); |
| 300 | 304 | return; |
| ... | ... | @@ -364,7 +368,7 @@ angular.module('focaCrearRemito').controller('remitoController', |
| 364 | 368 | e_hd: '',//TODO |
| 365 | 369 | c_hd: '', |
| 366 | 370 | numeroLiquidoProducto: 0,//TODO |
| 367 | - estado: 0, | |
| 371 | + estado: $scope.remito.estado, | |
| 368 | 372 | destinoVenta: 0,//TODO |
| 369 | 373 | operacionTipo: 0, //TODO |
| 370 | 374 | }, |
| ... | ... | @@ -389,7 +393,7 @@ angular.module('focaCrearRemito').controller('remitoController', |
| 389 | 393 | } |
| 390 | 394 | |
| 391 | 395 | // TODO: updatear plazos |
| 392 | - if ($scope.remito.id == 0) { | |
| 396 | + if ($scope.remito.id === 0) { | |
| 393 | 397 | |
| 394 | 398 | remitoBusinessService.addArticulos($scope.remito.articulosRemito, |
| 395 | 399 | data.data.id, $scope.remito.cotizacion.VENDEDOR); |
| ... | ... | @@ -422,10 +426,11 @@ angular.module('focaCrearRemito').controller('remitoController', |
| 422 | 426 | } |
| 423 | 427 | ); |
| 424 | 428 | }; |
| 425 | - | |
| 429 | + | |
| 426 | 430 | $scope.seleccionarProductos = function () { |
| 431 | + varlidarRemitoFacturado(); | |
| 427 | 432 | if ($scope.notaPedido.id !== 0) { |
| 428 | - $scope.idLista = parseInt($scope.notaPedido.idListaPrecio) | |
| 433 | + $scope.idLista = parseInt($scope.notaPedido.idListaPrecio); | |
| 429 | 434 | } |
| 430 | 435 | if ($scope.remito.idListaPrecio === undefined) { |
| 431 | 436 | focaModalService.alert( |
| ... | ... | @@ -623,8 +628,10 @@ angular.module('focaCrearRemito').controller('remitoController', |
| 623 | 628 | controller: 'focaModalDomicilioController', |
| 624 | 629 | size: 'lg', |
| 625 | 630 | resolve: { |
| 626 | - idCliente: function () { return $scope.notaPedido.cliente ? $scope.notaPedido.cliente.COD : | |
| 627 | - cliente.cod; }, | |
| 631 | + idCliente: function () { | |
| 632 | + return $scope.notaPedido.cliente ? $scope.notaPedido.cliente.COD : | |
| 633 | + cliente.cod; | |
| 634 | + }, | |
| 628 | 635 | esNuevo: function () { return cliente.esNuevo; } |
| 629 | 636 | } |
| 630 | 637 | } |
| ... | ... | @@ -718,9 +725,12 @@ angular.module('focaCrearRemito').controller('remitoController', |
| 718 | 725 | } else { |
| 719 | 726 | abrirModal(); |
| 720 | 727 | } |
| 721 | - | |
| 728 | + | |
| 722 | 729 | function abrirModal() { |
| 723 | - var parametros = { idCliente: $scope.remito.cliente.COD, idListaPrecio : $scope.remito.cliente.MOD}; | |
| 730 | + var parametros = { | |
| 731 | + idCliente: $scope.remito.cliente.COD, | |
| 732 | + idListaPrecio: $scope.remito.cliente.MOD | |
| 733 | + }; | |
| 724 | 734 | var modalInstance = $uibModal.open( |
| 725 | 735 | { |
| 726 | 736 | ariaLabelledBy: 'Busqueda de Precio Condiciรณn', |
| ... | ... | @@ -746,8 +756,10 @@ angular.module('focaCrearRemito').controller('remitoController', |
| 746 | 756 | plazosConcat += precioCondicion.plazoPago[i].dias + ', '; |
| 747 | 757 | } |
| 748 | 758 | plazosConcat = plazosConcat.substring(0, plazosConcat.length - 2); |
| 749 | - cabecera = $filter('rellenarDigitos')(parseInt(precioCondicion.listaPrecio.ID), 4) + | |
| 750 | - ' - ' + precioCondicion.listaPrecio.DES + ' ' + plazosConcat.trim(); | |
| 759 | + cabecera = $filter('rellenarDigitos') | |
| 760 | + (parseInt(precioCondicion.listaPrecio.ID), 4) + | |
| 761 | + ' - ' + precioCondicion.listaPrecio.DES + ' ' + | |
| 762 | + plazosConcat.trim(); | |
| 751 | 763 | } else { //Cuando se ingresan los plazos manualmente |
| 752 | 764 | $scope.remito.idPrecioCondicion = 0; |
| 753 | 765 | //-1, el modal productos busca todos los productos |
| ... | ... | @@ -761,7 +773,7 @@ angular.module('focaCrearRemito').controller('remitoController', |
| 761 | 773 | $scope.remito.articulosRemito = []; |
| 762 | 774 | $filter('filter')($scope.cabeceras, |
| 763 | 775 | { label: 'Precios y Condiciones' })[0].valor = cabecera; |
| 764 | - | |
| 776 | + | |
| 765 | 777 | $scope.remito.precioCondicion = precioCondicion; |
| 766 | 778 | |
| 767 | 779 | $filter('filter')($scope.botonera, |
| ... | ... | @@ -984,7 +996,7 @@ angular.module('focaCrearRemito').controller('remitoController', |
| 984 | 996 | if (!articulo.cantidad || !articulo.precio || !tmpCantidad || !tmpPrecio) { |
| 985 | 997 | focaModalService.alert('Los valores deben ser al menos 1'); |
| 986 | 998 | return; |
| 987 | - } else if (tmpCantidad === "0" || tmpPrecio === "0") { | |
| 999 | + } else if (tmpCantidad === '0' || tmpPrecio === '0') { | |
| 988 | 1000 | focaModalService.alert('Esta ingresando un producto con valor 0'); |
| 989 | 1001 | } else if (articulo.cantidad < 0 || articulo.precio < 0) { |
| 990 | 1002 | focaModalService.alert('Los valores no pueden ser negativos'); |
| ... | ... | @@ -1089,8 +1101,8 @@ angular.module('focaCrearRemito').controller('remitoController', |
| 1089 | 1101 | //aรฑado cabeceras |
| 1090 | 1102 | if (remito.estado !== 5 && remito.id) { |
| 1091 | 1103 | |
| 1092 | - $scope.botonera.forEach(function(boton) { | |
| 1093 | - | |
| 1104 | + $scope.botonera.forEach(function (boton) { | |
| 1105 | + | |
| 1094 | 1106 | if (boton.label === 'Eliminar Remito') { |
| 1095 | 1107 | boton.disable = false; |
| 1096 | 1108 | } |
| ... | ... | @@ -1173,13 +1185,14 @@ angular.module('focaCrearRemito').controller('remitoController', |
| 1173 | 1185 | $timeout(function () { |
| 1174 | 1186 | $scope.cabeceras.push({ |
| 1175 | 1187 | label: 'Precios y Condiciones:', |
| 1176 | - valor: parseInt(res.data[0].ID) + ' - ' + res.data[0].DES + ' ' + | |
| 1177 | - remitoBusinessService | |
| 1188 | + valor: parseInt(res.data[0].ID) + ' - ' + | |
| 1189 | + res.data[0].DES + ' ' + | |
| 1190 | + remitoBusinessService | |
| 1178 | 1191 | .plazoToString(remito.remitoPlazo) |
| 1179 | 1192 | }); |
| 1180 | 1193 | addArrayCabecera($scope.cabeceras); |
| 1181 | - },true); | |
| 1182 | - | |
| 1194 | + }, true); | |
| 1195 | + | |
| 1183 | 1196 | }); |
| 1184 | 1197 | } |
| 1185 | 1198 | } |
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" |