Commit 165d0ecb4d7d6599c7fffddb7d47230536d40a01
Exists in
master
and in
1 other branch
Merge branch 'master' into 'develop'
Master(efernandez) See merge request !40
Showing
2 changed files
Show diff stats
package.json
... | ... | @@ -8,9 +8,11 @@ |
8 | 8 | "refresh": "gulp uglify && cp tmp/foca-crear-factura.js ../wrapper-demo/node_modules/foca-crear-factura/dist/foca-crear-factura.min.js", |
9 | 9 | "test": "echo \"Error: no test specified\" && exit 1", |
10 | 10 | "compile": "gulp uglify", |
11 | + "gulp-pre-commit": "gulp pre-commit", | |
11 | 12 | "postinstall": "npm run compile && gulp clean-post-install", |
12 | 13 | "install-dev": "npm install -D jasmine-core pre-commit angular angular-ladda ladda@1.0.6 angular-route angular-cookies bootstrap ui-bootstrap4 font-awesome gulp gulp-angular-templatecache gulp-connect gulp-clean gulp-htmlmin gulp-jshint gulp-rename gulp-replace gulp-sequence gulp-uglify-es gulp-uglify jquery jshint pump" |
13 | 14 | }, |
15 | + "pre-commit": "gulp-pre-commit", | |
14 | 16 | "repository": { |
15 | 17 | "type": "git", |
16 | 18 | "url": "http://git.focasoftware.com/npm/foca-crear-factura.git" |
src/js/controller.js
... | ... | @@ -76,20 +76,11 @@ angular.module('focaCrearFactura').controller('facturaController', [ |
76 | 76 | $scope.factura.articulosFactura = []; |
77 | 77 | $scope.idLista = undefined; |
78 | 78 | |
79 | - crearRemitoService.getNumeroRemito().then( | |
80 | - function (res) { | |
81 | - $scope.puntoVenta = rellenar(res.data.sucursal, 4); | |
82 | - $scope.comprobante = rellenar(res.data.numeroRemito, 8); | |
83 | - }, | |
84 | - function (err) { | |
85 | - focaModalService.alert('La terminal no esta configurada correctamente'); | |
86 | - console.info(err); | |
87 | - } | |
88 | - ); | |
89 | - | |
90 | 79 | $scope.inicial = angular.copy($scope.factura); |
91 | 80 | |
92 | - if (APP == 'facturador') { | |
81 | + getNumeroFactura('B'); | |
82 | + | |
83 | + if (APP === 'facturador') { | |
93 | 84 | crearFacturaService |
94 | 85 | .getVendedorPlayaById(loginServ.getLoginData().vendedorPlaya) |
95 | 86 | .then(function (res) { |
... | ... | @@ -118,7 +109,7 @@ angular.module('focaCrearFactura').controller('facturaController', [ |
118 | 109 | focaModalService.alert('Ocurrió un error al intentar recuperar' + |
119 | 110 | 'el vendedor logeado'); |
120 | 111 | }); |
121 | - }) | |
112 | + }); | |
122 | 113 | } |
123 | 114 | } |
124 | 115 | |
... | ... | @@ -133,7 +124,7 @@ angular.module('focaCrearFactura').controller('facturaController', [ |
133 | 124 | |
134 | 125 | if (!validarGuardar()) return; |
135 | 126 | |
136 | - if ($scope.factura.formaPago == 2) { | |
127 | + if ($scope.factura.formaPago === 2) { | |
137 | 128 | $scope.crearFactura(); |
138 | 129 | return; |
139 | 130 | } |
... | ... | @@ -155,7 +146,7 @@ angular.module('focaCrearFactura').controller('facturaController', [ |
155 | 146 | modalInstance.result |
156 | 147 | .then(function (data) { |
157 | 148 | |
158 | - if (data.tipo == 'tarjeta') { | |
149 | + if (data.tipo === 'tarjeta') { | |
159 | 150 | $scope.factura.formaPago = 4; |
160 | 151 | } else { |
161 | 152 | $scope.factura.formaPago = 1; |
... | ... | @@ -226,7 +217,7 @@ angular.module('focaCrearFactura').controller('facturaController', [ |
226 | 217 | formaPago: formaPago |
227 | 218 | }; |
228 | 219 | |
229 | - crearFacturaService.guardarFactura(save).then(function (res) { | |
220 | + crearFacturaService.guardarFactura(save).then(function () { | |
230 | 221 | |
231 | 222 | focaBotoneraLateralService.endGuardar(true); |
232 | 223 | |
... | ... | @@ -280,9 +271,10 @@ angular.module('focaCrearFactura').controller('facturaController', [ |
280 | 271 | .then(function (data) { |
281 | 272 | |
282 | 273 | $scope.factura.formaPago = data.formaDePago; |
283 | - | |
284 | 274 | $scope.factura.cliente = cliente; |
285 | 275 | |
276 | + getNumeroFactura(cliente.TIP); | |
277 | + | |
286 | 278 | $scope.$broadcast('addCabecera', { |
287 | 279 | label: 'Cliente:', |
288 | 280 | valor: $filter('rellenarDigitos')(cliente.COD, 3) + |
... | ... | @@ -460,7 +452,7 @@ angular.module('focaCrearFactura').controller('facturaController', [ |
460 | 452 | |
461 | 453 | $scope.quitarDespacho = function (articulo, index) { |
462 | 454 | |
463 | - if (articulo.SUR == 0) { | |
455 | + if (articulo.SUR === 0) { | |
464 | 456 | articulo.desactivado = true; |
465 | 457 | return; |
466 | 458 | } |
... | ... | @@ -570,8 +562,8 @@ angular.module('focaCrearFactura').controller('facturaController', [ |
570 | 562 | DES: producto.descripcionLarga, |
571 | 563 | PUN: producto.precio, |
572 | 564 | IVA: producto.IMPIVA, |
573 | - NET: producto.IvaCO != 0 ? parseFloat(producto.neto) : 0, | |
574 | - NEX: producto.IvaCO == 0 ? parseFloat(producto.neto) : 0, | |
565 | + NET: producto.IvaCO !== 0 ? parseFloat(producto.neto) : 0, | |
566 | + NEX: producto.IvaCO === 0 ? parseFloat(producto.neto) : 0, | |
575 | 567 | IMI: producto.ImpInt, |
576 | 568 | IMI2: producto.ImpInt2, |
577 | 569 | IMI3: producto.ImpInt3, |
... | ... | @@ -725,8 +717,8 @@ angular.module('focaCrearFactura').controller('facturaController', [ |
725 | 717 | CAN: despacho.LTS, |
726 | 718 | PUN: producto.PreVen, |
727 | 719 | IVA: producto.IMPIVA, |
728 | - NET: producto.IvaCO != 0 ? producto.PreNet : 0, | |
729 | - NEX: producto.IvaCO == 0 ? producto.PreNet : 0, | |
720 | + NET: producto.IvaCO !== 0 ? producto.PreNet : 0, | |
721 | + NEX: producto.IvaCO === 0 ? producto.PreNet : 0, | |
730 | 722 | IMI: producto.ImpInt, |
731 | 723 | IMI2: producto.ImpInt2, |
732 | 724 | IMI3: producto.ImpInt3, |
... | ... | @@ -832,7 +824,7 @@ angular.module('focaCrearFactura').controller('facturaController', [ |
832 | 824 | |
833 | 825 | }) |
834 | 826 | .catch(function (err) { |
835 | - console.log(err) | |
827 | + console.log(err); | |
836 | 828 | reject(); |
837 | 829 | }); |
838 | 830 | }); |
... | ... | @@ -864,7 +856,7 @@ angular.module('focaCrearFactura').controller('facturaController', [ |
864 | 856 | } else { |
865 | 857 | $location.path('/'); |
866 | 858 | } |
867 | - } | |
859 | + }; | |
868 | 860 | |
869 | 861 | function setearFactura(factura) { |
870 | 862 | |
... | ... | @@ -928,7 +920,7 @@ angular.module('focaCrearFactura').controller('facturaController', [ |
928 | 920 | } |
929 | 921 | |
930 | 922 | $scope.cambioEdit = function (articulo, propiedad) { |
931 | - if (propiedad === 'cantidad' && articulo.SUR == 0) { | |
923 | + if (propiedad === 'cantidad' && articulo.SUR === 0) { | |
932 | 924 | articulo.editCantidad = true; |
933 | 925 | } |
934 | 926 | }; |
... | ... | @@ -1017,5 +1009,19 @@ angular.module('focaCrearFactura').controller('facturaController', [ |
1017 | 1009 | |
1018 | 1010 | return importe; |
1019 | 1011 | } |
1012 | + | |
1013 | + function getNumeroFactura(tipoFactura) { | |
1014 | + | |
1015 | + crearRemitoService.getNumeroRemito(tipoFactura).then( | |
1016 | + function (res) { | |
1017 | + $scope.puntoVenta = rellenar(res.data.sucursal, 4); | |
1018 | + $scope.comprobante = rellenar(res.data.numeroRemito, 8); | |
1019 | + }, | |
1020 | + function (err) { | |
1021 | + focaModalService.alert('La terminal no esta configurada correctamente'); | |
1022 | + console.info(err); | |
1023 | + } | |
1024 | + ); | |
1025 | + } | |
1020 | 1026 | } |
1021 | 1027 | ]); |