Commit 3641012dc07a329d49d9fc6a23629d5c616de410
Exists in
master
and in
1 other branch
Merge branch 'master' into 'master'
Master See merge request !41
Showing
1 changed file
Show diff stats
src/js/controller.js
... | ... | @@ -27,8 +27,8 @@ angular.module('focaCrearNotaPedido') .controller('notaPedidoCtrl', |
27 | 27 | $scope.show = false; |
28 | 28 | $scope.cargando = true; |
29 | 29 | $scope.now = new Date(); |
30 | - $scope.puntoVenta = '0000'; | |
31 | - $scope.comprobante = '00000000'; | |
30 | + $scope.puntoVenta = $filter('rellenarDigitos')(0, 4); | |
31 | + $scope.comprobante = $filter('rellenarDigitos')(0, 8); | |
32 | 32 | $scope.dateOptions = { |
33 | 33 | maxDate: new Date(), |
34 | 34 | minDate: new Date(2010, 0, 1) |
... | ... | @@ -81,8 +81,13 @@ angular.module('focaCrearNotaPedido') .controller('notaPedidoCtrl', |
81 | 81 | |
82 | 82 | crearNotaPedidoService.getNumeroNotaPedido().then( |
83 | 83 | function(res) { |
84 | - $scope.puntoVenta = rellenar(res.data.sucursal, 4); | |
85 | - $scope.comprobante = rellenar(res.data.numeroNotaPedido, 8); | |
84 | + $scope.puntoVenta = $filter('rellenarDigitos')( | |
85 | + res.data.sucursal, 4 | |
86 | + ); | |
87 | + | |
88 | + $scope.comprobante = $filter('rellenarDigitos')( | |
89 | + res.data.numeroNotaPedido, 8 | |
90 | + ); | |
86 | 91 | }, |
87 | 92 | function(err) { |
88 | 93 | focaModalService.alert('La terminal no esta configurada correctamente'); |
... | ... | @@ -306,16 +311,25 @@ angular.module('focaCrearNotaPedido') .controller('notaPedidoCtrl', |
306 | 311 | } |
307 | 312 | cabeceras.push(cabeceraBomba); |
308 | 313 | } |
314 | + | |
309 | 315 | $scope.articulosTabla = notaPedido.articulosNotaPedido; |
310 | 316 | notaPedidoBusinessService.calcularArticulos($scope.articulosTabla, |
311 | 317 | notaPedido.cotizacion.VENDEDOR); |
318 | + | |
312 | 319 | if(notaPedido.idPrecioCondicion > 0) { |
313 | 320 | $scope.idLista = notaPedido.precioCondicion.idListaPrecio; |
314 | 321 | } else { |
315 | 322 | $scope.idLista = -1; |
316 | 323 | } |
317 | - $scope.puntoVenta = rellenar(notaPedido.sucursal, 4); | |
318 | - $scope.comprobante = rellenar(notaPedido.numeroNotaPedido, 8); | |
324 | + | |
325 | + $scope.puntoVenta = $filter('rellenarDigitos')( | |
326 | + notaPedido.sucursal, 4 | |
327 | + ); | |
328 | + | |
329 | + $scope.comprobante = $filter('rellenarDigitos')( | |
330 | + notaPedido.numeroNotaPedido, 8 | |
331 | + ); | |
332 | + | |
319 | 333 | $scope.notaPedido = notaPedido; |
320 | 334 | $scope.notaPedido.moneda = notaPedido.cotizacion.moneda; |
321 | 335 | $scope.plazosPagos = notaPedido.notaPedidoPlazo; |
... | ... | @@ -852,15 +866,6 @@ angular.module('focaCrearNotaPedido') .controller('notaPedidoCtrl', |
852 | 866 | } |
853 | 867 | } |
854 | 868 | |
855 | - function rellenar(relleno, longitud) { | |
856 | - relleno = '' + relleno; | |
857 | - while (relleno.length < longitud) { | |
858 | - relleno = '0' + relleno; | |
859 | - } | |
860 | - | |
861 | - return relleno; | |
862 | - } | |
863 | - | |
864 | 869 | function validarNotaRemitada() { |
865 | 870 | if(!$scope.notaPedido.idRemito) { |
866 | 871 | return true; |
... | ... | @@ -916,8 +921,7 @@ angular.module('focaCrearNotaPedido') .controller('notaPedidoCtrl', |
916 | 921 | |
917 | 922 | if (confirmacion) { |
918 | 923 | focaModalService.confirm( |
919 | - '¿Esta seguro de que desea salir? ' + | |
920 | - 'Se perderán todos los datos cargados.' | |
924 | + '¿Está seguro de que desea salir? Se perderán todos los datos cargados.' | |
921 | 925 | ).then(function(data) { |
922 | 926 | if (data) { |
923 | 927 | $location.path('/'); |