Commit 9b48e02bb3017695e659a587da805a57877259ad
Committed by
Marcelo Puebla
Exists in
master
and in
1 other branch
Merge remote-tracking branch 'upstream/develop'
Showing
4 changed files
Show diff stats
spec/controllerSpec.js
| ... | ... | @@ -211,7 +211,7 @@ describe('Controladores módulo crear nota de pedido', function() { |
| 211 | 211 | $filter: filter, |
| 212 | 212 | $timeout: timeout, |
| 213 | 213 | crearNotaPedidoService: { |
| 214 | - getNumeroNotaPedido: function() { | |
| 214 | + getNumeroNotaPedido: function() { | |
| 215 | 215 | return { |
| 216 | 216 | then: function() { } |
| 217 | 217 | }; |
| ... | ... | @@ -255,7 +255,7 @@ describe('Controladores módulo crear nota de pedido', function() { |
| 255 | 255 | 'undefined', function() |
| 256 | 256 | { |
| 257 | 257 | //arrange |
| 258 | - var scope = { | |
| 258 | + var scope = { | |
| 259 | 259 | $watch: function() { }, |
| 260 | 260 | $broadcast: function() { } |
| 261 | 261 | }; |
| ... | ... | @@ -379,7 +379,7 @@ describe('Controladores módulo crear nota de pedido', function() { |
| 379 | 379 | $filter: filter, |
| 380 | 380 | $timeout: timeout, |
| 381 | 381 | crearNotaPedidoService: { |
| 382 | - getNumeroNotaPedido: function() { | |
| 382 | + getNumeroNotaPedido: function() { | |
| 383 | 383 | return { |
| 384 | 384 | then: function() { } |
| 385 | 385 | }; |
| ... | ... | @@ -910,16 +910,18 @@ describe('Controladores módulo crear nota de pedido', function() { |
| 910 | 910 | var cliente = { |
| 911 | 911 | COD: undefined, |
| 912 | 912 | CUIT: undefined, |
| 913 | - NOM: undefined | |
| 913 | + NOM: undefined, | |
| 914 | + MOD: undefined | |
| 914 | 915 | }; |
| 915 | 916 | |
| 916 | 917 | //act |
| 917 | 918 | spyOn(uibModal, 'open').and.returnValue(promesaRespuesta); |
| 918 | 919 | spyOn(scope, '$broadcast'); |
| 919 | - scope.abrirModalDomicilios({ }); | |
| 920 | + scope.abrirModalDomicilios(cliente); | |
| 920 | 921 | |
| 921 | 922 | //assert |
| 922 | 923 | promesaRespuesta.result.then(function() { |
| 924 | + //scope.notaPedido.domicilio sea vacio | |
| 923 | 925 | expect(scope.notaPedido.domicilio).toEqual(respuesta); |
| 924 | 926 | expect(scope.notaPedido.cliente).toEqual(cliente); |
| 925 | 927 | expect(scope.$broadcast).toHaveBeenCalled(); |
| ... | ... | @@ -1073,7 +1075,9 @@ describe('Controladores módulo crear nota de pedido', function() { |
| 1073 | 1075 | $localStorage: {} |
| 1074 | 1076 | }); |
| 1075 | 1077 | |
| 1076 | - scope.notaPedido = {}; | |
| 1078 | + scope.notaPedido = { | |
| 1079 | + cliente: { COD: true } | |
| 1080 | + }; | |
| 1077 | 1081 | |
| 1078 | 1082 | var respuesta = { result: {then: function() { } } }; |
| 1079 | 1083 | |
| ... | ... | @@ -1128,7 +1132,8 @@ describe('Controladores módulo crear nota de pedido', function() { |
| 1128 | 1132 | }); |
| 1129 | 1133 | scope.idLista = true; |
| 1130 | 1134 | scope.notaPedido = { |
| 1131 | - vendedor: { NUM: true } | |
| 1135 | + vendedor: { NUM: true }, | |
| 1136 | + cliente: { COD: true } | |
| 1132 | 1137 | }; |
| 1133 | 1138 | var respuesta = { plazoPago: { } }; |
| 1134 | 1139 | var promesaRespuesta = { result: Promise.resolve(respuesta) }; |
src/js/controller.js
| ... | ... | @@ -48,7 +48,7 @@ angular.module('focaCrearNotaPedido') .controller('notaPedidoCtrl', |
| 48 | 48 | if (APP === 'distribuidor') { |
| 49 | 49 | $scope.idVendedor = focaLoginService.getLoginData().vendedorCobrador; |
| 50 | 50 | } |
| 51 | - | |
| 51 | + | |
| 52 | 52 | //Trabajo con la cotización más reciente, por eso uso siempre la primera '[0]' |
| 53 | 53 | crearNotaPedidoService.getCotizacionByIdMoneda(1).then(function(res) { |
| 54 | 54 | var monedaPorDefecto = res.data[0]; |
| ... | ... | @@ -107,7 +107,6 @@ angular.module('focaCrearNotaPedido') .controller('notaPedidoCtrl', |
| 107 | 107 | }); |
| 108 | 108 | |
| 109 | 109 | $scope.notaPedido.vendedor = vendedor; |
| 110 | - $scope.inicial.notaPedido.vendedor =$scope.notaPedido.vendedor; | |
| 111 | 110 | } |
| 112 | 111 | ); |
| 113 | 112 | } |
| ... | ... | @@ -341,8 +340,8 @@ angular.module('focaCrearNotaPedido') .controller('notaPedidoCtrl', |
| 341 | 340 | } |
| 342 | 341 | }; |
| 343 | 342 | |
| 344 | - $scope.seleccionarTransportista = function() { | |
| 345 | - $scope.seleccionarProveedor(function() { | |
| 343 | + $scope.seleccionarProveedor = function() { | |
| 344 | + $scope.abrirModalProveedores(function() { | |
| 346 | 345 | if (validarNotaRemitada()) { |
| 347 | 346 | var modalInstance = $uibModal.open( |
| 348 | 347 | { |
| ... | ... | @@ -468,7 +467,7 @@ angular.module('focaCrearNotaPedido') .controller('notaPedidoCtrl', |
| 468 | 467 | }, ocultarVendedor); |
| 469 | 468 | }; |
| 470 | 469 | |
| 471 | - $scope.seleccionarProveedor = function(callback) { | |
| 470 | + $scope.abrirModalProveedores = function(callback) { | |
| 472 | 471 | if (validarNotaRemitada()) { |
| 473 | 472 | var parametrosModal = { |
| 474 | 473 | titulo: 'Búsqueda de Proveedor', |
| ... | ... | @@ -572,7 +571,6 @@ angular.module('focaCrearNotaPedido') .controller('notaPedidoCtrl', |
| 572 | 571 | total += arrayTempArticulos[i].precio * arrayTempArticulos[i].cantidad; |
| 573 | 572 | } |
| 574 | 573 | } |
| 575 | - | |
| 576 | 574 | return parseFloat(total.toFixed(2)); |
| 577 | 575 | }; |
| 578 | 576 | |
| ... | ... | @@ -587,7 +585,7 @@ angular.module('focaCrearNotaPedido') .controller('notaPedidoCtrl', |
| 587 | 585 | focaModalService.alert('Primero seleccione un cliente'); |
| 588 | 586 | return; |
| 589 | 587 | } |
| 590 | - if(validarNotaRemitada()) { | |
| 588 | + if (validarNotaRemitada()) { | |
| 591 | 589 | var modalInstance = $uibModal.open( |
| 592 | 590 | { |
| 593 | 591 | ariaLabelledBy: 'Busqueda de Precio Condición', |
| ... | ... | @@ -816,7 +814,7 @@ angular.module('focaCrearNotaPedido') .controller('notaPedidoCtrl', |
| 816 | 814 | }); |
| 817 | 815 | cabeceras.push({ |
| 818 | 816 | label: 'Fecha cotizacion:', |
| 819 | - valor: $filter('date')(notaPedido.cotizacion.FECHA, | |
| 817 | + valor: $filter('date')(notaPedido.cotizacion.FECHA, | |
| 820 | 818 | 'dd/MM/yyyy') |
| 821 | 819 | }); |
| 822 | 820 | cabeceras.push({ |
| ... | ... | @@ -892,24 +890,24 @@ angular.module('focaCrearNotaPedido') .controller('notaPedidoCtrl', |
| 892 | 890 | } |
| 893 | 891 | cabeceras.push(cabeceraBomba); |
| 894 | 892 | } |
| 895 | - | |
| 893 | + | |
| 896 | 894 | notaPedidoBusinessService.calcularArticulos($scope.notaPedido.articulosNotaPedido, |
| 897 | 895 | notaPedido.cotizacion.VENDEDOR); |
| 898 | - | |
| 896 | + | |
| 899 | 897 | if (notaPedido.idPrecioCondicion > 0) { |
| 900 | 898 | $scope.idLista = notaPedido.precioCondicion.idListaPrecio; |
| 901 | 899 | } else { |
| 902 | 900 | $scope.idLista = -1; |
| 903 | 901 | } |
| 904 | - | |
| 902 | + | |
| 905 | 903 | $scope.puntoVenta = $filter('rellenarDigitos')( |
| 906 | 904 | notaPedido.sucursal, 4 |
| 907 | 905 | ); |
| 908 | - | |
| 906 | + | |
| 909 | 907 | $scope.comprobante = $filter('rellenarDigitos')( |
| 910 | 908 | notaPedido.numeroNotaPedido, 8 |
| 911 | 909 | ); |
| 912 | - | |
| 910 | + | |
| 913 | 911 | $scope.notaPedido.notaPedidoPuntoDescarga = |
| 914 | 912 | formatearPuntosDescarga(notaPedido.notaPedidoPuntoDescarga || []); |
| 915 | 913 | addArrayCabecera(cabeceras); |
src/js/service.js
src/views/nota-pedido.html
| ... | ... | @@ -199,7 +199,7 @@ |
| 199 | 199 | <h3>Total:</h3> |
| 200 | 200 | </td> |
| 201 | 201 | <td class="table-celda-total text-right no-border-top" colspan="1"> |
| 202 | - <h3>{{getTotal() | currency: notaPedido.moneda.SIMBOLO}}</h3> | |
| 202 | + <h3>{{getTotal() | currency: notaPedido.cotizacion.moneda.SIMBOLO}}</h3> | |
| 203 | 203 | </td> |
| 204 | 204 | <td class="text-right no-border-top"> |
| 205 | 205 | <button |
| ... | ... | @@ -389,7 +389,7 @@ |
| 389 | 389 | <h3>Total:</h3> |
| 390 | 390 | </td> |
| 391 | 391 | <td class="table-celda-total text-right no-border-top"> |
| 392 | - <h3>{{getTotal() | currency: notaPedido.moneda.SIMBOLO}}</h3> | |
| 392 | + <h3>{{getTotal() | currency: notaPedido.cotizacion.moneda.SIMBOLO}}</h3> | |
| 393 | 393 | </td> |
| 394 | 394 | </tr> |
| 395 | 395 | </tfoot> |