Commit 3c53f4cc0e3c039238a812f3720e71ccff4c1e6e
1 parent
81e4b37a46
Exists in
master
agrego foca-botonera-facturador
Showing
5 changed files
with
192 additions
and
211 deletions
Show diff stats
index.html
1 | <html ng-app="focaCrearNotaPedido"> | 1 | <html ng-app="focaCrearNotaPedido"> |
2 | <head> | 2 | <head> |
3 | <meta charset="UTF-8"/> | 3 | <meta charset="UTF-8"/> |
4 | <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no"> | 4 | <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no"> |
5 | 5 | ||
6 | <!--CSS--> | 6 | <!--CSS--> |
7 | <link href="node_modules/bootstrap/dist/css/bootstrap.min.css" rel="stylesheet"/> | 7 | <link href="node_modules/bootstrap/dist/css/bootstrap.min.css" rel="stylesheet"/> |
8 | <link href="node_modules/font-awesome/css/font-awesome.min.css" rel="stylesheet"/> | 8 | <link href="node_modules/font-awesome/css/font-awesome.min.css" rel="stylesheet"/> |
9 | <link href="node_modules/ladda/dist/ladda-themeless.min.css" rel="stylesheet"> | 9 | <link href="node_modules/ladda/dist/ladda-themeless.min.css" rel="stylesheet"> |
10 | 10 | ||
11 | <!--VENDOR JS--> | 11 | <!--VENDOR JS--> |
12 | <script src="node_modules/jquery/dist/jquery.min.js"></script> | 12 | <script src="node_modules/jquery/dist/jquery.min.js"></script> |
13 | <script src="node_modules/bootstrap/dist/js/bootstrap.min.js"></script> | 13 | <script src="node_modules/bootstrap/dist/js/bootstrap.min.js"></script> |
14 | <script src="node_modules/angular/angular.min.js"></script> | 14 | <script src="node_modules/angular/angular.min.js"></script> |
15 | <script src="node_modules/angular-route/angular-route.min.js"></script> | 15 | <script src="node_modules/angular-route/angular-route.min.js"></script> |
16 | <script src="node_modules/ui-bootstrap4/dist/ui-bootstrap-tpls.js"></script> | 16 | <script src="node_modules/ui-bootstrap4/dist/ui-bootstrap-tpls.js"></script> |
17 | <script src="node_modules/ladda/dist/spin.min.js"></script> | 17 | <script src="node_modules/ladda/dist/spin.min.js"></script> |
18 | <script src="node_modules/ladda/dist/ladda.min.js"></script> | 18 | <script src="node_modules/ladda/dist/ladda.min.js"></script> |
19 | <script src="node_modules/angular-ladda/dist/angular-ladda.min.js"></script> | 19 | <script src="node_modules/angular-ladda/dist/angular-ladda.min.js"></script> |
20 | <script src="vendor/cordovaGeolocationModule.min.js"></script> | 20 | <script src="vendor/cordovaGeolocationModule.min.js"></script> |
21 | 21 | ||
22 | <script src="node_modules/foca-directivas/dist/foca-directivas.min.js"></script> | 22 | <script src="node_modules/foca-directivas/dist/foca-directivas.min.js"></script> |
23 | <script src="node_modules/foca-botonera-facturador/dist/foca-botonera-facturador.min.js"></script> | ||
23 | <script src="node_modules/foca-modal-vendedores/dist/foca-modal-vendedores.min.js"></script> | 24 | <script src="node_modules/foca-modal-vendedores/dist/foca-modal-vendedores.min.js"></script> |
24 | <script src="node_modules/foca-modal-busqueda-productos/dist/foca-busqueda-productos.min.js"></script> | 25 | <script src="node_modules/foca-modal-busqueda-productos/dist/foca-busqueda-productos.min.js"></script> |
25 | <script src="node_modules/foca-modal-proveedor/dist/foca-modal-proveedor.min.js"></script> | 26 | <script src="node_modules/foca-modal-proveedor/dist/foca-modal-proveedor.min.js"></script> |
26 | <script src="node_modules/foca-busqueda-cliente/dist/foca-busqueda-cliente.min.js"></script> | 27 | <script src="node_modules/foca-busqueda-cliente/dist/foca-busqueda-cliente.min.js"></script> |
27 | <script src="node_modules/foca-modal-precio-condiciones/dist/foca-modal-precio-condiciones.min.js"></script> | 28 | <script src="node_modules/foca-modal-precio-condiciones/dist/foca-modal-precio-condiciones.min.js"></script> |
28 | <script src="node_modules/foca-modal-flete/dist/foca-modal-flete.min.js"></script> | 29 | <script src="node_modules/foca-modal-flete/dist/foca-modal-flete.min.js"></script> |
29 | <script src="node_modules/foca-modal/dist/foca-modal.min.js"></script> | 30 | <script src="node_modules/foca-modal/dist/foca-modal.min.js"></script> |
30 | <script src="node_modules/foca-modal-domicilio/dist/foca-modal-domicilios.min.js"></script> | 31 | <script src="node_modules/foca-modal-domicilio/dist/foca-modal-domicilios.min.js"></script> |
31 | <script src="node_modules/foca-modal-moneda/dist/foca-modal-moneda.min.js"></script> | 32 | <script src="node_modules/foca-modal-moneda/dist/foca-modal-moneda.min.js"></script> |
32 | <script src="node_modules/foca-modal-cotizacion/dist/foca-modal-cotizacion.min.js"></script> | 33 | <script src="node_modules/foca-modal-cotizacion/dist/foca-modal-cotizacion.min.js"></script> |
33 | <script src="node_modules/foca-seguimiento/dist/foca-seguimiento.min.js"></script> | 34 | <script src="node_modules/foca-seguimiento/dist/foca-seguimiento.min.js"></script> |
34 | 35 | ||
35 | <script src="src/js/app.js"></script> | 36 | <script src="src/js/app.js"></script> |
36 | <script src="src/js/controller.js"></script> | 37 | <script src="src/js/controller.js"></script> |
37 | <script src="src/js/service.js"></script> | 38 | <script src="src/js/service.js"></script> |
38 | <script src="src/js/businessService.js"></script> | 39 | <script src="src/js/businessService.js"></script> |
39 | <script src="src/js/route.js"></script> | 40 | <script src="src/js/route.js"></script> |
40 | 41 | ||
41 | <script src="src/etc/develop.js"></script> | 42 | <script src="src/etc/develop.js"></script> |
42 | </head> | 43 | </head> |
43 | <body> | 44 | <body> |
44 | <div ng-view class="container-fluid"></div> | 45 | <div ng-view class="container-fluid"></div> |
45 | </body> | 46 | </body> |
46 | </html> | 47 | </html> |
47 | 48 |
package.json
1 | { | 1 | { |
2 | "name": "foca-crear-nota-pedido", | 2 | "name": "foca-crear-nota-pedido", |
3 | "version": "0.0.1", | 3 | "version": "0.0.1", |
4 | "description": "Listado y ABM nota de pedidos", | 4 | "description": "Listado y ABM nota de pedidos", |
5 | "main": "index.js", | 5 | "main": "index.js", |
6 | "scripts": { | 6 | "scripts": { |
7 | "test": "echo \"Error: no test specified\" && exit 1", | 7 | "test": "echo \"Error: no test specified\" && exit 1", |
8 | "compile": "gulp uglify", | 8 | "compile": "gulp uglify", |
9 | "gulp-pre-commit": "gulp pre-commit", | 9 | "gulp-pre-commit": "gulp pre-commit", |
10 | "postinstall": "npm run compile && gulp clean-post-install", | 10 | "postinstall": "npm run compile && gulp clean-post-install", |
11 | "install-dev": "npm install -D jasmine-core pre-commit angular angular-ladda ladda@1.0.6 angular-route 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 git+https://debo.suite.repo/modulos-npm/foca-directivas.git git+https://debo.suite.repo/modulos-npm/foca-modal-vendedores.git git+https://debo.suite.repo/modulos-npm/foca-modal-proveedor.git git+https://debo.suite.repo/modulos-npm/foca-modal-busqueda-productos git+https://debo.suite.repo/modulos-npm/foca-busqueda-cliente.git git+https://debo.suite.repo/modulos-npm/foca-modal-precio-condiciones.git git+https://debo.suite.repo/modulos-npm/foca-modal-flete git+https://debo.suite.repo/modulos-npm/foca-modal.git git+https://debo.suite.repo/modulos-npm/foca-modal-domicilio.git git+https://debo.suite.repo/modulos-npm/foca-seguimiento.git git+https://debo.suite.repo/modulos-npm/foca-modal-moneda.git git+https://debo.suite.repo/modulos-npm/foca-modal-cotizacion.git" | 11 | "install-dev": "npm install -D jasmine-core pre-commit angular angular-ladda ladda@1.0.6 angular-route 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 git+http://git.focasoftware.com/npm/foca-directivas.git git+http://git.focasoftware.com/npm/foca-modal-vendedores.git git+http://git.focasoftware.com/npm/foca-modal-proveedor.git git+http://git.focasoftware.com/npm/foca-modal-busqueda-productos.git git+http://git.focasoftware.com/npm/foca-busqueda-cliente.git git+http://git.focasoftware.com/npm/foca-modal-precio-condiciones.git git+http://git.focasoftware.com/npm/foca-modal-flete.git git+http://git.focasoftware.com/npm/foca-modal.git git+http://git.focasoftware.com/npm/foca-modal-domicilio.git git+http://git.focasoftware.com/npm/foca-seguimiento.git git+http://git.focasoftware.com/npm/foca-modal-moneda.git git+http://git.focasoftware.com/npm/foca-modal-cotizacion.git" |
12 | }, | 12 | }, |
13 | "pre-commit": [ | 13 | "pre-commit": [ |
14 | "gulp-pre-commit" | 14 | "gulp-pre-commit" |
15 | ], | 15 | ], |
16 | "repository": { | 16 | "repository": { |
17 | "type": "git", | 17 | "type": "git", |
18 | "url": "https://debo.suite.repo/modulos-npm/foca-crear-nota-pedido.git" | 18 | "url": "https://debo.suite.repo/modulos-npm/foca-crear-nota-pedido.git" |
19 | }, | 19 | }, |
20 | "author": "Foca Software", | 20 | "author": "Foca Software", |
21 | "license": "ISC", | 21 | "license": "ISC", |
22 | "peerDependencies": { | 22 | "peerDependencies": { |
23 | "foca-busqueda-cliente": "git+https://debo.suite.repo/modulos-npm/foca-busqueda-cliente.git", | 23 | "foca-botonera-facturador": "git+http://git.focasoftware.com/npm/foca-botonera-facturador.git", |
24 | "foca-directivas": "git+https://debo.suite.repo/modulos-npm/foca-directivas.git", | 24 | "foca-busqueda-cliente": "git+http://git.focasoftware.com/npm/foca-busqueda-cliente.git", |
25 | "foca-modal": "git+https://debo.suite.repo/modulos-npm/foca-modal.git", | 25 | "foca-directivas": "git+http://git.focasoftware.com/npm/foca-directivas.git", |
26 | "foca-modal-busqueda-productos": "git+https://debo.suite.repo/modulos-npm/foca-modal-busqueda-productos", | 26 | "foca-modal": "git+http://git.focasoftware.com/npm/foca-modal.git", |
27 | "foca-modal-cotizacion": "git+https://debo.suite.repo/modulos-npm/foca-modal-cotizacion.git", | 27 | "foca-modal-busqueda-productos": "git+http://git.focasoftware.com/npm/foca-modal-busqueda-productos.git", |
28 | "foca-modal-domicilio": "git+https://debo.suite.repo/modulos-npm/foca-modal-domicilio.git", | 28 | "foca-modal-cotizacion": "git+http://git.focasoftware.com/npm/foca-modal-cotizacion.git", |
29 | "foca-modal-flete": "git+https://debo.suite.repo/modulos-npm/foca-modal-flete", | 29 | "foca-modal-domicilio": "git+http://git.focasoftware.com/npm/foca-modal-domicilio.git", |
30 | "foca-modal-moneda": "git+https://debo.suite.repo/modulos-npm/foca-modal-moneda.git", | 30 | "foca-modal-flete": "git+http://git.focasoftware.com/npm/foca-modal-flete.git", |
31 | "foca-modal-precio-condiciones": "git+https://debo.suite.repo/modulos-npm/foca-modal-precio-condiciones.git", | 31 | "foca-modal-moneda": "git+http://git.focasoftware.com/npm/foca-modal-moneda.git", |
32 | "foca-modal-proveedor": "git+https://debo.suite.repo/modulos-npm/foca-modal-proveedor.git", | 32 | "foca-modal-precio-condiciones": "git+http://git.focasoftware.com/npm/foca-modal-precio-condiciones.git", |
33 | "foca-modal-vendedores": "git+https://debo.suite.repo/modulos-npm/foca-modal-vendedores.git", | 33 | "foca-modal-proveedor": "git+http://git.focasoftware.com/npm/foca-modal-proveedor.git", |
34 | "foca-seguimiento": "git+https://debo.suite.repo/modulos-npm/foca-seguimiento.git" | 34 | "foca-modal-vendedores": "git+http://git.focasoftware.com/npm/foca-modal-vendedores.git", |
35 | "foca-seguimiento": "git+http://git.focasoftware.com/npm/foca-seguimiento.git" | ||
35 | }, | 36 | }, |
36 | "devDependencies": { | 37 | "devDependencies": { |
37 | "angular": "^1.7.5", | 38 | "angular": "^1.7.5", |
38 | "angular-ladda": "^0.4.3", | 39 | "angular-ladda": "^0.4.3", |
39 | "angular-route": "^1.7.5", | 40 | "angular-route": "^1.7.5", |
40 | "bootstrap": "^4.1.3", | 41 | "bootstrap": "^4.1.3", |
41 | "foca-busqueda-cliente": "git+https://debo.suite.repo/modulos-npm/foca-busqueda-cliente.git", | 42 | "foca-busqueda-cliente": "git+http://git.focasoftware.com/npm/foca-busqueda-cliente.git", |
42 | "foca-directivas": "git+https://debo.suite.repo/modulos-npm/foca-directivas.git", | 43 | "foca-directivas": "git+http://git.focasoftware.com/npm/foca-directivas.git", |
43 | "foca-modal": "git+https://debo.suite.repo/modulos-npm/foca-modal.git", | 44 | "foca-modal": "git+http://git.focasoftware.com/npm/foca-modal.git", |
44 | "foca-modal-busqueda-productos": "git+https://debo.suite.repo/modulos-npm/foca-modal-busqueda-productos", | 45 | "foca-modal-busqueda-productos": "git+http://git.focasoftware.com/npm/foca-modal-busqueda-productos.git", |
45 | "foca-modal-cotizacion": "git+https://debo.suite.repo/modulos-npm/foca-modal-cotizacion.git", | 46 | "foca-modal-cotizacion": "git+http://git.focasoftware.com/npm/foca-modal-cotizacion.git", |
46 | "foca-modal-domicilio": "git+https://debo.suite.repo/modulos-npm/foca-modal-domicilio.git", | 47 | "foca-modal-domicilio": "git+http://git.focasoftware.com/npm/foca-modal-domicilio.git", |
47 | "foca-modal-flete": "git+https://debo.suite.repo/modulos-npm/foca-modal-flete", | 48 | "foca-modal-flete": "git+http://git.focasoftware.com/npm/foca-modal-flete.git", |
48 | "foca-modal-moneda": "git+https://debo.suite.repo/modulos-npm/foca-modal-moneda.git", | 49 | "foca-modal-moneda": "git+http://git.focasoftware.com/npm/foca-modal-moneda.git", |
49 | "foca-modal-precio-condiciones": "git+https://debo.suite.repo/modulos-npm/foca-modal-precio-condiciones.git", | 50 | "foca-modal-precio-condiciones": "git+http://git.focasoftware.com/npm/foca-modal-precio-condiciones.git", |
50 | "foca-modal-proveedor": "git+https://debo.suite.repo/modulos-npm/foca-modal-proveedor.git", | 51 | "foca-modal-proveedor": "git+http://git.focasoftware.com/npm/foca-modal-proveedor.git", |
51 | "foca-modal-vendedores": "git+https://debo.suite.repo/modulos-npm/foca-modal-vendedores.git", | 52 | "foca-modal-vendedores": "git+http://git.focasoftware.com/npm/foca-modal-vendedores.git", |
52 | "foca-seguimiento": "git+https://debo.suite.repo/modulos-npm/foca-seguimiento.git", | 53 | "foca-seguimiento": "git+http://git.focasoftware.com/npm/foca-seguimiento.git", |
53 | "font-awesome": "^4.7.0", | 54 | "font-awesome": "^4.7.0", |
54 | "gulp": "^3.9.1", | 55 | "gulp": "^3.9.1", |
55 | "gulp-angular-templatecache": "^2.2.5", | 56 | "gulp-angular-templatecache": "^2.2.5", |
56 | "gulp-clean": "^0.4.0", | 57 | "gulp-clean": "^0.4.0", |
57 | "gulp-concat": "^2.6.1", | 58 | "gulp-concat": "^2.6.1", |
58 | "gulp-connect": "^5.6.1", | 59 | "gulp-connect": "^5.6.1", |
59 | "gulp-htmlmin": "^5.0.1", | 60 | "gulp-htmlmin": "^5.0.1", |
60 | "gulp-jshint": "^2.1.0", | 61 | "gulp-jshint": "^2.1.0", |
61 | "gulp-rename": "^1.4.0", | 62 | "gulp-rename": "^1.4.0", |
62 | "gulp-replace": "^1.0.0", | 63 | "gulp-replace": "^1.0.0", |
63 | "gulp-sequence": "^1.0.0", | 64 | "gulp-sequence": "^1.0.0", |
64 | "gulp-uglify": "^3.0.1", | 65 | "gulp-uglify": "^3.0.1", |
65 | "gulp-uglify-es": "^1.0.4", | 66 | "gulp-uglify-es": "^1.0.4", |
66 | "jasmine-core": "^3.3.0", | 67 | "jasmine-core": "^3.3.0", |
67 | "jquery": "^3.3.1", | 68 | "jquery": "^3.3.1", |
68 | "jshint": "^2.9.6", | 69 | "jshint": "^2.9.6", |
69 | "ladda": "1.0.6", | 70 | "ladda": "1.0.6", |
70 | "pre-commit": "^1.2.2", | 71 | "pre-commit": "^1.2.2", |
71 | "pump": "^3.0.0", | 72 | "pump": "^3.0.0", |
72 | "ui-bootstrap4": "^3.0.5" | 73 | "ui-bootstrap4": "^3.0.5" |
73 | } | 74 | } |
74 | } | 75 | } |
75 | 76 |
src/js/controller.js
1 | angular.module('focaCrearNotaPedido') .controller('notaPedidoCtrl', | 1 | angular.module('focaCrearNotaPedido') .controller('notaPedidoCtrl', |
2 | [ | 2 | [ |
3 | '$scope', '$uibModal', '$location', '$filter', 'crearNotaPedidoService', | 3 | '$scope', '$uibModal', '$location', '$filter', 'crearNotaPedidoService', |
4 | 'focaModalService', 'notaPedidoBusinessService', '$rootScope', 'focaSeguimientoService', | 4 | 'focaModalService', 'notaPedidoBusinessService', '$rootScope', 'focaSeguimientoService', |
5 | function( | 5 | function( |
6 | $scope, $uibModal, $location, $filter, crearNotaPedidoService, focaModalService, | 6 | $scope, $uibModal, $location, $filter, crearNotaPedidoService, focaModalService, |
7 | notaPedidoBusinessService, $rootScope, focaSeguimientoService) | 7 | notaPedidoBusinessService, $rootScope, focaSeguimientoService) |
8 | { | 8 | { |
9 | $scope.botonera = [ | 9 | |
10 | {texto: 'Vendedor', imagen: '../img/abmPrecios.png', accion: function() { | 10 | $scope.botonera = crearNotaPedidoService.getBotonera(); |
11 | validarNotaRemitada($scope.seleccionarVendedor);}}, | ||
12 | {texto: 'Cliente', imagen: '../img/abmPrecios.png', accion: function() { | ||
13 | validarNotaRemitada($scope.seleccionarCliente);}}, | ||
14 | {texto: 'Proveedor', imagen: '../img/abmPrecios.png', accion: function() { | ||
15 | validarNotaRemitada($scope.seleccionarProveedor);}}, | ||
16 | {texto: 'Moneda', imagen: '../img/abmPrecios.png', accion: function() { | ||
17 | validarNotaRemitada($scope.abrirModalMoneda);}}, | ||
18 | {texto: 'Precios y condiciones', imagen: '../img/abmPrecios.png', | ||
19 | accion: function() { | ||
20 | validarNotaRemitada($scope.abrirModalListaPrecio);}}, | ||
21 | {texto: 'Flete', imagen: '../img/abmPrecios.png', accion: function() { | ||
22 | validarNotaRemitada($scope.abrirModalFlete);}}, | ||
23 | {texto: 'Productos', imagen: '../img/abmPrecios.png', accion: function() { | ||
24 | $scope.seleccionarArticulo(); | ||
25 | }}, | ||
26 | {texto: '', accion: function() {}}, | ||
27 | {texto: '', accion: function() {}}, | ||
28 | {texto: '', accion: function() {}}, | ||
29 | {texto: '', accion: function() {}}, | ||
30 | {texto: '', accion: function() {}} | ||
31 | ]; | ||
32 | 11 | ||
33 | $scope.isNumber = angular.isNumber; | 12 | $scope.isNumber = angular.isNumber; |
34 | $scope.datepickerAbierto = false; | 13 | $scope.datepickerAbierto = false; |
35 | $scope.show = false; | 14 | $scope.show = false; |
36 | $scope.cargando = true; | 15 | $scope.cargando = true; |
37 | $scope.dateOptions = { | 16 | $scope.dateOptions = { |
38 | maxDate: new Date(), | 17 | maxDate: new Date(), |
39 | minDate: new Date(2010, 0, 1) | 18 | minDate: new Date(2010, 0, 1) |
40 | }; | 19 | }; |
41 | 20 | ||
42 | $scope.notaPedido = { | 21 | $scope.notaPedido = { |
43 | id: 0, | 22 | id: 0, |
44 | vendedor: {}, | 23 | vendedor: {}, |
45 | cliente: {}, | 24 | cliente: {}, |
46 | proveedor: {}, | 25 | proveedor: {}, |
47 | domicilio: {dom: ''}, | 26 | domicilio: {dom: ''}, |
48 | moneda: {}, | 27 | moneda: {}, |
49 | cotizacion: {} | 28 | cotizacion: {} |
50 | }; | 29 | }; |
51 | var monedaPorDefecto; | 30 | var monedaPorDefecto; |
52 | //Trabajo con la cotizaciรณn mรกs reciente, por eso uso siempre la primera '[0]' | 31 | //Trabajo con la cotizaciรณn mรกs reciente, por eso uso siempre la primera '[0]' |
53 | crearNotaPedidoService.getCotizacionByIdMoneda(1).then(function(res) { | 32 | crearNotaPedidoService.getCotizacionByIdMoneda(1).then(function(res) { |
54 | monedaPorDefecto = res.data[0]; | 33 | monedaPorDefecto = res.data[0]; |
55 | $scope.notaPedido.moneda = monedaPorDefecto; | 34 | $scope.notaPedido.moneda = monedaPorDefecto; |
56 | $scope.notaPedido.cotizacion = monedaPorDefecto.cotizaciones[0]; | 35 | $scope.notaPedido.cotizacion = monedaPorDefecto.cotizaciones[0]; |
57 | }); | 36 | }); |
58 | 37 | ||
59 | $scope.cabecera = []; | 38 | $scope.cabecera = []; |
60 | $scope.showCabecera = true; | 39 | $scope.showCabecera = true; |
61 | 40 | ||
62 | $scope.now = new Date(); | 41 | $scope.now = new Date(); |
63 | $scope.puntoVenta = '0000'; | 42 | $scope.puntoVenta = '0000'; |
64 | $scope.comprobante = '00000000'; | 43 | $scope.comprobante = '00000000'; |
65 | $scope.articulosTabla = []; | 44 | $scope.articulosTabla = []; |
66 | $scope.idLista = undefined; | 45 | $scope.idLista = undefined; |
67 | 46 | ||
68 | crearNotaPedidoService.getPrecioCondicion().then( | 47 | crearNotaPedidoService.getPrecioCondicion().then( |
69 | function(res) { | 48 | function(res) { |
70 | $scope.precioCondiciones = res.data; | 49 | $scope.precioCondiciones = res.data; |
71 | } | 50 | } |
72 | ); | 51 | ); |
73 | 52 | ||
74 | crearNotaPedidoService.getNumeroNotaPedido().then( | 53 | crearNotaPedidoService.getNumeroNotaPedido().then( |
75 | function(res) { | 54 | function(res) { |
76 | $scope.puntoVenta = rellenar(res.data.sucursal, 4); | 55 | $scope.puntoVenta = rellenar(res.data.sucursal, 4); |
77 | $scope.comprobante = rellenar(res.data.numeroNotaPedido, 8); | 56 | $scope.comprobante = rellenar(res.data.numeroNotaPedido, 8); |
78 | }, | 57 | }, |
79 | function(err) { | 58 | function(err) { |
80 | focaModalService.alert('La terminal no esta configurada correctamente'); | 59 | focaModalService.alert('La terminal no esta configurada correctamente'); |
81 | console.info(err); | 60 | console.info(err); |
82 | } | 61 | } |
83 | ); | 62 | ); |
84 | 63 | ||
85 | $scope.crearNotaPedido = function() { | 64 | $scope.crearNotaPedido = function() { |
86 | if(!$scope.notaPedido.vendedor.CodVen) { | 65 | if(!$scope.notaPedido.vendedor.CodVen) { |
87 | focaModalService.alert('Ingrese Vendedor'); | 66 | focaModalService.alert('Ingrese Vendedor'); |
88 | return; | 67 | return; |
89 | } else if(!$scope.notaPedido.cliente.COD) { | 68 | } else if(!$scope.notaPedido.cliente.COD) { |
90 | focaModalService.alert('Ingrese Cliente'); | 69 | focaModalService.alert('Ingrese Cliente'); |
91 | return; | 70 | return; |
92 | } else if(!$scope.notaPedido.proveedor.COD) { | 71 | } else if(!$scope.notaPedido.proveedor.COD) { |
93 | focaModalService.alert('Ingrese Proveedor'); | 72 | focaModalService.alert('Ingrese Proveedor'); |
94 | return; | 73 | return; |
95 | } else if(!$scope.notaPedido.moneda.ID) { | 74 | } else if(!$scope.notaPedido.moneda.ID) { |
96 | focaModalService.alert('Ingrese Moneda'); | 75 | focaModalService.alert('Ingrese Moneda'); |
97 | return; | 76 | return; |
98 | } else if(!$scope.notaPedido.cotizacion.ID) { | 77 | } else if(!$scope.notaPedido.cotizacion.ID) { |
99 | focaModalService.alert('Ingrese Cotizaciรณn'); | 78 | focaModalService.alert('Ingrese Cotizaciรณn'); |
100 | return; | 79 | return; |
101 | } else if(!$scope.plazosPagos) { | 80 | } else if(!$scope.plazosPagos) { |
102 | focaModalService.alert('Ingrese Precios y Condiciones'); | 81 | focaModalService.alert('Ingrese Precios y Condiciones'); |
103 | return; | 82 | return; |
104 | } else if( | 83 | } else if( |
105 | $scope.notaPedido.flete === undefined || $scope.notaPedido.flete === null) | 84 | $scope.notaPedido.flete === undefined || $scope.notaPedido.flete === null) |
106 | { | 85 | { |
107 | focaModalService.alert('Ingrese Flete'); | 86 | focaModalService.alert('Ingrese Flete'); |
108 | return; | 87 | return; |
109 | } else if(!$scope.notaPedido.domicilioStamp) {//TODO validar domicilio correcto | 88 | } else if(!$scope.notaPedido.domicilioStamp) {//TODO validar domicilio correcto |
110 | focaModalService.alert('Ingrese Domicilio'); | 89 | focaModalService.alert('Ingrese Domicilio'); |
111 | return; | 90 | return; |
112 | } else if($scope.articulosTabla.length === 0) { | 91 | } else if($scope.articulosTabla.length === 0) { |
113 | focaModalService.alert('Debe cargar al menos un articulo'); | 92 | focaModalService.alert('Debe cargar al menos un articulo'); |
114 | return; | 93 | return; |
115 | } | 94 | } |
116 | $scope.saveLoading = true; | 95 | $scope.saveLoading = true; |
117 | var notaPedido = { | 96 | var notaPedido = { |
118 | id: $scope.notaPedido.id, | 97 | id: $scope.notaPedido.id, |
119 | fechaCarga: $scope.now.toISOString().slice(0, 19).replace('T', ' '), | 98 | fechaCarga: $scope.now.toISOString().slice(0, 19).replace('T', ' '), |
120 | idVendedor: $scope.notaPedido.vendedor.CodVen, | 99 | idVendedor: $scope.notaPedido.vendedor.CodVen, |
121 | idCliente: $scope.notaPedido.cliente.COD, | 100 | idCliente: $scope.notaPedido.cliente.COD, |
122 | nombreCliente: $scope.notaPedido.cliente.NOM, | 101 | nombreCliente: $scope.notaPedido.cliente.NOM, |
123 | cuitCliente: $scope.notaPedido.cliente.CUIT, | 102 | cuitCliente: $scope.notaPedido.cliente.CUIT, |
124 | idProveedor: $scope.notaPedido.proveedor.COD, | 103 | idProveedor: $scope.notaPedido.proveedor.COD, |
125 | //idDomicilio: $scope.notaPedido.domicilio.id,TODO GUARDAR DOMICILIO ID | 104 | //idDomicilio: $scope.notaPedido.domicilio.id,TODO GUARDAR DOMICILIO ID |
126 | idCotizacion: $scope.notaPedido.cotizacion.ID, | 105 | idCotizacion: $scope.notaPedido.cotizacion.ID, |
127 | idPrecioCondicion: $scope.notaPedido.idPrecioCondicion, | 106 | idPrecioCondicion: $scope.notaPedido.idPrecioCondicion, |
128 | cotizacion: $scope.notaPedido.cotizacion.VENDEDOR, | 107 | cotizacion: $scope.notaPedido.cotizacion.VENDEDOR, |
129 | flete: $scope.notaPedido.flete, | 108 | flete: $scope.notaPedido.flete, |
130 | fob: $scope.notaPedido.fob, | 109 | fob: $scope.notaPedido.fob, |
131 | bomba: $scope.notaPedido.bomba, | 110 | bomba: $scope.notaPedido.bomba, |
132 | kilometros: $scope.notaPedido.kilometros, | 111 | kilometros: $scope.notaPedido.kilometros, |
133 | domicilioStamp: $scope.notaPedido.domicilioStamp, | 112 | domicilioStamp: $scope.notaPedido.domicilioStamp, |
134 | estado: 0, | 113 | estado: 0, |
135 | total: $scope.getTotal() | 114 | total: $scope.getTotal() |
136 | }; | 115 | }; |
137 | crearNotaPedidoService.crearNotaPedido(notaPedido).then( | 116 | crearNotaPedidoService.crearNotaPedido(notaPedido).then( |
138 | function(data) { | 117 | function(data) { |
139 | // Al guardar los datos de la nota de pedido logueamos la | 118 | // Al guardar los datos de la nota de pedido logueamos la |
140 | // actividad para su seguimiento. | 119 | // actividad para su seguimiento. |
141 | //TODO: GUARDAR POSISIONAMIENTO AL EDITAR? | 120 | //TODO: GUARDAR POSISIONAMIENTO AL EDITAR? |
142 | focaSeguimientoService.guardarPosicion( | 121 | focaSeguimientoService.guardarPosicion( |
143 | data.data.id, | 122 | data.data.id, |
144 | 'Nota de pedido', | 123 | 'Nota de pedido', |
145 | 'Nยบ: ' + $filter('comprobante')([ | 124 | 'Nยบ: ' + $filter('comprobante')([ |
146 | $scope.puntoVenta, | 125 | $scope.puntoVenta, |
147 | $scope.comprobante | 126 | $scope.comprobante |
148 | ]) + '<br/>' + | 127 | ]) + '<br/>' + |
149 | 'Vendedor: ' + $scope.notaPedido.vendedor.NomVen + '<br/>' + | 128 | 'Vendedor: ' + $scope.notaPedido.vendedor.NomVen + '<br/>' + |
150 | 'Total: ' + $filter('currency')($scope.getTotal()) | 129 | 'Total: ' + $filter('currency')($scope.getTotal()) |
151 | ); | 130 | ); |
152 | notaPedidoBusinessService.addArticulos($scope.articulosTabla, | 131 | notaPedidoBusinessService.addArticulos($scope.articulosTabla, |
153 | data.data.id, $scope.notaPedido.cotizacion.VENDEDOR); | 132 | data.data.id, $scope.notaPedido.cotizacion.VENDEDOR); |
154 | var plazos = $scope.plazosPagos; | 133 | var plazos = $scope.plazosPagos; |
155 | 134 | ||
156 | for(var j = 0; j < plazos.length; j++) { | 135 | for(var j = 0; j < plazos.length; j++) { |
157 | var json = { | 136 | var json = { |
158 | idPedido: data.data.id, | 137 | idPedido: data.data.id, |
159 | dias: plazos[j].dias | 138 | dias: plazos[j].dias |
160 | }; | 139 | }; |
161 | crearNotaPedidoService.crearPlazosParaNotaPedido(json); | 140 | crearNotaPedidoService.crearPlazosParaNotaPedido(json); |
162 | } | 141 | } |
163 | notaPedidoBusinessService.addEstado(data.data.id, | 142 | notaPedidoBusinessService.addEstado(data.data.id, |
164 | $scope.notaPedido.vendedor.CodVen); | 143 | $scope.notaPedido.vendedor.CodVen); |
165 | 144 | ||
166 | focaModalService.alert('Nota pedido creada'); | 145 | focaModalService.alert('Nota pedido creada'); |
167 | $scope.saveLoading = false; | 146 | $scope.saveLoading = false; |
168 | $scope.cabecera = []; | 147 | $scope.cabecera = []; |
169 | addCabecera('Moneda:', $scope.notaPedido.moneda.DETALLE); | 148 | addCabecera('Moneda:', $scope.notaPedido.moneda.DETALLE); |
170 | addCabecera( | 149 | addCabecera( |
171 | 'Fecha cotizacion:', | 150 | 'Fecha cotizacion:', |
172 | $filter('date')($scope.notaPedido.cotizacion.FECHA, 'dd/MM/yyyy') | 151 | $filter('date')($scope.notaPedido.cotizacion.FECHA, 'dd/MM/yyyy') |
173 | ); | 152 | ); |
174 | addCabecera('Cotizacion:', $scope.notaPedido.cotizacion.VENDEDOR); | 153 | addCabecera('Cotizacion:', $scope.notaPedido.cotizacion.VENDEDOR); |
175 | crearNotaPedidoService.getNumeroNotaPedido().then( | 154 | crearNotaPedidoService.getNumeroNotaPedido().then( |
176 | function(res) { | 155 | function(res) { |
177 | $scope.puntoVenta = rellenar(res.data.sucursal, 4); | 156 | $scope.puntoVenta = rellenar(res.data.sucursal, 4); |
178 | $scope.comprobante = rellenar(res.data.numeroNotaPedido, 8); | 157 | $scope.comprobante = rellenar(res.data.numeroNotaPedido, 8); |
179 | }, | 158 | }, |
180 | function(err) { | 159 | function(err) { |
181 | focaModalService.alert( | 160 | focaModalService.alert( |
182 | 'La terminal no esta configurada correctamente'); | 161 | 'La terminal no esta configurada correctamente'); |
183 | console.info(err); | 162 | console.info(err); |
184 | } | 163 | } |
185 | ); | 164 | ); |
186 | $scope.notaPedido.vendedor = {}; | 165 | $scope.notaPedido.vendedor = {}; |
187 | $scope.notaPedido.cliente = {}; | 166 | $scope.notaPedido.cliente = {}; |
188 | $scope.notaPedido.proveedor = {}; | 167 | $scope.notaPedido.proveedor = {}; |
189 | $scope.notaPedido.domicilio = {}; | 168 | $scope.notaPedido.domicilio = {}; |
190 | $scope.notaPedido.flete = null; | 169 | $scope.notaPedido.flete = null; |
191 | $scope.notaPedido.fob = null; | 170 | $scope.notaPedido.fob = null; |
192 | $scope.notaPedido.bomba = null; | 171 | $scope.notaPedido.bomba = null; |
193 | $scope.notaPedido.kilometros = null; | 172 | $scope.notaPedido.kilometros = null; |
194 | $scope.articulosTabla = []; | 173 | $scope.articulosTabla = []; |
195 | }, | 174 | }, |
196 | function(error) { | 175 | function(error) { |
197 | focaModalService.alert('Hubo un error al crear la nota de pedido'); | 176 | focaModalService.alert('Hubo un error al crear la nota de pedido'); |
198 | $scope.saveLoading = false; | 177 | $scope.saveLoading = false; |
199 | console.info(error); | 178 | console.info(error); |
200 | } | 179 | } |
201 | ); | 180 | ); |
202 | }; | 181 | }; |
203 | 182 | ||
204 | $scope.seleccionarNotaPedido = function() { | 183 | $scope.seleccionarNotaPedido = function() { |
205 | var modalInstance = $uibModal.open( | 184 | var modalInstance = $uibModal.open( |
206 | { | 185 | { |
207 | ariaLabelledBy: 'Busqueda de Nota de Pedido', | 186 | ariaLabelledBy: 'Busqueda de Nota de Pedido', |
208 | templateUrl: 'foca-modal-nota-pedido.html', | 187 | templateUrl: 'foca-modal-nota-pedido.html', |
209 | controller: 'focaModalNotaPedidoController', | 188 | controller: 'focaModalNotaPedidoController', |
210 | size: 'lg', | 189 | size: 'lg', |
211 | resolve: {usadoPor: function() {return 'notaPedido';}} | 190 | resolve: {usadoPor: function() {return 'notaPedido';}} |
212 | } | 191 | } |
213 | ); | 192 | ); |
214 | modalInstance.result.then( | 193 | modalInstance.result.then( |
215 | function(notaPedido) { | 194 | function(notaPedido) { |
216 | $scope.now = new Date(notaPedido.fechaCarga); | 195 | $scope.now = new Date(notaPedido.fechaCarga); |
217 | //aรฑado cabeceras | 196 | //aรฑado cabeceras |
218 | $scope.notaPedido.id = notaPedido.id; | 197 | $scope.notaPedido.id = notaPedido.id; |
219 | removeCabecera('Bomba:'); | 198 | removeCabecera('Bomba:'); |
220 | removeCabecera('Kilometros:'); | 199 | removeCabecera('Kilometros:'); |
221 | var cabeceras = [ | 200 | var cabeceras = [ |
222 | { | 201 | { |
223 | label: 'Moneda:', | 202 | label: 'Moneda:', |
224 | valor: notaPedido.cotizacion.moneda.DETALLE | 203 | valor: notaPedido.cotizacion.moneda.DETALLE |
225 | }, | 204 | }, |
226 | { | 205 | { |
227 | label: 'Fecha cotizacion:', | 206 | label: 'Fecha cotizacion:', |
228 | valor: $filter('date')(notaPedido.cotizacion.FECHA, | 207 | valor: $filter('date')(notaPedido.cotizacion.FECHA, |
229 | 'dd/MM/yyyy') | 208 | 'dd/MM/yyyy') |
230 | }, | 209 | }, |
231 | { | 210 | { |
232 | label: 'Cotizacion:', | 211 | label: 'Cotizacion:', |
233 | valor: notaPedido.cotizacion.VENDEDOR | 212 | valor: notaPedido.cotizacion.VENDEDOR |
234 | }, | 213 | }, |
235 | { | 214 | { |
236 | label: 'Cliente:', | 215 | label: 'Cliente:', |
237 | valor: notaPedido.cliente.NOM | 216 | valor: notaPedido.cliente.NOM |
238 | }, | 217 | }, |
239 | { | 218 | { |
240 | label: 'Domicilio:', | 219 | label: 'Domicilio:', |
241 | valor: notaPedido.domicilioStamp | 220 | valor: notaPedido.domicilioStamp |
242 | }, | 221 | }, |
243 | { | 222 | { |
244 | label: 'Vendedor:', | 223 | label: 'Vendedor:', |
245 | valor: notaPedido.vendedor.NomVen | 224 | valor: notaPedido.vendedor.NomVen |
246 | }, | 225 | }, |
247 | { | 226 | { |
248 | label: 'Proveedor:', | 227 | label: 'Proveedor:', |
249 | valor: notaPedido.proveedor.NOM | 228 | valor: notaPedido.proveedor.NOM |
250 | }, | 229 | }, |
251 | { | 230 | { |
252 | label: 'Precio condicion:', | 231 | label: 'Precio condicion:', |
253 | valor: valorPrecioCondicion() + ' ' + | 232 | valor: valorPrecioCondicion() + ' ' + |
254 | notaPedidoBusinessService | 233 | notaPedidoBusinessService |
255 | .plazoToString(notaPedido.notaPedidoPlazo) | 234 | .plazoToString(notaPedido.notaPedidoPlazo) |
256 | }, | 235 | }, |
257 | { | 236 | { |
258 | label: 'Flete:', | 237 | label: 'Flete:', |
259 | valor: notaPedido.fob === 1 ? 'FOB' : ( | 238 | valor: notaPedido.fob === 1 ? 'FOB' : ( |
260 | notaPedido.flete === 1 ? 'Si' : 'No') | 239 | notaPedido.flete === 1 ? 'Si' : 'No') |
261 | } | 240 | } |
262 | ]; | 241 | ]; |
263 | 242 | ||
264 | function valorPrecioCondicion() { | 243 | function valorPrecioCondicion() { |
265 | if(notaPedido.idPrecioCondicion > 0) { | 244 | if(notaPedido.idPrecioCondicion > 0) { |
266 | return notaPedido.precioCondicion.nombre; | 245 | return notaPedido.precioCondicion.nombre; |
267 | } else { | 246 | } else { |
268 | return 'Ingreso Manual'; | 247 | return 'Ingreso Manual'; |
269 | } | 248 | } |
270 | } | 249 | } |
271 | 250 | ||
272 | if(notaPedido.flete === 1) { | 251 | if(notaPedido.flete === 1) { |
273 | var cabeceraBomba = { | 252 | var cabeceraBomba = { |
274 | label: 'Bomba:', | 253 | label: 'Bomba:', |
275 | valor: notaPedido.bomba === 1 ? 'Si' : 'No' | 254 | valor: notaPedido.bomba === 1 ? 'Si' : 'No' |
276 | }; | 255 | }; |
277 | if(notaPedido.kilometros) { | 256 | if(notaPedido.kilometros) { |
278 | var cabeceraKilometros = { | 257 | var cabeceraKilometros = { |
279 | label: 'Kilometros:', | 258 | label: 'Kilometros:', |
280 | valor: notaPedido.kilometros | 259 | valor: notaPedido.kilometros |
281 | }; | 260 | }; |
282 | cabeceras.push(cabeceraKilometros); | 261 | cabeceras.push(cabeceraKilometros); |
283 | } | 262 | } |
284 | cabeceras.push(cabeceraBomba); | 263 | cabeceras.push(cabeceraBomba); |
285 | } | 264 | } |
286 | $scope.articulosTabla = notaPedido.articulosNotaPedido; | 265 | $scope.articulosTabla = notaPedido.articulosNotaPedido; |
287 | notaPedidoBusinessService.calcularArticulos($scope.articulosTabla, | 266 | notaPedidoBusinessService.calcularArticulos($scope.articulosTabla, |
288 | notaPedido.cotizacion.VENDEDOR); | 267 | notaPedido.cotizacion.VENDEDOR); |
289 | if(notaPedido.idPrecioCondicion > 0) { | 268 | if(notaPedido.idPrecioCondicion > 0) { |
290 | $scope.idLista = notaPedido.precioCondicion.idListaPrecio; | 269 | $scope.idLista = notaPedido.precioCondicion.idListaPrecio; |
291 | } else { | 270 | } else { |
292 | $scope.idLista = -1; | 271 | $scope.idLista = -1; |
293 | } | 272 | } |
294 | $scope.puntoVenta = rellenar(notaPedido.sucursal, 4); | 273 | $scope.puntoVenta = rellenar(notaPedido.sucursal, 4); |
295 | $scope.comprobante = rellenar(notaPedido.numeroNotaPedido, 8); | 274 | $scope.comprobante = rellenar(notaPedido.numeroNotaPedido, 8); |
296 | $scope.notaPedido = notaPedido; | 275 | $scope.notaPedido = notaPedido; |
297 | $scope.notaPedido.moneda = notaPedido.cotizacion.moneda; | 276 | $scope.notaPedido.moneda = notaPedido.cotizacion.moneda; |
298 | $scope.plazosPagos = notaPedido.notaPedidoPlazo; | 277 | $scope.plazosPagos = notaPedido.notaPedidoPlazo; |
299 | addArrayCabecera(cabeceras); | 278 | addArrayCabecera(cabeceras); |
300 | 279 | ||
301 | }, function() { | 280 | }, function() { |
302 | // funcion ejecutada cuando se cancela el modal | 281 | // funcion ejecutada cuando se cancela el modal |
303 | } | 282 | } |
304 | ); | 283 | ); |
305 | }; | 284 | }; |
306 | 285 | ||
307 | $scope.seleccionarArticulo = function() { | 286 | $scope.seleccionarProductos = function() { |
308 | if ($scope.idLista === undefined) { | 287 | if ($scope.idLista === undefined) { |
309 | focaModalService.alert( | 288 | focaModalService.alert( |
310 | 'Primero seleccione una lista de precio y condicion'); | 289 | 'Primero seleccione una lista de precio y condicion'); |
311 | return; | 290 | return; |
312 | } | 291 | } |
313 | var modalInstance = $uibModal.open( | 292 | var modalInstance = $uibModal.open( |
314 | { | 293 | { |
315 | ariaLabelledBy: 'Busqueda de Productos', | 294 | ariaLabelledBy: 'Busqueda de Productos', |
316 | templateUrl: 'modal-busqueda-productos.html', | 295 | templateUrl: 'modal-busqueda-productos.html', |
317 | controller: 'modalBusquedaProductosCtrl', | 296 | controller: 'modalBusquedaProductosCtrl', |
318 | resolve: { | 297 | resolve: { |
319 | parametroProducto: { | 298 | parametroProducto: { |
320 | idLista: $scope.idLista, | 299 | idLista: $scope.idLista, |
321 | cotizacion: $scope.notaPedido.cotizacion.VENDEDOR, | 300 | cotizacion: $scope.notaPedido.cotizacion.VENDEDOR, |
322 | simbolo: $scope.notaPedido.moneda.SIMBOLO | 301 | simbolo: $scope.notaPedido.moneda.SIMBOLO |
323 | } | 302 | } |
324 | }, | 303 | }, |
325 | size: 'lg' | 304 | size: 'lg' |
326 | } | 305 | } |
327 | ); | 306 | ); |
328 | modalInstance.result.then( | 307 | modalInstance.result.then( |
329 | function(producto) { | 308 | function(producto) { |
330 | var newArt = | 309 | var newArt = |
331 | { | 310 | { |
332 | id: 0, | 311 | id: 0, |
333 | codigo: producto.codigo, | 312 | codigo: producto.codigo, |
334 | sector: producto.sector, | 313 | sector: producto.sector, |
335 | sectorCodigo: producto.sector + '-' + producto.codigo, | 314 | sectorCodigo: producto.sector + '-' + producto.codigo, |
336 | descripcion: producto.descripcion, | 315 | descripcion: producto.descripcion, |
337 | item: $scope.articulosTabla.length + 1, | 316 | item: $scope.articulosTabla.length + 1, |
338 | nombre: producto.descripcion, | 317 | nombre: producto.descripcion, |
339 | precio: parseFloat(producto.precio.toFixed(4)), | 318 | precio: parseFloat(producto.precio.toFixed(4)), |
340 | costoUnitario: producto.costo, | 319 | costoUnitario: producto.costo, |
341 | editCantidad: false, | 320 | editCantidad: false, |
342 | editPrecio: false, | 321 | editPrecio: false, |
343 | rubro: producto.CodRub, | 322 | rubro: producto.CodRub, |
344 | exentoUnitario: producto.precio, | 323 | exentoUnitario: producto.precio, |
345 | ivaUnitario: producto.IMPIVA, | 324 | ivaUnitario: producto.IMPIVA, |
346 | impuestoInternoUnitario: producto.ImpInt, | 325 | impuestoInternoUnitario: producto.ImpInt, |
347 | impuestoInterno1Unitario: producto.ImpInt2, | 326 | impuestoInterno1Unitario: producto.ImpInt2, |
348 | impuestoInterno2Unitario: producto.ImpInt3, | 327 | impuestoInterno2Unitario: producto.ImpInt3, |
349 | precioLista: producto.precio, | 328 | precioLista: producto.precio, |
350 | combustible: 1, | 329 | combustible: 1, |
351 | facturado: 0 | 330 | facturado: 0 |
352 | }; | 331 | }; |
353 | $scope.articuloACargar = newArt; | 332 | $scope.articuloACargar = newArt; |
354 | $scope.cargando = false; | 333 | $scope.cargando = false; |
355 | }, function() { | 334 | }, function() { |
356 | // funcion ejecutada cuando se cancela el modal | 335 | // funcion ejecutada cuando se cancela el modal |
357 | } | 336 | } |
358 | ); | 337 | ); |
359 | }; | 338 | }; |
360 | 339 | ||
361 | $scope.seleccionarVendedor = function() { | 340 | $scope.seleccionarVendedor = function() { |
362 | var modalInstance = $uibModal.open( | 341 | if(validarNotaRemitada()) { |
363 | { | 342 | var modalInstance = $uibModal.open( |
364 | ariaLabelledBy: 'Busqueda de Vendedores', | 343 | { |
365 | templateUrl: 'modal-vendedores.html', | 344 | ariaLabelledBy: 'Busqueda de Vendedores', |
366 | controller: 'modalVendedoresCtrl', | 345 | templateUrl: 'modal-vendedores.html', |
367 | size: 'lg' | 346 | controller: 'modalVendedoresCtrl', |
368 | } | 347 | size: 'lg' |
369 | ); | 348 | } |
370 | modalInstance.result.then( | 349 | ); |
371 | function(vendedor) { | 350 | modalInstance.result.then( |
372 | addCabecera('Vendedor:', vendedor.NomVen); | 351 | function(vendedor) { |
373 | $scope.notaPedido.vendedor = vendedor; | 352 | addCabecera('Vendedor:', vendedor.NomVen); |
374 | }, function() { | 353 | $scope.notaPedido.vendedor = vendedor; |
375 | 354 | }, function() { | |
376 | } | 355 | |
377 | ); | 356 | } |
357 | ); | ||
358 | } | ||
378 | }; | 359 | }; |
379 | 360 | ||
380 | $scope.seleccionarProveedor = function() { | 361 | $scope.seleccionarProveedor = function() { |
381 | var modalInstance = $uibModal.open( | 362 | if(validarNotaRemitada()) { |
382 | { | 363 | var modalInstance = $uibModal.open( |
383 | ariaLabelledBy: 'Busqueda de Proveedor', | 364 | { |
384 | templateUrl: 'modal-proveedor.html', | 365 | ariaLabelledBy: 'Busqueda de Proveedor', |
385 | controller: 'focaModalProveedorCtrl', | 366 | templateUrl: 'modal-proveedor.html', |
386 | size: 'lg', | 367 | controller: 'focaModalProveedorCtrl', |
387 | resolve: { | 368 | size: 'lg', |
388 | transportista: function() { | 369 | resolve: { |
389 | return false; | 370 | transportista: function() { |
371 | return false; | ||
372 | } | ||
390 | } | 373 | } |
391 | } | 374 | } |
392 | } | 375 | ); |
393 | ); | 376 | modalInstance.result.then( |
394 | modalInstance.result.then( | 377 | function(proveedor) { |
395 | function(proveedor) { | 378 | $scope.notaPedido.proveedor = proveedor; |
396 | $scope.notaPedido.proveedor = proveedor; | 379 | addCabecera('Proveedor:', proveedor.NOM); |
397 | addCabecera('Proveedor:', proveedor.NOM); | 380 | }, function() { |
398 | }, function() { | 381 | |
399 | 382 | } | |
400 | } | 383 | ); |
401 | ); | 384 | } |
402 | }; | 385 | }; |
403 | 386 | ||
404 | $scope.seleccionarCliente = function() { | 387 | $scope.seleccionarCliente = function() { |
405 | 388 | if(validarNotaRemitada()) { | |
406 | var modalInstance = $uibModal.open( | 389 | var modalInstance = $uibModal.open( |
407 | { | 390 | { |
408 | ariaLabelledBy: 'Busqueda de Cliente', | 391 | ariaLabelledBy: 'Busqueda de Cliente', |
409 | templateUrl: 'foca-busqueda-cliente-modal.html', | 392 | templateUrl: 'foca-busqueda-cliente-modal.html', |
410 | controller: 'focaBusquedaClienteModalController', | 393 | controller: 'focaBusquedaClienteModalController', |
411 | size: 'lg' | 394 | size: 'lg' |
412 | } | 395 | } |
413 | ); | 396 | ); |
414 | modalInstance.result.then( | 397 | modalInstance.result.then( |
415 | function(cliente) { | 398 | function(cliente) { |
416 | $scope.abrirModalDomicilios(cliente); | 399 | $scope.abrirModalDomicilios(cliente); |
417 | }, function() { | 400 | }, function() { |
418 | 401 | ||
419 | } | 402 | } |
420 | ); | 403 | ); |
404 | } | ||
421 | }; | 405 | }; |
422 | 406 | ||
423 | $scope.abrirModalDomicilios = function(cliente) { | 407 | $scope.abrirModalDomicilios = function(cliente) { |
424 | var modalInstanceDomicilio = $uibModal.open( | 408 | var modalInstanceDomicilio = $uibModal.open( |
425 | { | 409 | { |
426 | ariaLabelledBy: 'Busqueda de Domicilios', | 410 | ariaLabelledBy: 'Busqueda de Domicilios', |
427 | templateUrl: 'modal-domicilio.html', | 411 | templateUrl: 'modal-domicilio.html', |
428 | controller: 'focaModalDomicilioController', | 412 | controller: 'focaModalDomicilioController', |
429 | resolve: { idCliente: function() { return cliente.cod; }}, | 413 | resolve: { idCliente: function() { return cliente.cod; }}, |
430 | size: 'lg', | 414 | size: 'lg', |
431 | } | 415 | } |
432 | ); | 416 | ); |
433 | modalInstanceDomicilio.result.then( | 417 | modalInstanceDomicilio.result.then( |
434 | function(domicilio) { | 418 | function(domicilio) { |
435 | $scope.notaPedido.domicilio = domicilio; | 419 | $scope.notaPedido.domicilio = domicilio; |
436 | $scope.notaPedido.cliente = { | 420 | $scope.notaPedido.cliente = { |
437 | COD: cliente.cod, | 421 | COD: cliente.cod, |
438 | CUIT: cliente.cuit, | 422 | CUIT: cliente.cuit, |
439 | NOM: cliente.nom | 423 | NOM: cliente.nom |
440 | }; | 424 | }; |
441 | addCabecera('Cliente:', cliente.nom); | 425 | addCabecera('Cliente:', cliente.nom); |
442 | var domicilioStamp = | 426 | var domicilioStamp = |
443 | domicilio.Calle + ' ' + domicilio.Numero + ', ' + | 427 | domicilio.Calle + ' ' + domicilio.Numero + ', ' + |
444 | domicilio.Localidad + ', ' + domicilio.Provincia; | 428 | domicilio.Localidad + ', ' + domicilio.Provincia; |
445 | $scope.notaPedido.domicilioStamp = domicilioStamp; | 429 | $scope.notaPedido.domicilioStamp = domicilioStamp; |
446 | addCabecera('Domicilio:', domicilioStamp); | 430 | addCabecera('Domicilio:', domicilioStamp); |
447 | }, function() { | 431 | }, function() { |
448 | $scope.seleccionarCliente(); | 432 | $scope.seleccionarCliente(); |
449 | return; | 433 | return; |
450 | } | 434 | } |
451 | ); | 435 | ); |
452 | }; | 436 | }; |
453 | 437 | ||
454 | $scope.getTotal = function() { | 438 | $scope.getTotal = function() { |
455 | var total = 0; | 439 | var total = 0; |
456 | var arrayTempArticulos = $scope.articulosTabla; | 440 | var arrayTempArticulos = $scope.articulosTabla; |
457 | for (var i = 0; i < arrayTempArticulos.length; i++) { | 441 | for (var i = 0; i < arrayTempArticulos.length; i++) { |
458 | total += arrayTempArticulos[i].precio * arrayTempArticulos[i].cantidad; | 442 | total += arrayTempArticulos[i].precio * arrayTempArticulos[i].cantidad; |
459 | } | 443 | } |
460 | return parseFloat(total.toFixed(2)); | 444 | return parseFloat(total.toFixed(2)); |
461 | }; | 445 | }; |
462 | 446 | ||
463 | $scope.getSubTotal = function() { | 447 | $scope.getSubTotal = function() { |
464 | if($scope.articuloACargar) { | 448 | if($scope.articuloACargar) { |
465 | return $scope.articuloACargar.precio * $scope.articuloACargar.cantidad; | 449 | return $scope.articuloACargar.precio * $scope.articuloACargar.cantidad; |
466 | } | 450 | } |
467 | }; | 451 | }; |
468 | 452 | ||
469 | $scope.abrirModalListaPrecio = function() { | 453 | $scope.seleccionarPreciosYCondiciones = function() { |
470 | var modalInstance = $uibModal.open( | 454 | if(validarNotaRemitada()) { |
471 | { | 455 | var modalInstance = $uibModal.open( |
472 | ariaLabelledBy: 'Busqueda de Precio Condiciรณn', | 456 | { |
473 | templateUrl: 'modal-precio-condicion.html', | 457 | ariaLabelledBy: 'Busqueda de Precio Condiciรณn', |
474 | controller: 'focaModalPrecioCondicionController', | 458 | templateUrl: 'modal-precio-condicion.html', |
475 | size: 'lg' | 459 | controller: 'focaModalPrecioCondicionController', |
476 | } | 460 | size: 'lg' |
477 | ); | 461 | } |
478 | modalInstance.result.then( | 462 | ); |
479 | function(precioCondicion) { | 463 | modalInstance.result.then( |
480 | var cabecera = ''; | 464 | function(precioCondicion) { |
481 | var plazosConcat = ''; | 465 | var cabecera = ''; |
482 | if(!Array.isArray(precioCondicion)) { | 466 | var plazosConcat = ''; |
483 | $scope.notaPedido.idPrecioCondicion = precioCondicion.id; | 467 | if(!Array.isArray(precioCondicion)) { |
484 | $scope.plazosPagos = precioCondicion.plazoPago; | 468 | $scope.notaPedido.idPrecioCondicion = precioCondicion.id; |
485 | $scope.idLista = precioCondicion.idListaPrecio; | 469 | $scope.plazosPagos = precioCondicion.plazoPago; |
486 | for(var i = 0; i < precioCondicion.plazoPago.length; i++) { | 470 | $scope.idLista = precioCondicion.idListaPrecio; |
487 | plazosConcat += precioCondicion.plazoPago[i].dias + ' '; | 471 | for(var i = 0; i < precioCondicion.plazoPago.length; i++) { |
488 | } | 472 | plazosConcat += precioCondicion.plazoPago[i].dias + ' '; |
489 | cabecera = precioCondicion.nombre + ' ' + plazosConcat.trim(); | 473 | } |
490 | } else { //Cuando se ingresan los plazos manualmente | 474 | cabecera = precioCondicion.nombre + ' ' + plazosConcat.trim(); |
491 | $scope.notaPedido.idPrecioCondicion = 0; | 475 | } else { //Cuando se ingresan los plazos manualmente |
492 | $scope.idLista = -1; //-1, el modal productos busca todos los productos | 476 | $scope.notaPedido.idPrecioCondicion = 0; |
493 | $scope.plazosPagos = precioCondicion; | 477 | $scope.idLista = -1; //-1, el modal productos busca todos los productos |
494 | for(var j = 0; j < precioCondicion.length; j++) { | 478 | $scope.plazosPagos = precioCondicion; |
495 | plazosConcat += precioCondicion[j].dias + ' '; | 479 | for(var j = 0; j < precioCondicion.length; j++) { |
480 | plazosConcat += precioCondicion[j].dias + ' '; | ||
481 | } | ||
482 | cabecera = 'Ingreso manual ' + plazosConcat.trim(); | ||
496 | } | 483 | } |
497 | cabecera = 'Ingreso manual ' + plazosConcat.trim(); | 484 | $scope.articulosTabla = []; |
485 | addCabecera('Precios y condiciones:', cabecera); | ||
486 | }, function() { | ||
487 | |||
498 | } | 488 | } |
499 | $scope.articulosTabla = []; | 489 | ); |
500 | addCabecera('Precios y condiciones:', cabecera); | 490 | } |
501 | }, function() { | ||
502 | |||
503 | } | ||
504 | ); | ||
505 | }; | 491 | }; |
506 | 492 | ||
507 | $scope.abrirModalFlete = function() { | 493 | $scope.seleccionarFlete = function() { |
508 | var modalInstance = $uibModal.open( | 494 | if(validarNotaRemitada()) { |
509 | { | 495 | var modalInstance = $uibModal.open( |
510 | ariaLabelledBy: 'Busqueda de Flete', | 496 | { |
511 | templateUrl: 'modal-flete.html', | 497 | ariaLabelledBy: 'Busqueda de Flete', |
512 | controller: 'focaModalFleteController', | 498 | templateUrl: 'modal-flete.html', |
513 | size: 'lg', | 499 | controller: 'focaModalFleteController', |
514 | resolve: { | 500 | size: 'lg', |
515 | parametrosFlete: | 501 | resolve: { |
516 | function() { | 502 | parametrosFlete: |
517 | return { | 503 | function() { |
518 | flete: $scope.notaPedido.fob ? 'FOB' : | 504 | return { |
519 | ( $scope.notaPedido.flete ? '1' : | 505 | flete: $scope.notaPedido.fob ? 'FOB' : |
520 | ($scope.notaPedido.flete === undefined ? null : '0')), | 506 | ( $scope.notaPedido.flete ? '1' : |
521 | bomba: $scope.notaPedido.bomba ? '1' : | 507 | ($scope.notaPedido.flete === undefined ? null : '0')), |
522 | ($scope.notaPedido.bomba === undefined ? null : '0'), | 508 | bomba: $scope.notaPedido.bomba ? '1' : |
523 | kilometros: $scope.notaPedido.kilometros | 509 | ($scope.notaPedido.bomba === undefined ? null : '0'), |
524 | }; | 510 | kilometros: $scope.notaPedido.kilometros |
525 | } | 511 | }; |
512 | } | ||
513 | } | ||
526 | } | 514 | } |
527 | } | 515 | ); |
528 | ); | 516 | modalInstance.result.then( |
529 | modalInstance.result.then( | 517 | function(datos) { |
530 | function(datos) { | 518 | $scope.notaPedido.flete = datos.flete; |
531 | $scope.notaPedido.flete = datos.flete; | 519 | $scope.notaPedido.fob = datos.FOB; |
532 | $scope.notaPedido.fob = datos.FOB; | 520 | $scope.notaPedido.bomba = datos.bomba; |
533 | $scope.notaPedido.bomba = datos.bomba; | 521 | $scope.notaPedido.kilometros = datos.kilometros; |
534 | $scope.notaPedido.kilometros = datos.kilometros; | 522 | addCabecera('Flete:', datos.FOB ? 'FOB' : (datos.flete ? 'Si' : 'No')); |
535 | addCabecera('Flete:', datos.FOB ? 'FOB' : (datos.flete ? 'Si' : 'No')); | 523 | if(datos.flete) { |
536 | if(datos.flete) { | 524 | addCabecera('Bomba:', datos.bomba ? 'Si' : 'No'); |
537 | addCabecera('Bomba:', datos.bomba ? 'Si' : 'No'); | 525 | addCabecera('Kilometros:', datos.kilometros); |
538 | addCabecera('Kilometros:', datos.kilometros); | 526 | } else { |
539 | } else { | 527 | removeCabecera('Bomba:'); |
540 | removeCabecera('Bomba:'); | 528 | removeCabecera('Kilometros:'); |
541 | removeCabecera('Kilometros:'); | 529 | $scope.notaPedido.bomba = false; |
542 | $scope.notaPedido.bomba = false; | 530 | $scope.notaPedido.kilometros = null; |
543 | $scope.notaPedido.kilometros = null; | 531 | } |
532 | }, function() { | ||
533 | |||
544 | } | 534 | } |
545 | }, function() { | 535 | ); |
546 | 536 | } | |
547 | } | ||
548 | ); | ||
549 | }; | 537 | }; |
550 | 538 | ||
551 | $scope.abrirModalMoneda = function() { | 539 | $scope.seleccionarMoneda = function() { |
552 | var modalInstance = $uibModal.open( | 540 | if(validarNotaRemitada()) { |
553 | { | 541 | var modalInstance = $uibModal.open( |
554 | ariaLabelledBy: 'Busqueda de Moneda', | 542 | { |
555 | templateUrl: 'modal-moneda.html', | 543 | ariaLabelledBy: 'Busqueda de Moneda', |
556 | controller: 'focaModalMonedaController', | 544 | templateUrl: 'modal-moneda.html', |
557 | size: 'lg' | 545 | controller: 'focaModalMonedaController', |
558 | } | 546 | size: 'lg' |
559 | ); | 547 | } |
560 | modalInstance.result.then( | 548 | ); |
561 | function(moneda) { | 549 | modalInstance.result.then( |
562 | $scope.abrirModalCotizacion(moneda); | 550 | function(moneda) { |
563 | }, function() { | 551 | $scope.abrirModalCotizacion(moneda); |
564 | 552 | }, function() { | |
565 | } | 553 | |
566 | ); | 554 | } |
555 | ); | ||
556 | } | ||
567 | }; | 557 | }; |
568 | 558 | ||
569 | $scope.abrirModalCotizacion = function(moneda) { | 559 | $scope.abrirModalCotizacion = function(moneda) { |
570 | var modalInstance = $uibModal.open( | 560 | var modalInstance = $uibModal.open( |
571 | { | 561 | { |
572 | ariaLabelledBy: 'Busqueda de Cotizaciรณn', | 562 | ariaLabelledBy: 'Busqueda de Cotizaciรณn', |
573 | templateUrl: 'modal-cotizacion.html', | 563 | templateUrl: 'modal-cotizacion.html', |
574 | controller: 'focaModalCotizacionController', | 564 | controller: 'focaModalCotizacionController', |
575 | size: 'lg', | 565 | size: 'lg', |
576 | resolve: {idMoneda: function() {return moneda.ID;}} | 566 | resolve: {idMoneda: function() {return moneda.ID;}} |
577 | } | 567 | } |
578 | ); | 568 | ); |
579 | modalInstance.result.then( | 569 | modalInstance.result.then( |
580 | function(cotizacion) { | 570 | function(cotizacion) { |
581 | var articulosTablaTemp = $scope.articulosTabla; | 571 | var articulosTablaTemp = $scope.articulosTabla; |
582 | for(var i = 0; i < articulosTablaTemp.length; i++) { | 572 | for(var i = 0; i < articulosTablaTemp.length; i++) { |
583 | articulosTablaTemp[i].precio = articulosTablaTemp[i].precio * | 573 | articulosTablaTemp[i].precio = articulosTablaTemp[i].precio * |
584 | $scope.notaPedido.cotizacion.VENDEDOR; | 574 | $scope.notaPedido.cotizacion.VENDEDOR; |
585 | articulosTablaTemp[i].precio = articulosTablaTemp[i].precio / | 575 | articulosTablaTemp[i].precio = articulosTablaTemp[i].precio / |
586 | cotizacion.VENDEDOR; | 576 | cotizacion.VENDEDOR; |
587 | } | 577 | } |
588 | $scope.articulosTabla = articulosTablaTemp; | 578 | $scope.articulosTabla = articulosTablaTemp; |
589 | $scope.notaPedido.moneda = moneda; | 579 | $scope.notaPedido.moneda = moneda; |
590 | $scope.notaPedido.cotizacion = cotizacion; | 580 | $scope.notaPedido.cotizacion = cotizacion; |
591 | if(moneda.DETALLE == "PESOS ARGENTINOS"){ | 581 | if(moneda.DETALLE == "PESOS ARGENTINOS"){ |
592 | removeCabecera('Moneda:'); | 582 | removeCabecera('Moneda:'); |
593 | removeCabecera('Fecha cotizacion:'); | 583 | removeCabecera('Fecha cotizacion:'); |
594 | removeCabecera('Cotizacion:'); | 584 | removeCabecera('Cotizacion:'); |
595 | }else{ | 585 | }else{ |
596 | addCabecera('Moneda:', moneda.DETALLE); | 586 | addCabecera('Moneda:', moneda.DETALLE); |
597 | addCabecera( | 587 | addCabecera( |
598 | 'Fecha cotizacion:', | 588 | 'Fecha cotizacion:', |
599 | $filter('date')(cotizacion.FECHA, 'dd/MM/yyyy') | 589 | $filter('date')(cotizacion.FECHA, 'dd/MM/yyyy') |
600 | ); | 590 | ); |
601 | addCabecera('Cotizacion:', cotizacion.VENDEDOR); | 591 | addCabecera('Cotizacion:', cotizacion.VENDEDOR); |
602 | } | 592 | } |
603 | }, function() { | 593 | }, function() { |
604 | 594 | ||
605 | } | 595 | } |
606 | ); | 596 | ); |
607 | }; | 597 | }; |
608 | 598 | ||
609 | $scope.agregarATabla = function(key) { | 599 | $scope.agregarATabla = function(key) { |
610 | if(key === 13) { | 600 | if(key === 13) { |
611 | if($scope.articuloACargar.cantidad === undefined || | 601 | if($scope.articuloACargar.cantidad === undefined || |
612 | $scope.articuloACargar.cantidad === 0 || | 602 | $scope.articuloACargar.cantidad === 0 || |
613 | $scope.articuloACargar.cantidad === null ) { | 603 | $scope.articuloACargar.cantidad === null ) { |
614 | focaModalService.alert('El valor debe ser al menos 1'); | 604 | focaModalService.alert('El valor debe ser al menos 1'); |
615 | return; | 605 | return; |
616 | } | 606 | } |
617 | delete $scope.articuloACargar.sectorCodigo; | 607 | delete $scope.articuloACargar.sectorCodigo; |
618 | $scope.articulosTabla.push($scope.articuloACargar); | 608 | $scope.articulosTabla.push($scope.articuloACargar); |
619 | $scope.cargando = true; | 609 | $scope.cargando = true; |
620 | } | 610 | } |
621 | }; | 611 | }; |
622 | 612 | ||
623 | $scope.quitarArticulo = function(key) { | 613 | $scope.quitarArticulo = function(key) { |
624 | $scope.articulosTabla.splice(key, 1); | 614 | $scope.articulosTabla.splice(key, 1); |
625 | }; | 615 | }; |
626 | 616 | ||
627 | $scope.editarArticulo = function(key, articulo) { | 617 | $scope.editarArticulo = function(key, articulo) { |
628 | if(key === 13) { | 618 | if(key === 13) { |
629 | if(articulo.cantidad === null || articulo.cantidad === 0 || | 619 | if(articulo.cantidad === null || articulo.cantidad === 0 || |
630 | articulo.cantidad === undefined) { | 620 | articulo.cantidad === undefined) { |
631 | focaModalService.alert('El valor debe ser al menos 1'); | 621 | focaModalService.alert('El valor debe ser al menos 1'); |
632 | return; | 622 | return; |
633 | } | 623 | } |
634 | articulo.editCantidad = false; | 624 | articulo.editCantidad = false; |
635 | articulo.editPrecio = false; | 625 | articulo.editPrecio = false; |
636 | } | 626 | } |
637 | }; | 627 | }; |
638 | 628 | ||
639 | $scope.cambioEdit = function(articulo, propiedad) { | 629 | $scope.cambioEdit = function(articulo, propiedad) { |
640 | if(propiedad === 'cantidad') { | 630 | if(propiedad === 'cantidad') { |
641 | articulo.editCantidad = true; | 631 | articulo.editCantidad = true; |
642 | } else if(propiedad === 'precio') { | 632 | } else if(propiedad === 'precio') { |
643 | articulo.editPrecio = true; | 633 | articulo.editPrecio = true; |
644 | } | 634 | } |
645 | }; | 635 | }; |
646 | 636 | ||
647 | $scope.resetFilter = function() { | 637 | $scope.resetFilter = function() { |
648 | $scope.articuloACargar = {}; | 638 | $scope.articuloACargar = {}; |
649 | $scope.cargando = true; | 639 | $scope.cargando = true; |
650 | }; | 640 | }; |
651 | //Recibe aviso si el teclado estรก en uso | 641 | //Recibe aviso si el teclado estรก en uso |
652 | $rootScope.$on('usarTeclado', function(event, data) { | 642 | $rootScope.$on('usarTeclado', function(event, data) { |
653 | if(data) { | 643 | if(data) { |
654 | $scope.mostrarTeclado = true; | 644 | $scope.mostrarTeclado = true; |
655 | return; | 645 | return; |
656 | } | 646 | } |
657 | $scope.mostrarTeclado = false; | 647 | $scope.mostrarTeclado = false; |
658 | }); | 648 | }); |
659 | 649 | ||
660 | $scope.selectFocus = function($event) { | 650 | $scope.selectFocus = function($event) { |
661 | // Si el teclado esta en uso no selecciona el valor | 651 | // Si el teclado esta en uso no selecciona el valor |
662 | if($scope.mostrarTeclado) { | 652 | if($scope.mostrarTeclado) { |
663 | return; | 653 | return; |
664 | } | 654 | } |
665 | $event.target.select(); | 655 | $event.target.select(); |
666 | }; | 656 | }; |
667 | 657 | ||
668 | $scope.salir = function() { | 658 | $scope.salir = function() { |
669 | $location.path('/'); | 659 | $location.path('/'); |
670 | }; | 660 | }; |
671 | 661 | ||
672 | $scope.parsearATexto = function(articulo) { | 662 | $scope.parsearATexto = function(articulo) { |
673 | articulo.cantidad = parseFloat(articulo.cantidad); | 663 | articulo.cantidad = parseFloat(articulo.cantidad); |
674 | articulo.precio = parseFloat(articulo.precio); | 664 | articulo.precio = parseFloat(articulo.precio); |
675 | }; | 665 | }; |
676 | 666 | ||
677 | function addArrayCabecera(array) { | 667 | function addArrayCabecera(array) { |
678 | for(var i = 0; i < array.length; i++) { | 668 | for(var i = 0; i < array.length; i++) { |
679 | addCabecera(array[i].label, array[i].valor); | 669 | addCabecera(array[i].label, array[i].valor); |
680 | } | 670 | } |
681 | } | 671 | } |
682 | 672 | ||
683 | function addCabecera(label, valor) { | 673 | function addCabecera(label, valor) { |
684 | var propiedad = $filter('filter')($scope.cabecera, {label: label}, true); | 674 | var propiedad = $filter('filter')($scope.cabecera, {label: label}, true); |
685 | if(propiedad.length === 1) { | 675 | if(propiedad.length === 1) { |
686 | propiedad[0].valor = valor; | 676 | propiedad[0].valor = valor; |
687 | } else { | 677 | } else { |
688 | $scope.cabecera.push({label: label, valor: valor}); | 678 | $scope.cabecera.push({label: label, valor: valor}); |
689 | } | 679 | } |
690 | } | 680 | } |
691 | 681 | ||
692 | function removeCabecera(label) { | 682 | function removeCabecera(label) { |
693 | var propiedad = $filter('filter')($scope.cabecera, {label: label}, true); | 683 | var propiedad = $filter('filter')($scope.cabecera, {label: label}, true); |
694 | if(propiedad.length === 1) { | 684 | if(propiedad.length === 1) { |
695 | $scope.cabecera.splice($scope.cabecera.indexOf(propiedad[0]), 1); | 685 | $scope.cabecera.splice($scope.cabecera.indexOf(propiedad[0]), 1); |
696 | } | 686 | } |
697 | } | 687 | } |
698 | 688 | ||
699 | function rellenar(relleno, longitud) { | 689 | function rellenar(relleno, longitud) { |
700 | relleno = '' + relleno; | 690 | relleno = '' + relleno; |
701 | while (relleno.length < longitud) { | 691 | while (relleno.length < longitud) { |
src/js/service.js
1 | angular.module('focaCrearNotaPedido') | 1 | angular.module('focaCrearNotaPedido') |
2 | .service('crearNotaPedidoService', ['$http', 'API_ENDPOINT', function($http, API_ENDPOINT) { | 2 | .service('crearNotaPedidoService', ['$http', 'API_ENDPOINT', function($http, API_ENDPOINT) { |
3 | var route = API_ENDPOINT.URL; | 3 | var route = API_ENDPOINT.URL; |
4 | return { | 4 | return { |
5 | crearNotaPedido: function(notaPedido) { | 5 | crearNotaPedido: function(notaPedido) { |
6 | return $http.post(route + '/nota-pedido', {notaPedido: notaPedido}); | 6 | return $http.post(route + '/nota-pedido', {notaPedido: notaPedido}); |
7 | }, | 7 | }, |
8 | obtenerNotaPedido: function() { | 8 | obtenerNotaPedido: function() { |
9 | return $http.get(route +'/nota-pedido'); | 9 | return $http.get(route +'/nota-pedido'); |
10 | }, | 10 | }, |
11 | setNotaPedido: function(notaPedido) { | 11 | setNotaPedido: function(notaPedido) { |
12 | this.notaPedido = notaPedido; | 12 | this.notaPedido = notaPedido; |
13 | }, | 13 | }, |
14 | clearNotaPedido: function() { | 14 | clearNotaPedido: function() { |
15 | this.notaPedido = undefined; | 15 | this.notaPedido = undefined; |
16 | }, | 16 | }, |
17 | getNotaPedido: function() { | 17 | getNotaPedido: function() { |
18 | return this.notaPedido; | 18 | return this.notaPedido; |
19 | }, | 19 | }, |
20 | getArticulosByIdNotaPedido: function(id) { | 20 | getArticulosByIdNotaPedido: function(id) { |
21 | return $http.get(route+'/articulos/nota-pedido/'+id); | 21 | return $http.get(route+'/articulos/nota-pedido/'+id); |
22 | }, | 22 | }, |
23 | crearArticulosParaNotaPedido: function(articuloNotaPedido) { | 23 | crearArticulosParaNotaPedido: function(articuloNotaPedido) { |
24 | return $http.post(route + '/articulos/nota-pedido', | 24 | return $http.post(route + '/articulos/nota-pedido', |
25 | {articuloNotaPedido: articuloNotaPedido}); | 25 | {articuloNotaPedido: articuloNotaPedido}); |
26 | }, | 26 | }, |
27 | getDomiciliosByIdNotaPedido: function(id) { | 27 | getDomiciliosByIdNotaPedido: function(id) { |
28 | return $http.get(route +'/nota-pedido/'+id+'/domicilios'); | 28 | return $http.get(route +'/nota-pedido/'+id+'/domicilios'); |
29 | }, | 29 | }, |
30 | getDomiciliosByIdCliente: function(id) { | 30 | getDomiciliosByIdCliente: function(id) { |
31 | var idTipoEntrega = 2;//Solo traigo los domicilios que tienen tipo 2 (tipo entrega) | 31 | var idTipoEntrega = 2;//Solo traigo los domicilios que tienen tipo 2 (tipo entrega) |
32 | return $http.get(route + '/domicilio/tipo/' + idTipoEntrega + '/cliente/' + id ); | 32 | return $http.get(route + '/domicilio/tipo/' + idTipoEntrega + '/cliente/' + id ); |
33 | }, | 33 | }, |
34 | getPrecioCondicion: function() { | 34 | getPrecioCondicion: function() { |
35 | return $http.get(route + '/precio-condicion'); | 35 | return $http.get(route + '/precio-condicion'); |
36 | }, | 36 | }, |
37 | getPrecioCondicionById: function(id) { | 37 | getPrecioCondicionById: function(id) { |
38 | return $http.get(route + '/precio-condicion/' + id); | 38 | return $http.get(route + '/precio-condicion/' + id); |
39 | }, | 39 | }, |
40 | getPlazoPagoByPrecioCondicion: function(id) { | 40 | getPlazoPagoByPrecioCondicion: function(id) { |
41 | return $http.get(route + '/plazo-pago/precio-condicion/'+ id); | 41 | return $http.get(route + '/plazo-pago/precio-condicion/'+ id); |
42 | }, | 42 | }, |
43 | crearFlete: function(flete) { | 43 | crearFlete: function(flete) { |
44 | return $http.post(route + '/flete', {flete : flete}); | 44 | return $http.post(route + '/flete', {flete : flete}); |
45 | }, | 45 | }, |
46 | crearPlazosParaNotaPedido: function(plazos) { | 46 | crearPlazosParaNotaPedido: function(plazos) { |
47 | return $http.post(route + '/plazo-pago/nota-pedido', plazos); | 47 | return $http.post(route + '/plazo-pago/nota-pedido', plazos); |
48 | }, | 48 | }, |
49 | getCotizacionByIdMoneda: function(id) { | 49 | getCotizacionByIdMoneda: function(id) { |
50 | return $http.get(route + '/moneda/' + id); | 50 | return $http.get(route + '/moneda/' + id); |
51 | }, | 51 | }, |
52 | crearEstadoParaNotaPedido: function(estado) { | 52 | crearEstadoParaNotaPedido: function(estado) { |
53 | return $http.post(route + '/estado', {estado: estado}); | 53 | return $http.post(route + '/estado', {estado: estado}); |
54 | }, | 54 | }, |
55 | getNumeroNotaPedido: function() { | 55 | getNumeroNotaPedido: function() { |
56 | return $http.get(route + '/nota-pedido/numero-siguiente'); | 56 | return $http.get(route + '/nota-pedido/numero-siguiente'); |
57 | }, | ||
58 | getBotonera: function() { | ||
59 | return ['Vendedor', 'Cliente', 'Proveedor', 'Moneda', | ||
60 | 'Precios y condiciones', 'Flete', 'Productos']; | ||
57 | } | 61 | } |
58 | }; | 62 | }; |
59 | }]); | 63 | }]); |
60 | 64 |
src/views/nota-pedido.html
1 | <div class="crear-nota-pedido foca-crear row"> | 1 | <div class="crear-nota-pedido foca-crear row"> |
2 | <form name="formCrearNota" ng-submit="crearNotaPedido()" class="mb-0 col-lg-12"> | 2 | <form name="formCrearNota" ng-submit="crearNotaPedido()" class="mb-0 col-lg-12"> |
3 | <div class="row"> | 3 | <div class="row"> |
4 | <div class="col-md-10 col-lg-12"> | 4 | <div class="col-md-10 col-lg-12"> |
5 | <div class="row panel-informativo"> | 5 | <div class="row panel-informativo"> |
6 | <div class="col-12"> | 6 | <div class="col-12"> |
7 | <div class="row titulares"> | 7 | <div class="row titulares"> |
8 | <div class="col-12 col-sm-3 nota-pedido border border-left-0 border-white align-middle"> | 8 | <div class="col-12 col-sm-3 nota-pedido border border-left-0 border-white align-middle"> |
9 | <h5 class="mb-0">NOTA DE PEDIDO</h5> | 9 | <h5 class="mb-0">NOTA DE PEDIDO</h5> |
10 | </div> | 10 | </div> |
11 | <div class="col-12 col-sm-3 numero-pedido border border-white align-middle" | 11 | <div class="col-12 col-sm-3 numero-pedido border border-white align-middle" |
12 | >Nยบ {{puntoVenta}}-{{comprobante}} | 12 | >Nยบ {{puntoVenta}}-{{comprobante}} |
13 | <button | 13 | <button |
14 | class="btn btn-xs btn-outline-light float-right" | 14 | class="btn btn-xs btn-outline-light float-right" |
15 | type="button" | 15 | type="button" |
16 | ng-click="seleccionarNotaPedido()" | 16 | ng-click="seleccionarNotaPedido()" |
17 | > | 17 | > |
18 | <i class="fa fa-search"></i> | 18 | <i class="fa fa-search"></i> |
19 | </button> | 19 | </button> |
20 | </div> | 20 | </div> |
21 | <div class="col-7 col-sm-3 border border-white align-middle"> | 21 | <div class="col-7 col-sm-3 border border-white align-middle"> |
22 | Fecha:  | 22 | Fecha:  |
23 | <span | 23 | <span |
24 | ng-show="!datepickerAbierto" | 24 | ng-show="!datepickerAbierto" |
25 | ng-bind="now | date:'dd/MM/yyyy'" | 25 | ng-bind="now | date:'dd/MM/yyyy'" |
26 | ng-click="datepickerAbierto = true" | 26 | ng-click="datepickerAbierto = true" |
27 | > | 27 | > |
28 | </span> | 28 | </span> |
29 | <input | 29 | <input |
30 | ng-show="datepickerAbierto" | 30 | ng-show="datepickerAbierto" |
31 | type="date" | 31 | type="date" |
32 | ng-model="now" | 32 | ng-model="now" |
33 | ng-change="datepickerAbierto = false" | 33 | ng-change="datepickerAbierto = false" |
34 | ng-blur="datepickerAbierto = false" | 34 | ng-blur="datepickerAbierto = false" |
35 | class="form-control form-control-sm col-8 float-right" | 35 | class="form-control form-control-sm col-8 float-right" |
36 | foca-focus="datepickerAbierto" | 36 | foca-focus="datepickerAbierto" |
37 | hasta-hoy | 37 | hasta-hoy |
38 | /> | 38 | /> |
39 | </div> | 39 | </div> |
40 | <div class="col-5 col-sm-3 border border-white border-right-0 align-middle"> | 40 | <div class="col-5 col-sm-3 border border-white border-right-0 align-middle"> |
41 | Hora:  | 41 | Hora:  |
42 | <span | 42 | <span |
43 | ng-show="!datepickerAbierto" | 43 | ng-show="!datepickerAbierto" |
44 | ng-bind="now | date:'HH:mm'" | 44 | ng-bind="now | date:'HH:mm'" |
45 | ng-click="datepickerAbierto = true" | 45 | ng-click="datepickerAbierto = true" |
46 | > | 46 | > |
47 | </span> | 47 | </span> |
48 | </div> | 48 | </div> |
49 | </div> | 49 | </div> |
50 | <div class="row py-2"> | 50 | <div class="row py-2"> |
51 | <div class="col-auto" ng-repeat="cab in cabecera" ng-show="showCabecera"> | 51 | <div class="col-auto" ng-repeat="cab in cabecera" ng-show="showCabecera"> |
52 | <span class="label" ng-bind="cab.label"></span> | 52 | <span class="label" ng-bind="cab.label"></span> |
53 | <span class="valor" ng-bind="cab.valor" ng-if="!isNumber(cab.valor)"></span> | 53 | <span class="valor" ng-bind="cab.valor" ng-if="!isNumber(cab.valor)"></span> |
54 | <span class="valor" ng-bind="cab.valor | number:2" ng-if="isNumber(cab.valor)"></span> | 54 | <span class="valor" ng-bind="cab.valor | number:2" ng-if="isNumber(cab.valor)"></span> |
55 | </div> | 55 | </div> |
56 | <a | 56 | <a |
57 | class="btn col-12 btn-secondary d-sm-none" | 57 | class="btn col-12 btn-secondary d-sm-none" |
58 | ng-show="cabecera.length > 0" | 58 | ng-show="cabecera.length > 0" |
59 | ng-click="showCabecera = !showCabecera" | 59 | ng-click="showCabecera = !showCabecera" |
60 | > | 60 | > |
61 | <i | 61 | <i |
62 | class="fa fa-chevron-down" | 62 | class="fa fa-chevron-down" |
63 | ng-hide="showCabecera" | 63 | ng-hide="showCabecera" |
64 | aria-hidden="true" | 64 | aria-hidden="true" |
65 | > | 65 | > |
66 | </i> | 66 | </i> |
67 | <i | 67 | <i |
68 | class="fa fa-chevron-up" | 68 | class="fa fa-chevron-up" |
69 | ng-show="showCabecera" | 69 | ng-show="showCabecera" |
70 | aria-hidden="true"> | 70 | aria-hidden="true"> |
71 | </i> | 71 | </i> |
72 | </a> | 72 | </a> |
73 | </div> | 73 | </div> |
74 | </div> | 74 | </div> |
75 | </div> | 75 | </div> |
76 | 76 | ||
77 | </div> | 77 | </div> |
78 | </div> | 78 | </div> |
79 | </form> | 79 | </form> |
80 | <div class="col-lg-12"> | 80 | <div class="col-lg-12"> |
81 | <div class="row mt-4"> | 81 | <div class="row mt-4"> |
82 | <div class="col-12 col-md-10 col-lg-10 border border-light rounded"> | 82 | <div class="col-12 col-md-10 col-lg-10 border border-light rounded"> |
83 | <div class="row px-5 py-2 botonera-secundaria"> | 83 | <div class="row px-5 py-2 botonera-secundaria"> |
84 | <div class="col-12"> | 84 | <div class="col-12"> |
85 | <div class="row"> | 85 | <foca-botonera-facturador botones="botonera" extra="5" class="row"></foca-botonera-facturador> |
86 | <div | ||
87 | class="col-6 col-sm-2 px-1 py-1 m-auto m-md-0" | ||
88 | ng-repeat="boton in botonera" | ||
89 | ng-class="{'d-none d-md-grid': boton.texto == ''}"> | ||
90 | <button | ||
91 | type="button" | ||
92 | class="btn btn-default btn-block btn-xs text-center py-1 rounded border border-light" | ||
93 | ng-click="boton.accion()" | ||
94 | ng-class="{'d-sm-block h-100': boton.texto == ''}" | ||
95 | > | ||
96 | <img src="{{boton.imagen}}" alt="" ng-if="boton.imagen"> | ||
97 | <span>{{boton.texto}}</span> | ||
98 | </button> | ||
99 | </div> | ||
100 | </div> | ||
101 | </div> | 86 | </div> |
102 | </div> | 87 | </div> |
103 | <!-- PC --> | 88 | <!-- PC --> |
104 | <div class="row grilla-articulo align-items-end d-none d-sm-flex"> | 89 | <div class="row grilla-articulo align-items-end d-none d-sm-flex"> |
105 | <table class="table tabla-articulo table-striped table-sm mb-0 rounded-bottom"> | 90 | <table class="table tabla-articulo table-striped table-sm mb-0 rounded-bottom"> |
106 | <thead> | 91 | <thead> |
107 | <tr class="d-flex"> | 92 | <tr class="d-flex"> |
108 | <th valign="middle" class="">#</th> | 93 | <th valign="middle" class="">#</th> |
109 | <th valign="middle" class="col">Cรณdigo</th> | 94 | <th valign="middle" class="col">Cรณdigo</th> |
110 | <th valign="middle" class="col-4">Descripciรณn</th> | 95 | <th valign="middle" class="col-4">Descripciรณn</th> |
111 | <th valign="middle" class="col text-right">Cantidad</th> | 96 | <th valign="middle" class="col text-right">Cantidad</th> |
112 | <th valign="middle" class="col text-right">Precio Unitario</th> | 97 | <th valign="middle" class="col text-right">Precio Unitario</th> |
113 | <th valign="middle" class="col text-right">SubTotal</th> | 98 | <th valign="middle" class="col text-right">SubTotal</th> |
114 | <th valign="middle" class="text-right"> | 99 | <th valign="middle" class="text-right"> |
115 | <button | 100 | <button |
116 | class="btn btn-outline-secondary selectable" | 101 | class="btn btn-outline-secondary selectable" |
117 | ng-click="show = !show; masMenos()" | 102 | ng-click="show = !show; masMenos()" |
118 | > | 103 | > |
119 | <i | 104 | <i |
120 | class="fa fa-chevron-down" | 105 | class="fa fa-chevron-down" |
121 | ng-show="show" | 106 | ng-show="show" |
122 | aria-hidden="true" | 107 | aria-hidden="true" |
123 | > | 108 | > |
124 | </i> | 109 | </i> |
125 | <i | 110 | <i |
126 | class="fa fa-chevron-up" | 111 | class="fa fa-chevron-up" |
127 | ng-hide="show" | 112 | ng-hide="show" |
128 | aria-hidden="true"> | 113 | aria-hidden="true"> |
129 | </i> | 114 | </i> |
130 | </button> | 115 | </button> |
131 | </th> | 116 | </th> |
132 | </tr> | 117 | </tr> |
133 | </thead> | 118 | </thead> |
134 | <tbody class="tabla-articulo-body"> | 119 | <tbody class="tabla-articulo-body"> |
135 | <tr | 120 | <tr |
136 | ng-repeat="(key, articulo) in articulosTabla" | 121 | ng-repeat="(key, articulo) in articulosTabla" |
137 | ng-show="show || key == (articulosTabla.length - 1)" | 122 | ng-show="show || key == (articulosTabla.length - 1)" |
138 | class="d-flex" | 123 | class="d-flex" |
139 | > | 124 | > |
140 | <td ng-bind="key + 1"></td> | 125 | <td ng-bind="key + 1"></td> |
141 | <td | 126 | <td |
142 | class="col" | 127 | class="col" |
143 | ng-bind="articulo.sector + '-' + articulo.codigo" | 128 | ng-bind="articulo.sector + '-' + articulo.codigo" |
144 | ></td> | 129 | ></td> |
145 | <td | 130 | <td |
146 | class="col-4" | 131 | class="col-4" |
147 | ng-bind="articulo.descripcion" | 132 | ng-bind="articulo.descripcion" |
148 | ></td> | 133 | ></td> |
149 | <td class="col text-right"> | 134 | <td class="col text-right"> |
150 | <input | 135 | <input |
151 | ng-show="articulo.editCantidad" | 136 | ng-show="articulo.editCantidad" |
152 | ng-model="articulo.cantidad" | 137 | ng-model="articulo.cantidad" |
153 | class="form-control" | 138 | class="form-control" |
154 | foca-tipo-input | 139 | foca-tipo-input |
155 | min="1" | 140 | min="1" |
156 | step="0.001" | 141 | step="0.001" |
157 | foca-focus="articulo.editCantidad" | 142 | foca-focus="articulo.editCantidad" |
158 | ng-keypress="editarArticulo($event.keyCode, articulo)" | 143 | ng-keypress="editarArticulo($event.keyCode, articulo)" |
159 | ng-focus="selectFocus($event)" | 144 | ng-focus="selectFocus($event)" |
160 | teclado-virtual | 145 | teclado-virtual |
161 | > | 146 | > |
162 | <i | 147 | <i |
163 | class="selectable" | 148 | class="selectable" |
164 | ng-click="cambioEdit(articulo, 'cantidad')" | 149 | ng-click="cambioEdit(articulo, 'cantidad')" |
165 | ng-hide="articulo.editCantidad" | 150 | ng-hide="articulo.editCantidad" |
166 | ng-bind="articulo.cantidad"> | 151 | ng-bind="articulo.cantidad"> |
167 | </i> | 152 | </i> |
168 | </td> | 153 | </td> |
169 | <td class="col text-right"> | 154 | <td class="col text-right"> |
170 | <input | 155 | <input |
171 | ng-show="articulo.editPrecio" | 156 | ng-show="articulo.editPrecio" |
172 | ng-model="articulo.precio" | 157 | ng-model="articulo.precio" |
173 | class="form-control" | 158 | class="form-control" |
174 | foca-tipo-input | 159 | foca-tipo-input |
175 | min="0" | 160 | min="0" |
176 | step="0.0001" | 161 | step="0.0001" |
177 | foca-focus="articulo.editPrecio" | 162 | foca-focus="articulo.editPrecio" |
178 | ng-keypress="editarArticulo($event.keyCode, articulo)" | 163 | ng-keypress="editarArticulo($event.keyCode, articulo)" |
179 | ng-focus="selectFocus($event)" | 164 | ng-focus="selectFocus($event)" |
180 | teclado-virtual | 165 | teclado-virtual |
181 | > | 166 | > |
182 | <i | 167 | <i |
183 | class="selectable" | 168 | class="selectable" |
184 | ng-click="idLista == -1 && cambioEdit(articulo, 'precio')" | 169 | ng-click="idLista == -1 && cambioEdit(articulo, 'precio')" |
185 | ng-hide="articulo.editPrecio" | 170 | ng-hide="articulo.editPrecio" |
186 | ng-bind="articulo.precio | | 171 | ng-bind="articulo.precio | |
187 | currency: notaPedido.moneda.SIMBOLO : 4"> | 172 | currency: notaPedido.moneda.SIMBOLO : 4"> |
188 | </i> | 173 | </i> |
189 | </td> | 174 | </td> |
190 | <td | 175 | <td |
191 | class="col text-right" | 176 | class="col text-right" |
192 | ng-bind="(articulo.precio * articulo.cantidad) | | 177 | ng-bind="(articulo.precio * articulo.cantidad) | |
193 | currency: notaPedido.moneda.SIMBOLO"> | 178 | currency: notaPedido.moneda.SIMBOLO"> |
194 | </td> | 179 | </td> |
195 | <td class="text-center"> | 180 | <td class="text-center"> |
196 | <button | 181 | <button |
197 | ng-show="articulo.editCantidad || articulo.editPrecio" | 182 | ng-show="articulo.editCantidad || articulo.editPrecio" |
198 | class="btn btn-outline-secondary" | 183 | class="btn btn-outline-secondary" |
199 | ng-click="editarArticulo(13, articulo)" | 184 | ng-click="editarArticulo(13, articulo)" |
200 | > | 185 | > |
201 | <i class="fa fa-save"></i> | 186 | <i class="fa fa-save"></i> |
202 | </button> | 187 | </button> |
203 | <button | 188 | <button |
204 | class="btn btn-outline-secondary" | 189 | class="btn btn-outline-secondary" |
205 | ng-click="quitarArticulo(key)" | 190 | ng-click="quitarArticulo(key)" |
206 | > | 191 | > |
207 | <i class="fa fa-trash"></i> | 192 | <i class="fa fa-trash"></i> |
208 | </button> | 193 | </button> |
209 | </td> | 194 | </td> |
210 | </tr> | 195 | </tr> |
211 | </tbody> | 196 | </tbody> |
212 | <tfoot> | 197 | <tfoot> |
213 | <tr ng-show="!cargando" class="d-flex"> | 198 | <tr ng-show="!cargando" class="d-flex"> |
214 | <td | 199 | <td |
215 | class="align-middle" | 200 | class="align-middle" |
216 | ng-bind="articulosTabla.length + 1" | 201 | ng-bind="articulosTabla.length + 1" |
217 | ></td> | 202 | ></td> |
218 | <td class="col"> | 203 | <td class="col"> |
219 | <input | 204 | <input |
220 | class="form-control" | 205 | class="form-control" |
221 | ng-model="articuloACargar.sectorCodigo" | 206 | ng-model="articuloACargar.sectorCodigo" |
222 | readonly | 207 | readonly |
223 | > | 208 | > |
224 | </td> | 209 | </td> |
225 | <td class="col-4 tabla-articulo-descripcion"> | 210 | <td class="col-4 tabla-articulo-descripcion"> |
226 | <input | 211 | <input |
227 | class="form-control" | 212 | class="form-control" |
228 | ng-model="articuloACargar.descripcion" | 213 | ng-model="articuloACargar.descripcion" |
229 | readonly | 214 | readonly |
230 | > | 215 | > |
231 | </td> | 216 | </td> |
232 | <td class="col text-right"> | 217 | <td class="col text-right"> |
233 | <input | 218 | <input |
234 | class="form-control" | 219 | class="form-control" |
235 | foca-tipo-input | 220 | foca-tipo-input |
236 | min="1" | 221 | min="1" |
237 | step="0.001" | 222 | step="0.001" |
238 | ng-model="articuloACargar.cantidad" | 223 | ng-model="articuloACargar.cantidad" |
239 | foca-focus="!cargando" | 224 | foca-focus="!cargando" |
240 | esc-key="resetFilter()" | 225 | esc-key="resetFilter()" |
241 | ng-keypress="agregarATabla($event.keyCode)" | 226 | ng-keypress="agregarATabla($event.keyCode)" |
242 | teclado-virtual | 227 | teclado-virtual |
243 | > | 228 | > |
244 | </td> | 229 | </td> |
245 | <td class="col text-right"> | 230 | <td class="col text-right"> |
246 | <input | 231 | <input |
247 | class="form-control" | 232 | class="form-control" |
248 | ng-value="articuloACargar.precio | | 233 | ng-value="articuloACargar.precio | |
249 | currency: notaPedido.moneda.SIMBOLO : 4" | 234 | currency: notaPedido.moneda.SIMBOLO : 4" |
250 | ng-show="idLista != -1" | 235 | ng-show="idLista != -1" |
251 | readonly | 236 | readonly |
252 | > | 237 | > |
253 | <input | 238 | <input |
254 | class="form-control" | 239 | class="form-control" |
255 | foca-tipo-input | 240 | foca-tipo-input |
256 | min="0" | 241 | min="0" |
257 | step="0.0001" | 242 | step="0.0001" |
258 | ng-model="articuloACargar.precio" | 243 | ng-model="articuloACargar.precio" |
259 | esc-key="resetFilter()" | 244 | esc-key="resetFilter()" |
260 | ng-keypress="agregarATabla($event.keyCode)" | 245 | ng-keypress="agregarATabla($event.keyCode)" |
261 | ng-show="idLista == -1" | 246 | ng-show="idLista == -1" |
262 | teclado-virtual | 247 | teclado-virtual |
263 | > | 248 | > |
264 | </td> | 249 | </td> |
265 | <td class="col text-right"> | 250 | <td class="col text-right"> |
266 | <input | 251 | <input |
267 | class="form-control" | 252 | class="form-control" |
268 | ng-value="getSubTotal() | currency: notaPedido.moneda.SIMBOLO" | 253 | ng-value="getSubTotal() | currency: notaPedido.moneda.SIMBOLO" |
269 | readonly | 254 | readonly |
270 | ></td> | 255 | ></td> |
271 | <td class="text-center align-middle"> | 256 | <td class="text-center align-middle"> |
272 | <button | 257 | <button |
273 | class="btn btn-outline-secondary" | 258 | class="btn btn-outline-secondary" |
274 | ng-click="agregarATabla(13)" | 259 | ng-click="agregarATabla(13)" |
275 | > | 260 | > |
276 | <i class="fa fa-save"></i> | 261 | <i class="fa fa-save"></i> |
277 | </button> | 262 | </button> |
278 | </td> | 263 | </td> |
279 | </tr> | 264 | </tr> |
280 | <tr class="d-flex"> | 265 | <tr class="d-flex"> |
281 | <td colspan="4" class="no-border-top"> | 266 | <td colspan="4" class="no-border-top"> |
282 | <strong>Items:</strong> | 267 | <strong>Items:</strong> |
283 | <a ng-bind="articulosTabla.length"></a> | 268 | <a ng-bind="articulosTabla.length"></a> |
284 | </td> | 269 | </td> |
285 | <td class="text-right ml-auto table-celda-total no-border-top"> | 270 | <td class="text-right ml-auto table-celda-total no-border-top"> |
286 | <h3>Total:</h3> | 271 | <h3>Total:</h3> |
287 | </td> | 272 | </td> |
288 | <td class="table-celda-total text-right no-border-top" colspan="1"> | 273 | <td class="table-celda-total text-right no-border-top" colspan="1"> |
289 | <h3>{{getTotal() | currency: notaPedido.moneda.SIMBOLO}}</h3> | 274 | <h3>{{getTotal() | currency: notaPedido.moneda.SIMBOLO}}</h3> |
290 | </td> | 275 | </td> |
291 | <td class="text-right no-border-top"> | 276 | <td class="text-right no-border-top"> |
292 | <button | 277 | <button |
293 | type="button" | 278 | type="button" |
294 | class="btn btn-default btn-sm" | 279 | class="btn btn-default btn-sm" |
295 | > | 280 | > |
296 | Totales | 281 | Totales |
297 | </button> | 282 | </button> |
298 | </td> | 283 | </td> |
299 | </tr> | 284 | </tr> |
300 | </tfoot> | 285 | </tfoot> |
301 | </table> | 286 | </table> |
302 | </div> | 287 | </div> |
303 | <!-- MOBILE --> | 288 | <!-- MOBILE --> |
304 | <div class="row d-sm-none"> | 289 | <div class="row d-sm-none"> |
305 | <table class="table table-sm table-striped table-dark margin-bottom-mobile"> | 290 | <table class="table table-sm table-striped table-dark margin-bottom-mobile"> |
306 | <thead> | 291 | <thead> |
307 | <tr class="d-flex"> | 292 | <tr class="d-flex"> |
308 | <th class="">#</th> | 293 | <th class="">#</th> |
309 | <th class="col px-0"> | 294 | <th class="col px-0"> |
310 | <div class="d-flex"> | 295 | <div class="d-flex"> |
311 | <div class="col-4 px-1">Cรณdigo</div> | 296 | <div class="col-4 px-1">Cรณdigo</div> |
312 | <div class="col-8 px-1">Descripciรณn</div> | 297 | <div class="col-8 px-1">Descripciรณn</div> |
313 | </div> | 298 | </div> |
314 | <div class="d-flex"> | 299 | <div class="d-flex"> |
315 | <div class="col-3 px-1">Cantidad</div> | 300 | <div class="col-3 px-1">Cantidad</div> |
316 | <div class="col px-1 text-right">P. Uni.</div> | 301 | <div class="col px-1 text-right">P. Uni.</div> |
317 | <div class="col px-1 text-right">Subtotal</div> | 302 | <div class="col px-1 text-right">Subtotal</div> |
318 | </div> | 303 | </div> |
319 | </th> | 304 | </th> |
320 | <th class="text-center tamaรฑo-boton"> | 305 | <th class="text-center tamaรฑo-boton"> |
321 | | 306 | |
322 | </th> | 307 | </th> |
323 | </tr> | 308 | </tr> |
324 | </thead> | 309 | </thead> |
325 | <tbody> | 310 | <tbody> |
326 | <tr | 311 | <tr |
327 | ng-repeat="(key, articulo) in articulosTabla" | 312 | ng-repeat="(key, articulo) in articulosTabla" |
328 | ng-show="show || key == articulosTabla.length - 1" | 313 | ng-show="show || key == articulosTabla.length - 1" |
329 | > | 314 | > |
330 | <td class="w-100 align-middle d-flex p-0"> | 315 | <td class="w-100 align-middle d-flex p-0"> |
331 | <div class="align-middle p-1"> | 316 | <div class="align-middle p-1"> |
332 | <span ng-bind="key+1" class="align-middle"></span> | 317 | <span ng-bind="key+1" class="align-middle"></span> |
333 | </div> | 318 | </div> |
334 | <div class="col px-0"> | 319 | <div class="col px-0"> |
335 | <div class="d-flex"> | 320 | <div class="d-flex"> |
336 | <div class="col-4 px-1"> | 321 | <div class="col-4 px-1"> |
337 | <span | 322 | <span |
338 | ng-bind="articulo.sector + '-' + articulo.codigo" | 323 | ng-bind="articulo.sector + '-' + articulo.codigo" |
339 | ></span> | 324 | ></span> |
340 | </div> | 325 | </div> |
341 | <div class="col-8 px-1"> | 326 | <div class="col-8 px-1"> |
342 | <span ng-bind="articulo.descripcion"></span> | 327 | <span ng-bind="articulo.descripcion"></span> |
343 | </div> | 328 | </div> |
344 | </div> | 329 | </div> |
345 | <div class="d-flex"> | 330 | <div class="d-flex"> |
346 | <div class="col-3 px-1"> | 331 | <div class="col-3 px-1"> |
347 | <span | 332 | <span |
348 | ng-bind="'x' + articulo.cantidad" | 333 | ng-bind="'x' + articulo.cantidad" |
349 | ng-hide="articulo.editCantidad" | 334 | ng-hide="articulo.editCantidad" |
350 | ></span> | 335 | ></span> |
351 | <i | 336 | <i |
352 | class="fa fa-pencil text-white-50" | 337 | class="fa fa-pencil text-white-50" |
353 | aria-hidden="true" | 338 | aria-hidden="true" |
354 | ng-hide="articulo.editCantidad" | 339 | ng-hide="articulo.editCantidad" |
355 | ng-click="articulo.editCantidad = true" | 340 | ng-click="articulo.editCantidad = true" |
356 | ></i> | 341 | ></i> |
357 | <input | 342 | <input |
358 | ng-show="articulo.editCantidad" | 343 | ng-show="articulo.editCantidad" |
359 | ng-model="articulo.cantidad" | 344 | ng-model="articulo.cantidad" |
360 | class="form-control" | 345 | class="form-control" |
361 | foca-tipo-input | 346 | foca-tipo-input |
362 | min="1" | 347 | min="1" |
363 | step="0.001" | 348 | step="0.001" |
364 | foca-focus="articulo.editCantidad" | 349 | foca-focus="articulo.editCantidad" |
365 | ng-keypress="editarArticulo($event.keyCode, articulo)" | 350 | ng-keypress="editarArticulo($event.keyCode, articulo)" |
366 | ng-focus="selectFocus($event)" | 351 | ng-focus="selectFocus($event)" |
367 | > | 352 | > |
368 | </div> | 353 | </div> |
369 | <div class="col px-1 text-right"> | 354 | <div class="col px-1 text-right"> |
370 | <span ng-bind="articulo.precio | | 355 | <span ng-bind="articulo.precio | |
371 | currency: notaPedido.moneda.SIMBOLO : 4"></span> | 356 | currency: notaPedido.moneda.SIMBOLO : 4"></span> |
372 | ></span> | 357 | ></span> |
373 | </div> | 358 | </div> |
374 | <div class="col px-1 text-right"> | 359 | <div class="col px-1 text-right"> |
375 | <span | 360 | <span |
376 | ng-bind="(articulo.precio * articulo.cantidad) | | 361 | ng-bind="(articulo.precio * articulo.cantidad) | |
377 | currency: notaPedido.moneda.SIMBOLO" | 362 | currency: notaPedido.moneda.SIMBOLO" |
378 | > | 363 | > |
379 | </span> | 364 | </span> |
380 | </div> | 365 | </div> |
381 | </div> | 366 | </div> |
382 | </div> | 367 | </div> |
383 | <div class="align-middle p-1"> | 368 | <div class="align-middle p-1"> |
384 | <button | 369 | <button |
385 | class="btn btn-outline-secondary" | 370 | class="btn btn-outline-secondary" |
386 | ng-click="quitarArticulo(key)" | 371 | ng-click="quitarArticulo(key)" |
387 | > | 372 | > |
388 | <i class="fa fa-trash"></i> | 373 | <i class="fa fa-trash"></i> |
389 | </button> | 374 | </button> |
390 | </div> | 375 | </div> |
391 | </td> | 376 | </td> |
392 | </tr> | 377 | </tr> |
393 | </tbody> | 378 | </tbody> |
394 | <tfoot> | 379 | <tfoot> |
395 | <!-- CARGANDO ITEM --> | 380 | <!-- CARGANDO ITEM --> |
396 | <tr ng-show="!cargando" class="d-flex"> | 381 | <tr ng-show="!cargando" class="d-flex"> |
397 | <td | 382 | <td |
398 | class="align-middle p-1" | 383 | class="align-middle p-1" |
399 | ng-bind="articulosTabla.length + 1" | 384 | ng-bind="articulosTabla.length + 1" |
400 | ></td> | 385 | ></td> |
401 | <td class="col p-0"> | 386 | <td class="col p-0"> |
402 | <div class="d-flex"> | 387 | <div class="d-flex"> |
403 | <div class="col-4 px-1"> | 388 | <div class="col-4 px-1"> |
404 | <span | 389 | <span |
405 | ng-bind="articuloACargar.sectorCodigo" | 390 | ng-bind="articuloACargar.sectorCodigo" |
406 | ></span> | 391 | ></span> |
407 | </div> | 392 | </div> |
408 | <div class="col-8 px-1"> | 393 | <div class="col-8 px-1"> |
409 | <span ng-bind="articuloACargar.descripcion"></span> | 394 | <span ng-bind="articuloACargar.descripcion"></span> |
410 | </div> | 395 | </div> |
411 | </div> | 396 | </div> |
412 | <div class="d-flex"> | 397 | <div class="d-flex"> |
413 | <div class="col-3 px-1 m-1"> | 398 | <div class="col-3 px-1 m-1"> |
414 | <input | 399 | <input |
415 | class="form-control p-1" | 400 | class="form-control p-1" |
416 | foca-tipo-input | 401 | foca-tipo-input |
417 | min="1" | 402 | min="1" |
418 | ng-model="articuloACargar.cantidad" | 403 | ng-model="articuloACargar.cantidad" |
419 | foca-focus="!cargando" | 404 | foca-focus="!cargando" |
420 | ng-keypress="agregarATabla($event.keyCode)" | 405 | ng-keypress="agregarATabla($event.keyCode)" |
421 | style="height: auto; line-height: 1.1em" | 406 | style="height: auto; line-height: 1.1em" |
422 | > | 407 | > |
423 | </div> | 408 | </div> |
424 | <div class="col px-1 text-right"> | 409 | <div class="col px-1 text-right"> |
425 | <span ng-bind="articuloACargar.precio | | 410 | <span ng-bind="articuloACargar.precio | |
426 | currency: notaPedido.moneda.SIMBOLO : 4" | 411 | currency: notaPedido.moneda.SIMBOLO : 4" |
427 | ></span> | 412 | ></span> |
428 | </div> | 413 | </div> |
429 | <div class="col px-1 text-right"> | 414 | <div class="col px-1 text-right"> |
430 | <span | 415 | <span |
431 | ng-bind="getSubTotal() | | 416 | ng-bind="getSubTotal() | |
432 | currency: notaPedido.moneda.SIMBOLO" | 417 | currency: notaPedido.moneda.SIMBOLO" |
433 | > | 418 | > |
434 | </span> | 419 | </span> |
435 | </div> | 420 | </div> |
436 | </div> | 421 | </div> |
437 | </td> | 422 | </td> |
438 | <td class="text-center align-middle"> | 423 | <td class="text-center align-middle"> |
439 | <button | 424 | <button |
440 | class="btn btn-outline-secondary" | 425 | class="btn btn-outline-secondary" |
441 | ng-click="agregarATabla(13)" | 426 | ng-click="agregarATabla(13)" |
442 | > | 427 | > |
443 | <i class="fa fa-save"></i> | 428 | <i class="fa fa-save"></i> |
444 | </button> | 429 | </button> |
445 | </td> | 430 | </td> |
446 | </tr> | 431 | </tr> |
447 | <!-- SELECCIONAR PRODUCTO --> | 432 | <!-- SELECCIONAR PRODUCTO --> |
448 | <tr ng-show="cargando" class="d-flex"> | 433 | <tr ng-show="cargando" class="d-flex"> |
449 | <td class="col-12"> | 434 | <td class="col-12"> |
450 | <input | 435 | <input |
451 | placeholder="Seleccione Articulo" | 436 | placeholder="Seleccione Articulo" |
452 | class="form-control form-control-sm" | 437 | class="form-control form-control-sm" |
453 | readonly | 438 | readonly |
454 | ng-click="seleccionarArticulo()" | 439 | ng-click="seleccionarArticulo()" |
455 | /> | 440 | /> |
456 | </td> | 441 | </td> |
457 | </tr> | 442 | </tr> |
458 | <!-- TOOGLE EXPANDIR --> | 443 | <!-- TOOGLE EXPANDIR --> |
459 | <tr> | 444 | <tr> |
460 | <td class="col"> | 445 | <td class="col"> |
461 | <button | 446 | <button |
462 | class="btn btn-outline-secondary selectable w-100" | 447 | class="btn btn-outline-secondary selectable w-100" |
463 | ng-click="show = !show; masMenos()" | 448 | ng-click="show = !show; masMenos()" |
464 | ng-show="articulosTabla.length > 0" | 449 | ng-show="articulosTabla.length > 0" |
465 | > | 450 | > |
466 | <i | 451 | <i |
467 | class="fa fa-chevron-down" | 452 | class="fa fa-chevron-down" |
468 | ng-hide="show" | 453 | ng-hide="show" |
469 | aria-hidden="true" | 454 | aria-hidden="true" |
470 | > | 455 | > |
471 | </i> | 456 | </i> |
472 | <i | 457 | <i |
473 | class="fa fa-chevron-up" | 458 | class="fa fa-chevron-up" |
474 | ng-show="show" | 459 | ng-show="show" |
475 | aria-hidden="true"> | 460 | aria-hidden="true"> |
476 | </i> | 461 | </i> |
477 | </button> | 462 | </button> |
478 | </td> | 463 | </td> |
479 | </tr> | 464 | </tr> |
480 | <!-- FOOTER --> | 465 | <!-- FOOTER --> |
481 | <tr class="d-flex"> | 466 | <tr class="d-flex"> |
482 | <td class="align-middle no-border-top" colspan="2"> | 467 | <td class="align-middle no-border-top" colspan="2"> |
483 | <strong>Cantidad Items:</strong> | 468 | <strong>Cantidad Items:</strong> |
484 | <a ng-bind="articulosTabla.length"></a> | 469 | <a ng-bind="articulosTabla.length"></a> |
485 | </td> | 470 | </td> |
486 | <td class="text-right ml-auto table-celda-total no-border-top"> | 471 | <td class="text-right ml-auto table-celda-total no-border-top"> |
487 | <h3>Total:</h3> | 472 | <h3>Total:</h3> |
488 | </td> | 473 | </td> |
489 | <td class="table-celda-total text-right no-border-top"> | 474 | <td class="table-celda-total text-right no-border-top"> |
490 | <h3>{{getTotal() | currency: notaPedido.moneda.SIMBOLO}}</h3> | 475 | <h3>{{getTotal() | currency: notaPedido.moneda.SIMBOLO}}</h3> |
491 | </td> | 476 | </td> |
492 | </tr> | 477 | </tr> |
493 | </tfoot> | 478 | </tfoot> |
494 | </table> | 479 | </table> |
495 | </div> | 480 | </div> |
496 | </div> | 481 | </div> |
497 | <div class="col-auto my-2 col-lg-2 botonera-lateral d-none"> | 482 | <div class="col-auto my-2 col-lg-2 botonera-lateral d-none"> |
498 | <div class="col-12 mt-auto"> | 483 | <div class="col-12 mt-auto"> |
499 | <button | 484 | <button |
500 | ng-click="crearNotaPedido()" | 485 | ng-click="crearNotaPedido()" |
501 | type="submit" | 486 | type="submit" |
502 | title="Crear nota pedido" | 487 | title="Crear nota pedido" |
503 | class="btn btn-default btn-block mb-2 border border-dark" | 488 | class="btn btn-default btn-block mb-2 border border-dark" |
504 | ng-disabled="notaPedido.idRemito || saveLoading" | 489 | ng-disabled="notaPedido.idRemito || saveLoading" |
505 | > | 490 | > |
506 | <strong>GUARDAR</strong> | 491 | <strong>GUARDAR</strong> |
507 | </button> | 492 | </button> |
508 | <!-- AGREGAR FUNCIONALIDAD PAUSAR --> | 493 | <!-- AGREGAR FUNCIONALIDAD PAUSAR --> |
509 | <button | 494 | <button |
510 | type="submit" | 495 | type="submit" |
511 | title="Crear nota pedido" | 496 | title="Crear nota pedido" |
512 | class="btn btn-default btn-block mb-2 border border-dark" | 497 | class="btn btn-default btn-block mb-2 border border-dark" |
513 | > | 498 | > |
514 | <strong>PAUSAR</strong> | 499 | <strong>PAUSAR</strong> |
515 | </button> | 500 | </button> |
516 | <button | 501 | <button |
517 | ng-click="salir()" | 502 | ng-click="salir()" |
518 | type="button" | 503 | type="button" |
519 | title="Salir" | 504 | title="Salir" |
520 | class="btn btn-default btn-block border border-dark"> | 505 | class="btn btn-default btn-block border border-dark"> |
521 | <strong>SALIR</strong> | 506 | <strong>SALIR</strong> |
522 | </button> | 507 | </button> |
523 | </div> | 508 | </div> |
524 | </div> | 509 | </div> |
525 | </div> | 510 | </div> |
526 | </div> | 511 | </div> |
527 | <div class="row d-md-none fixed-bottom"> | 512 | <div class="row d-md-none fixed-bottom"> |
528 | <div class="w-100 bg-dark d-flex px-3 acciones-mobile"> | 513 | <div class="w-100 bg-dark d-flex px-3 acciones-mobile"> |
529 | <span class="ml-3 text-muted" ng-click="salir()">Salir</span> | 514 | <span class="ml-3 text-muted" ng-click="salir()">Salir</span> |
530 | <span | 515 | <span |
531 | class="mr-3 ml-auto" | 516 | class="mr-3 ml-auto" |
532 | ng-class="saveLoading ? 'text-muted' : ''" | 517 | ng-class="saveLoading ? 'text-muted' : ''" |
533 | ng-click="crearNotaPedido()" | 518 | ng-click="crearNotaPedido()" |
534 | ladda="saveLoading" | 519 | ladda="saveLoading" |
535 | data-style="expand-left" | 520 | data-style="expand-left" |
536 | >Guardar</span> | 521 | >Guardar</span> |
537 | </div> | 522 | </div> |
538 | </div> | 523 | </div> |
539 | </div> | 524 | </div> |
540 | 525 |