Commit 9a56f837a0d47a7ecd31b9b169d5620e1c0aee29
Exists in
master
Merge branch 'develop' into 'master'
Develop See merge request !111
Showing
3 changed files
Show diff stats
src/js/controller.js
| ... | ... | @@ -25,7 +25,7 @@ angular.module('focaCrearRemito').controller('remitoController', |
| 25 | 25 | maxDate: new Date(), |
| 26 | 26 | minDate: new Date(2010, 0, 1) |
| 27 | 27 | }; |
| 28 | - | |
| 28 | + $scope.cabeceras = []; | |
| 29 | 29 | crearRemitoService.getParametros().then(function (res) { |
| 30 | 30 | var parametros = JSON.parse(res.data[0].jsonText); |
| 31 | 31 | if ($localStorage.remito) { |
| ... | ... | @@ -65,7 +65,6 @@ angular.module('focaCrearRemito').controller('remitoController', |
| 65 | 65 | articulosRemito: [], |
| 66 | 66 | remitoPuntoDescarga: [] |
| 67 | 67 | }; |
| 68 | - | |
| 69 | 68 | $scope.notaPedido = { |
| 70 | 69 | id: 0 |
| 71 | 70 | }; |
| ... | ... | @@ -123,14 +122,15 @@ angular.module('focaCrearRemito').controller('remitoController', |
| 123 | 122 | function (notaPedido) { |
| 124 | 123 | //añado cabeceras |
| 125 | 124 | $scope.remitoIsDirty = true; |
| 126 | - $scope.notaPedido.id = notaPedido.id; | |
| 125 | + $scope.notaPedido = notaPedido; | |
| 126 | + $scope.cliente = notaPedido.cliente; | |
| 127 | 127 | $scope.$broadcast('removeCabecera', 'Bomba:'); |
| 128 | 128 | $scope.$broadcast('removeCabecera', 'Kilometros:'); |
| 129 | 129 | var puntosDescarga = []; |
| 130 | 130 | notaPedido.notaPedidoPuntoDescarga.forEach(function (notaPedido) { |
| 131 | 131 | puntosDescarga.push(notaPedido.puntoDescarga); |
| 132 | 132 | }); |
| 133 | - var cabeceras = [ | |
| 133 | + $scope.cabeceras = [ | |
| 134 | 134 | { |
| 135 | 135 | label: 'Moneda:', |
| 136 | 136 | valor: notaPedido.cotizacion.moneda.DETALLE |
| ... | ... | @@ -160,18 +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 | label: 'Proveedor:', |
| 165 | 166 | valor: $filter('rellenarDigitos') |
| 166 | 167 | (notaPedido.proveedor.COD, 5) + ' - ' + |
| 167 | 168 | notaPedido.proveedor.NOM |
| 168 | 169 | }, |
| 169 | - { | |
| 170 | - label: 'Precios y condiciones:', | |
| 171 | - valor: valorPrecioCondicion() + ' ' + | |
| 172 | - remitoBusinessService | |
| 173 | - .plazoToString(notaPedido.notaPedidoPlazo) | |
| 174 | - }, | |
| 170 | + | |
| 175 | 171 | { |
| 176 | 172 | label: 'Flete:', |
| 177 | 173 | valor: notaPedido.fob === 1 ? 'FOB' : ( |
| ... | ... | @@ -183,7 +179,7 @@ angular.module('focaCrearRemito').controller('remitoController', |
| 183 | 179 | getCabeceraPuntoDescarga(puntosDescarga)) |
| 184 | 180 | } |
| 185 | 181 | ]; |
| 186 | - | |
| 182 | + valorPrecioCondicion(); | |
| 187 | 183 | // Seteo checked en cabeceras |
| 188 | 184 | $filter('filter')($scope.botonera, |
| 189 | 185 | { label: 'Cliente' })[0].checked = true; |
| ... | ... | @@ -195,6 +191,8 @@ angular.module('focaCrearRemito').controller('remitoController', |
| 195 | 191 | { label: 'Nota pedido' })[0].checked = true; |
| 196 | 192 | $filter('filter')($scope.botonera, |
| 197 | 193 | { label: 'Precios y condiciones' })[0].checked = true; |
| 194 | + $filter('filter')($scope.botonera, | |
| 195 | + { label: 'Domicilio de Entrega' })[0].checked = true; | |
| 198 | 196 | |
| 199 | 197 | if (notaPedido.observaciones) { |
| 200 | 198 | $filter('filter')($scope.botonera, |
| ... | ... | @@ -202,10 +200,17 @@ angular.module('focaCrearRemito').controller('remitoController', |
| 202 | 200 | } |
| 203 | 201 | |
| 204 | 202 | function valorPrecioCondicion() { |
| 205 | - if (notaPedido.idPrecioCondicion > 0) { | |
| 206 | - return notaPedido.precioCondicion.nombre; | |
| 207 | - } else { | |
| 208 | - return 'Ingreso Manual'; | |
| 203 | + if (parseInt(notaPedido.idListaPrecio) > 0) { | |
| 204 | + crearRemitoService.getListaPrecioById(parseInt(notaPedido.idListaPrecio)) | |
| 205 | + .then(function (res) { | |
| 206 | + $scope.cabeceras.push({ | |
| 207 | + label: 'Precios y Condiciones:', | |
| 208 | + valor: parseInt(res.data[0].ID) + ' - ' + res.data[0].DES + ' ' + | |
| 209 | + remitoBusinessService | |
| 210 | + .plazoToString(notaPedido.notaPedidoPlazo) | |
| 211 | + }); | |
| 212 | + addArrayCabecera($scope.cabeceras); | |
| 213 | + }); | |
| 209 | 214 | } |
| 210 | 215 | } |
| 211 | 216 | |
| ... | ... | @@ -219,13 +224,12 @@ angular.module('focaCrearRemito').controller('remitoController', |
| 219 | 224 | label: 'Kilometros:', |
| 220 | 225 | valor: notaPedido.kilometros |
| 221 | 226 | }; |
| 222 | - cabeceras.push(cabeceraKilometros); | |
| 227 | + $scope.cabeceras.push(cabeceraKilometros); | |
| 223 | 228 | } |
| 224 | - cabeceras.push(cabeceraBomba); | |
| 229 | + $scope.cabeceras.push(cabeceraBomba); | |
| 225 | 230 | } |
| 226 | 231 | |
| 227 | - delete notaPedido.id; | |
| 228 | - $scope.remito = notaPedido; | |
| 232 | + $scope.remito = angular.copy(notaPedido); | |
| 229 | 233 | $scope.remito.id = 0; |
| 230 | 234 | $scope.remito.remitoPlazo = notaPedido.notaPedidoPlazo; |
| 231 | 235 | $scope.remito.remitoPuntoDescarga = notaPedido.notaPedidoPuntoDescarga; |
| ... | ... | @@ -246,7 +250,7 @@ angular.module('focaCrearRemito').controller('remitoController', |
| 246 | 250 | } |
| 247 | 251 | |
| 248 | 252 | enableObservaciones(notaPedido.observaciones ? true : false); |
| 249 | - addArrayCabecera(cabeceras); | |
| 253 | + addArrayCabecera($scope.cabeceras); | |
| 250 | 254 | |
| 251 | 255 | }, function () { |
| 252 | 256 | // funcion ejecutada cuando se cancela el modal |
| ... | ... | @@ -275,8 +279,16 @@ angular.module('focaCrearRemito').controller('remitoController', |
| 275 | 279 | resolve: { usadoPor: function () { return 'remito'; } } |
| 276 | 280 | } |
| 277 | 281 | ); |
| 278 | - modalInstance.result.then( | |
| 279 | - setearRemito, function () { | |
| 282 | + modalInstance.result.then(function(remito) { | |
| 283 | + | |
| 284 | + remito.articulosRemito.forEach(function (articulo) { | |
| 285 | + articulo.precio = | |
| 286 | + (articulo.precio / remito.cotizacion.VENDEDOR).toFixed(4); | |
| 287 | + }); | |
| 288 | + | |
| 289 | + setearRemito(remito); | |
| 290 | + | |
| 291 | + }, function () { | |
| 280 | 292 | // funcion ejecutada cuando se cancela el modal |
| 281 | 293 | } |
| 282 | 294 | ); |
| ... | ... | @@ -306,6 +318,7 @@ angular.module('focaCrearRemito').controller('remitoController', |
| 306 | 318 | focaModalService.alert('Debe cargar al menos un articulo'); |
| 307 | 319 | return; |
| 308 | 320 | } |
| 321 | + | |
| 309 | 322 | focaBotoneraLateralService.startGuardar(); |
| 310 | 323 | $scope.saveLoading = true; |
| 311 | 324 | var save = { |
| ... | ... | @@ -317,7 +330,7 @@ angular.module('focaCrearRemito').controller('remitoController', |
| 317 | 330 | cuitCliente: $scope.remito.cliente.CUIT, |
| 318 | 331 | total: $scope.getTotal() * $scope.remito.cotizacion.VENDEDOR, |
| 319 | 332 | numeroNotaPedido: $scope.remito.numeroNotaPedido, |
| 320 | - idVendedor: $scope.remito.vendedor.NUM, | |
| 333 | + idVendedor: parseInt($scope.remito.cliente.VEN), | |
| 321 | 334 | idProveedor: $scope.remito.proveedor.COD, |
| 322 | 335 | idDomicilio: $scope.remito.idDomicilio || $scope.remito.domicilio.id, |
| 323 | 336 | idCotizacion: $scope.remito.cotizacion.ID, |
| ... | ... | @@ -391,7 +404,6 @@ angular.module('focaCrearRemito').controller('remitoController', |
| 391 | 404 | crearRemitoService.crearPlazosParaRemito(json); |
| 392 | 405 | } |
| 393 | 406 | } |
| 394 | - | |
| 395 | 407 | abrirModalMail(data.data.id, |
| 396 | 408 | $scope.remito.cliente, |
| 397 | 409 | $filter('comprobante')([ |
| ... | ... | @@ -410,8 +422,12 @@ angular.module('focaCrearRemito').controller('remitoController', |
| 410 | 422 | } |
| 411 | 423 | ); |
| 412 | 424 | }; |
| 425 | + | |
| 413 | 426 | $scope.seleccionarProductos = function () { |
| 414 | - if ($scope.idLista === undefined) { | |
| 427 | + if ($scope.notaPedido.id !== 0) { | |
| 428 | + $scope.idLista = parseInt($scope.notaPedido.idListaPrecio) | |
| 429 | + } | |
| 430 | + if ($scope.remito.idListaPrecio === undefined) { | |
| 415 | 431 | focaModalService.alert( |
| 416 | 432 | 'Primero seleccione una lista de precio y condicion'); |
| 417 | 433 | return; |
| ... | ... | @@ -423,7 +439,7 @@ angular.module('focaCrearRemito').controller('remitoController', |
| 423 | 439 | controller: 'modalBusquedaProductosCtrl', |
| 424 | 440 | resolve: { |
| 425 | 441 | parametroProducto: { |
| 426 | - idLista: $scope.idLista, | |
| 442 | + idLista: $scope.idLista || parseInt($scope.remito.idListaPrecio), | |
| 427 | 443 | cotizacion: $scope.remito.cotizacion.VENDEDOR, |
| 428 | 444 | simbolo: $scope.remito.cotizacion.moneda.SIMBOLO |
| 429 | 445 | } |
| ... | ... | @@ -440,7 +456,7 @@ angular.module('focaCrearRemito').controller('remitoController', |
| 440 | 456 | codigo: producto.codigo, |
| 441 | 457 | sector: producto.sector, |
| 442 | 458 | sectorCodigo: producto.sector + '-' + producto.codigo, |
| 443 | - descripcion: producto.descripcion, | |
| 459 | + descripcion: producto.descripcionLarga, | |
| 444 | 460 | item: $scope.remito.articulosRemito.length + 1, |
| 445 | 461 | nombre: producto.descripcion, |
| 446 | 462 | precio: parseFloat(producto.precio.toFixed(4)), |
| ... | ... | @@ -469,6 +485,7 @@ angular.module('focaCrearRemito').controller('remitoController', |
| 469 | 485 | } |
| 470 | 486 | ); |
| 471 | 487 | }; |
| 488 | + | |
| 472 | 489 | $scope.seleccionarPuntosDeDescarga = function () { |
| 473 | 490 | if (!$scope.remito.cliente.COD || !$scope.remito.domicilio.id) { |
| 474 | 491 | focaModalService.alert('Primero seleccione un cliente y un domicilio'); |
| ... | ... | @@ -512,6 +529,7 @@ angular.module('focaCrearRemito').controller('remitoController', |
| 512 | 529 | ); |
| 513 | 530 | } |
| 514 | 531 | }; |
| 532 | + | |
| 515 | 533 | $scope.seleccionarCliente = function () { |
| 516 | 534 | if (varlidarRemitoFacturado()) { |
| 517 | 535 | var modalInstance = $uibModal.open( |
| ... | ... | @@ -588,6 +606,15 @@ angular.module('focaCrearRemito').controller('remitoController', |
| 588 | 606 | } |
| 589 | 607 | }; |
| 590 | 608 | |
| 609 | + $scope.seleccionarDomicilioDeEntrega = function () { | |
| 610 | + if (!$scope.remito.cliente.COD) { | |
| 611 | + focaModalService.alert('Seleccione un Cliente'); | |
| 612 | + return; | |
| 613 | + } else { | |
| 614 | + $scope.abrirModalDomicilios($scope.cliente); | |
| 615 | + } | |
| 616 | + }; | |
| 617 | + | |
| 591 | 618 | $scope.abrirModalDomicilios = function (cliente) { |
| 592 | 619 | var modalInstanceDomicilio = $uibModal.open( |
| 593 | 620 | { |
| ... | ... | @@ -596,7 +623,8 @@ angular.module('focaCrearRemito').controller('remitoController', |
| 596 | 623 | controller: 'focaModalDomicilioController', |
| 597 | 624 | size: 'lg', |
| 598 | 625 | resolve: { |
| 599 | - idCliente: function () { return cliente.cod; }, | |
| 626 | + idCliente: function () { return $scope.notaPedido.cliente ? $scope.notaPedido.cliente.COD : | |
| 627 | + cliente.cod; }, | |
| 600 | 628 | esNuevo: function () { return cliente.esNuevo; } |
| 601 | 629 | } |
| 602 | 630 | } |
| ... | ... | @@ -652,6 +680,8 @@ angular.module('focaCrearRemito').controller('remitoController', |
| 652 | 680 | |
| 653 | 681 | $filter('filter')($scope.botonera, |
| 654 | 682 | { label: 'Cliente' })[0].checked = true; |
| 683 | + $filter('filter')($scope.botonera, | |
| 684 | + { label: 'Domicilio de Entrega' })[0].checked = true; | |
| 655 | 685 | }) |
| 656 | 686 | .catch(function (e) { console.log(e); }); |
| 657 | 687 | }, function () { |
| ... | ... | @@ -681,19 +711,17 @@ angular.module('focaCrearRemito').controller('remitoController', |
| 681 | 711 | focaModalService.alert('Primero seleccione un cliente'); |
| 682 | 712 | return; |
| 683 | 713 | } |
| 684 | - | |
| 685 | 714 | if ($scope.remito.articulosRemito.length !== 0) { |
| 686 | - focaModalService.confirm('Se perderan los productos ingresados') | |
| 687 | - .then(function (data) { | |
| 688 | - if (data && varlidarRemitoFacturado()) { | |
| 689 | - abrirModal(); | |
| 690 | - } | |
| 691 | - }); | |
| 715 | + if (varlidarRemitoFacturado()) { | |
| 716 | + abrirModal(); | |
| 717 | + } | |
| 692 | 718 | } else { |
| 693 | 719 | abrirModal(); |
| 694 | 720 | } |
| 695 | - | |
| 721 | + | |
| 696 | 722 | function abrirModal() { |
| 723 | + var parametros = { idCliente: $scope.remito.cliente.COD, idListaPrecio : $scope.remito.cliente.MOD, | |
| 724 | + remito: $scope.remito }; | |
| 697 | 725 | var modalInstance = $uibModal.open( |
| 698 | 726 | { |
| 699 | 727 | ariaLabelledBy: 'Busqueda de Precio Condición', |
| ... | ... | @@ -701,8 +729,7 @@ angular.module('focaCrearRemito').controller('remitoController', |
| 701 | 729 | controller: 'focaModalPrecioCondicionController', |
| 702 | 730 | size: 'lg', |
| 703 | 731 | resolve: { |
| 704 | - idListaPrecio: function () { return $scope.remito.cliente.MOD || null; }, | |
| 705 | - idCliente: function () { return $scope.remito.cliente.COD; } | |
| 732 | + parametros: function () { return parametros; } | |
| 706 | 733 | } |
| 707 | 734 | } |
| 708 | 735 | ); |
| ... | ... | @@ -715,6 +742,7 @@ angular.module('focaCrearRemito').controller('remitoController', |
| 715 | 742 | $scope.remito.remitoPlazo = precioCondicion.plazoPago; |
| 716 | 743 | $scope.idLista = parseInt(precioCondicion.listaPrecio.ID) ? |
| 717 | 744 | parseInt(precioCondicion.listaPrecio.ID) : -1; |
| 745 | + $scope.remito.cliente.MOD = precioCondicion.listaPrecio.ID; | |
| 718 | 746 | for (var i = 0; i < precioCondicion.plazoPago.length; i++) { |
| 719 | 747 | plazosConcat += precioCondicion.plazoPago[i].dias + ', '; |
| 720 | 748 | } |
| ... | ... | @@ -729,17 +757,26 @@ angular.module('focaCrearRemito').controller('remitoController', |
| 729 | 757 | for (var j = 0; j < precioCondicion.length; j++) { |
| 730 | 758 | plazosConcat += precioCondicion[j].dias + ' '; |
| 731 | 759 | } |
| 732 | - cabecera = 'Ingreso manual ' + plazosConcat.trim(); | |
| 760 | + cabecera = plazosConcat.trim(); | |
| 733 | 761 | } |
| 734 | - $scope.remito.articulosRemito = []; | |
| 735 | - $scope.$broadcast('addCabecera', { | |
| 736 | - label: 'Precios y condiciones:', | |
| 737 | - valor: cabecera | |
| 738 | - }); | |
| 739 | - $scope.remito.precioCondicion = precioCondicion; | |
| 762 | + var cabecerasFilter = !$filter('filter')($scope.cabeceras, | |
| 763 | + { label: 'Precios y Condiciones' }); | |
| 764 | + if (!cabecerasFilter) { | |
| 765 | + $scope.cabeceras.push({ | |
| 766 | + label: 'Precios y Condiciones:', | |
| 767 | + valor: parseInt(precioCondicion.listaPrecio.ID) + ' - ' + | |
| 768 | + precioCondicion.listaPrecio.DES + ' ' + remitoBusinessService.plazoToString(precioCondicion.plazoPago) | |
| 769 | + }); | |
| 770 | + $scope.remito.idListaPrecio = parseInt(precioCondicion.listaPrecio.ID); | |
| 740 | 771 | |
| 772 | + } | |
| 773 | + $filter('filter')($scope.cabeceras, | |
| 774 | + { label: 'Precios y Condiciones' })[0].valor = cabecera; | |
| 775 | + | |
| 776 | + $scope.remito.precioCondicion = precioCondicion; | |
| 741 | 777 | $filter('filter')($scope.botonera, |
| 742 | 778 | { label: 'Precios y Condiciones' })[0].checked = true; |
| 779 | + addArrayCabecera($scope.cabeceras); | |
| 743 | 780 | }, function () { |
| 744 | 781 | |
| 745 | 782 | } |
| ... | ... | @@ -957,6 +994,8 @@ angular.module('focaCrearRemito').controller('remitoController', |
| 957 | 994 | if (!articulo.cantidad || !articulo.precio || !tmpCantidad || !tmpPrecio) { |
| 958 | 995 | focaModalService.alert('Los valores deben ser al menos 1'); |
| 959 | 996 | return; |
| 997 | + } else if (tmpCantidad === "0" || tmpPrecio === "0") { | |
| 998 | + focaModalService.alert('Esta ingresando un producto con valor 0'); | |
| 960 | 999 | } else if (articulo.cantidad < 0 || articulo.precio < 0) { |
| 961 | 1000 | focaModalService.alert('Los valores no pueden ser negativos'); |
| 962 | 1001 | return; |
| ... | ... | @@ -1072,19 +1111,19 @@ angular.module('focaCrearRemito').controller('remitoController', |
| 1072 | 1111 | $scope.$broadcast('removeCabecera', 'Cotizacion:'); |
| 1073 | 1112 | $scope.$broadcast('removeCabecera', 'Vendedor:'); |
| 1074 | 1113 | |
| 1075 | - var cabeceras = []; | |
| 1114 | + $scope.cabeceras = []; | |
| 1076 | 1115 | |
| 1077 | 1116 | if (remito.cotizacion && remito.cotizacion.moneda.CODIGO_AFIP !== 'PES') { |
| 1078 | - cabeceras.push({ | |
| 1117 | + $scope.cabeceras.push({ | |
| 1079 | 1118 | label: 'Moneda:', |
| 1080 | 1119 | valor: remito.cotizacion.moneda.DETALLE |
| 1081 | 1120 | }); |
| 1082 | - cabeceras.push({ | |
| 1121 | + $scope.cabeceras.push({ | |
| 1083 | 1122 | label: 'Fecha cotizacion:', |
| 1084 | 1123 | valor: $filter('date')(remito.cotizacion.FECHA, |
| 1085 | 1124 | 'dd/MM/yyyy') |
| 1086 | 1125 | }); |
| 1087 | - cabeceras.push({ | |
| 1126 | + $scope.cabeceras.push({ | |
| 1088 | 1127 | label: 'Cotizacion:', |
| 1089 | 1128 | valor: $filter('number')(remito.cotizacion.VENDEDOR, |
| 1090 | 1129 | '2') |
| ... | ... | @@ -1096,12 +1135,12 @@ angular.module('focaCrearRemito').controller('remitoController', |
| 1096 | 1135 | } |
| 1097 | 1136 | |
| 1098 | 1137 | if (remito.cliente && remito.cliente.COD) { |
| 1099 | - cabeceras.push({ | |
| 1138 | + $scope.cabeceras.push({ | |
| 1100 | 1139 | label: 'Cliente:', |
| 1101 | 1140 | valor: $filter('rellenarDigitos')(remito.cliente.COD, 3) + ' - ' + |
| 1102 | 1141 | remito.cliente.NOM |
| 1103 | 1142 | }); |
| 1104 | - cabeceras.push({ | |
| 1143 | + $scope.cabeceras.push({ | |
| 1105 | 1144 | label: 'Domicilio:', |
| 1106 | 1145 | valor: remito.domicilioStamp |
| 1107 | 1146 | }); |
| ... | ... | @@ -1109,14 +1148,14 @@ angular.module('focaCrearRemito').controller('remitoController', |
| 1109 | 1148 | $filter('filter')($scope.botonera, { label: 'Cliente' })[0].checked = true; |
| 1110 | 1149 | } |
| 1111 | 1150 | if (remito.vendedor && remito.vendedor.NUM) { |
| 1112 | - cabeceras.push({ | |
| 1151 | + $scope.cabeceras.push({ | |
| 1113 | 1152 | label: 'Vendedor:', |
| 1114 | 1153 | valor: $filter('rellenarDigitos')(remito.vendedor.NUM, 3) + |
| 1115 | 1154 | ' - ' + remito.vendedor.NOM |
| 1116 | 1155 | }); |
| 1117 | 1156 | } |
| 1118 | 1157 | if (remito.proveedor && remito.proveedor.COD) { |
| 1119 | - cabeceras.push({ | |
| 1158 | + $scope.cabeceras.push({ | |
| 1120 | 1159 | label: 'Proveedor:', |
| 1121 | 1160 | valor: $filter('rellenarDigitos')(remito.proveedor.COD, 5) + |
| 1122 | 1161 | ' - ' + remito.proveedor.NOM |
| ... | ... | @@ -1125,29 +1164,36 @@ angular.module('focaCrearRemito').controller('remitoController', |
| 1125 | 1164 | $filter('filter')($scope.botonera, { label: 'Proveedor' })[0].checked = true; |
| 1126 | 1165 | } |
| 1127 | 1166 | if (remito.flete !== undefined && remito.fob !== undefined) { |
| 1128 | - cabeceras.push({ | |
| 1167 | + $scope.cabeceras.push({ | |
| 1129 | 1168 | label: 'Flete:', |
| 1130 | 1169 | valor: remito.fob ? 'FOB' : ( |
| 1131 | 1170 | remito.flete ? 'Si' : 'No') |
| 1132 | 1171 | }); |
| 1133 | 1172 | } |
| 1134 | 1173 | if (remito.remitoPlazo) { |
| 1135 | - cabeceras.push({ | |
| 1136 | - label: 'Precio condicion:', | |
| 1137 | - valor: valorPrecioCondicion() + ' ' + | |
| 1138 | - remitoBusinessService.plazoToString(remito.remitoPlazo) | |
| 1139 | - }); | |
| 1140 | - | |
| 1174 | + valorPrecioCondicion(); | |
| 1141 | 1175 | $filter('filter')($scope.botonera, |
| 1142 | 1176 | { label: 'Precios y condiciones' })[0].checked = true; |
| 1143 | 1177 | } |
| 1178 | + | |
| 1144 | 1179 | function valorPrecioCondicion() { |
| 1145 | - if (remito.idPrecioCondicion > 0) { | |
| 1146 | - return remito.precioCondicion.nombre; | |
| 1147 | - } else { | |
| 1148 | - return 'Ingreso Manual'; | |
| 1180 | + if (parseInt(remito.idListaPrecio)) { | |
| 1181 | + crearRemitoService.getListaPrecioById(parseInt(remito.idListaPrecio)) | |
| 1182 | + .then(function (res) { | |
| 1183 | + $timeout(function () { | |
| 1184 | + $scope.cabeceras.push({ | |
| 1185 | + label: 'Precios y Condiciones:', | |
| 1186 | + valor: parseInt(res.data[0].ID) + ' - ' + res.data[0].DES + ' ' + | |
| 1187 | + remitoBusinessService | |
| 1188 | + .plazoToString(remito.remitoPlazo) | |
| 1189 | + }); | |
| 1190 | + addArrayCabecera($scope.cabeceras); | |
| 1191 | + },true); | |
| 1192 | + | |
| 1193 | + }); | |
| 1149 | 1194 | } |
| 1150 | 1195 | } |
| 1196 | + | |
| 1151 | 1197 | if (remito.flete === 1) { |
| 1152 | 1198 | var cabeceraBomba = { |
| 1153 | 1199 | label: 'Bomba', |
| ... | ... | @@ -1158,9 +1204,9 @@ angular.module('focaCrearRemito').controller('remitoController', |
| 1158 | 1204 | label: 'Kilometros', |
| 1159 | 1205 | valor: remito.kilometros |
| 1160 | 1206 | }; |
| 1161 | - cabeceras.push(cabeceraKilometros); | |
| 1207 | + $scope.cabeceras.push(cabeceraKilometros); | |
| 1162 | 1208 | } |
| 1163 | - cabeceras.push(cabeceraBomba); | |
| 1209 | + $scope.cabeceras.push(cabeceraBomba); | |
| 1164 | 1210 | } |
| 1165 | 1211 | |
| 1166 | 1212 | if (remito.idPrecioCondicion > 0) { |
| ... | ... | @@ -1178,21 +1224,15 @@ angular.module('focaCrearRemito').controller('remitoController', |
| 1178 | 1224 | puntoDescarga.push(remitoPuntoDescarga.puntoDescarga); |
| 1179 | 1225 | }); |
| 1180 | 1226 | |
| 1181 | - cabeceras.push({ | |
| 1227 | + $scope.cabeceras.push({ | |
| 1182 | 1228 | label: 'Puntos de descarga: ', |
| 1183 | 1229 | valor: $filter('rellenarDigitos')(getCabeceraPuntoDescarga(puntoDescarga)) |
| 1184 | 1230 | }); |
| 1185 | 1231 | } |
| 1186 | 1232 | $scope.remitoIsDirty = false; |
| 1187 | 1233 | |
| 1188 | - if (remito.articulosRemito && $scope.remito.articulosRemito.length) { | |
| 1189 | - $scope.remito.articulosRemito.forEach(function (articulo) { | |
| 1190 | - articulo.precio = | |
| 1191 | - (articulo.precio / $scope.remito.cotizacion.VENDEDOR).toFixed(4); | |
| 1192 | - }); | |
| 1193 | - } | |
| 1194 | 1234 | |
| 1195 | - addArrayCabecera(cabeceras); | |
| 1235 | + addArrayCabecera($scope.cabeceras); | |
| 1196 | 1236 | } |
| 1197 | 1237 | |
| 1198 | 1238 | function getLSRemito() { |
src/js/service.js
| ... | ... | @@ -8,7 +8,7 @@ angular.module('focaCrearRemito') |
| 8 | 8 | }, |
| 9 | 9 | crearRemito: function(remito) { |
| 10 | 10 | // TODO: Cambiar para usar el servicio /remito |
| 11 | - return $http.post(route + '/remito', remito); | |
| 11 | + return $http.post(route + '/remito/guardar', remito); | |
| 12 | 12 | }, |
| 13 | 13 | getRemitoById: function(id) { |
| 14 | 14 | return $http.get(route + '/remito/obtener/' + id); |
| ... | ... | @@ -48,6 +48,9 @@ angular.module('focaCrearRemito') |
| 48 | 48 | getPrecioCondicionById: function(id) { |
| 49 | 49 | return $http.get(route + '/precio-condicion/' + id); |
| 50 | 50 | }, |
| 51 | + getListaPrecioById: function (id) { | |
| 52 | + return $http.get(route + '/lista-precio/' + id); | |
| 53 | + }, | |
| 51 | 54 | getPlazoPagoByPrecioCondicion: function(id) { |
| 52 | 55 | return $http.get(route + '/plazo-pago/precio-condicion/'+ id); |
| 53 | 56 | }, |
| ... | ... | @@ -112,6 +115,10 @@ angular.module('focaCrearRemito') |
| 112 | 115 | image: 'productos.png' |
| 113 | 116 | }, |
| 114 | 117 | { |
| 118 | + label: 'Domicilio de Entrega', | |
| 119 | + image: 'domicilioDeEntrega.png' | |
| 120 | + }, | |
| 121 | + { | |
| 115 | 122 | label: 'Observaciones', |
| 116 | 123 | image: 'botonObservaciones.png', |
| 117 | 124 | disable: true |
src/views/remito.html
| ... | ... | @@ -76,9 +76,7 @@ |
| 76 | 76 | foca-focus="articulo.editCantidad" |
| 77 | 77 | ng-keypress="editarArticulo($event.keyCode, articulo, tmpCantidad, tmpPrecio);" |
| 78 | 78 | esc-key="cancelarEditar(articulo)" |
| 79 | - ng-focus="selectFocus($event); | |
| 80 | - tmpCantidad = articulo.cantidad; | |
| 81 | - tmpPrecio = articulo.precio" | |
| 79 | + ng-focus="selectFocus($event); tmpCantidad = articulo.cantidad; tmpPrecio = articulo.precio" | |
| 82 | 80 | teclado-virtual |
| 83 | 81 | > |
| 84 | 82 | <i |
| ... | ... | @@ -124,7 +122,7 @@ |
| 124 | 122 | </button> |
| 125 | 123 | <button |
| 126 | 124 | class="btn btn-outline-light" |
| 127 | - ng-click="editarArticulo(13, articulo)" | |
| 125 | + ng-click="editarArticulo(13, articulo, tmpCantidad, tmpPrecio);" | |
| 128 | 126 | ng-show="articulo.editCantidad || articulo.editPrecio" |
| 129 | 127 | > |
| 130 | 128 | <i class="fa fa-save"></i> |