Commit 287af29b0965b4bba6d395b8bc5126996e4659a2
1 parent
8c0920d722
Exists in
master
Auto stash before merge of "master" and "upstream/master"
Showing
4 changed files
with
34 additions
and
5 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-modal-vendedores/dist/foca-modal-vendedores.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-busqueda-productos/dist/foca-busqueda-productos.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-proveedor/dist/foca-modal-proveedor.min.js"></script> | 25 | <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> | 26 | <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> | 27 | <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> | 28 | <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> | 29 | <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> | 30 | <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> | 31 | <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> | 32 | <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> | 33 | <script src="node_modules/foca-seguimiento/dist/foca-seguimiento.min.js"></script> |
34 | 34 | ||
35 | <script src="src/js/app.js"></script> | 35 | <script src="src/js/app.js"></script> |
36 | <script src="src/js/controller.js"></script> | 36 | <script src="src/js/controller.js"></script> |
37 | <script src="src/js/service.js"></script> | 37 | <script src="src/js/service.js"></script> |
38 | <script src="src/js/businessService.js"></script> | 38 | <script src="src/js/businessService.js"></script> |
39 | <script src="src/js/route.js"></script> | 39 | <script src="src/js/route.js"></script> |
40 | 40 | ||
41 | <script src="src/etc/develop.js"></script> | 41 | <script src="src/etc/develop.js"></script> |
42 | </head> | 42 | </head> |
43 | <body> | 43 | <body> |
44 | <style> | ||
45 | .active{color:#fff;text-decoration:none;outline:0;background-color:#337ab7}.btn-xs{padding:.15rem .5rem;font-size:.8rem;line-height:1.5;border-radius:.2rem}.no-border-bottom{border-bottom:0 !important}.no-border-top{border-top:0 !important}.no-border{border:0 !important}.margin-bottom-mobile{margin-bottom:2.5em !important}.tamaño-boton{width:44px}.modal-content{height:auto;max-height:100%;border-radius:0}.modal-dialog{width:100%;height:100%;margin:0;padding:0}.botonera .btn{margin-bottom:5px}.botonera-lateral>.row{height:420px}.botonera-principal menuitem{display:inline-block;height:130px;text-align:center;width:180px}.botonera-principal button{background-image:url("../img/botonera.png");border-radius:12px;border-width:0;height:90px;position:relative;width:90px}.botonera-principal button span{left:0;position:absolute;text-align:center;top:90px;width:100%;font-size:12px;color:#777777}.botonera-principal-menu{padding-left:90px}.botonera-principal-logo{width:80%;opacity:.8}.botonera-principal-vacio button{background-position:-4380px 0}.botonera-principal-vacio button:hover{background-position:-4380px -90px}.botonera-principal-abrir-turno button{background-position:0 0}.botonera-principal-abrir-turno button:hover{background-position:0 -90px}.botonera-principal-cerrar-turno button{background-position:-90px 0}.botonera-principal-cerrar-turno button:hover{background-position:-90px -90px}.botonera-principal-caja button{background-position:-180px 0}.botonera-principal-caja button:hover{background-position:-180px -90px}.botonera-principal-facturador button{background-position:-270px 0px}.botonera-principal-facturador button:hover{background-position:-270px -90px}.botonera-principal-nota-pedido button{background-position:-1250px 0px}.botonera-principal-nota-pedido button:hover{background-position:-1250px -90px}.botonera-secundaria{background-color:rgba(0,0,0,0.8)}.botonera-secundaria .row{border-radius:5px;overflow:hidden}.botonera-secundaria .btn{border-radius:0;margin-right:1px;width:calc(100% - 1px);margin-bottom:1px}body{background-color:#cccccc}.contenedor{background-image:radial-gradient(circle at 50% 50%, #ebecf1, #abaec3)}@media (min-width: 768px){.contenedor{min-height:600px;min-width:800px}}.grilla-articulo{background-color:rgba(0,0,0,0.8)}@media (min-width: 768px){.grilla-articulo{height:430px}}.lista{background-color:rgba(0,0,0,0.8);padding:10px}.lista tr{background:linear-gradient(rgba(0,0,0,0), rgba(0,0,0,0.5))}.lista tbody td{border-top:none;color:#ffffff}.lista thead th{border-bottom:1px solid #ffffff;border-top:none;color:#ffffff;font-family:sans-serif;font-size:12px}.lista .boton-accion{background:none;color:#ffffff;border:1px solid #ffffff;border-radius:30px;padding:5px 7px}.lista .boton-accion i{font-size:16px}.login{background-color:#bdbdbd;border:1px solid #000000;border-radius:3px;height:155px;left:calc(50% - 130px);opacity:0.7;position:absolute;text-align:center;top:190px;width:260px}.login-titulo{border-bottom:1px solid #ffffff;padding:5px 0}.login-campo label{display:block;font-size:12px;margin:5px 0 0}.login-campo input:focus{outline:3px solid #ff9900}.panel-informativo{background:linear-gradient(#ccc, #eee);min-height:32px}.panel-informativo .form-group{margin-bottom:5px}.panel-informativo .form-control-xs{height:calc(1.6rem);padding:.25rem .5rem;font-size:.8rem;line-height:1.3;border-radius:.2rem}.panel-informativo .label{font-size:.8em}.panel-informativo .valor{font-size:.8em}@media (max-width: 576px){.panel-informativo .nota-pedido{text-align:center}}@media (min-width: 576px){.panel-informativo .numero-pedido{text-align:center}}.table-nonfluid{width:auto}.table-celda-total{color:#000000;background-color:#FF9900}.keyboard{-webkit-touch-callout:none;-webkit-user-select:none;-khtml-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;width:62%;height:60%;margin-left:13%;margin-top:-19%;position:absolute}.keyboard table{border-spacing:10px;border-collapse:separate;z-index:100000}.keyboard table td{touch-action:none}.keyboard .letter{background-color:#bdbdbd;box-shadow:2px 2px 3px #555555;width:47px;height:50px;text-align:center;font-family:"arial";cursor:pointer;color:#000;font-size:22px}.keyboard .letter:hover{background-color:#fafafa}.keyboard .letter:active{background-color:#999;color:#fff}.keyboard .number{background-color:#bdbdbd;box-shadow:2px 2px 3px #555555;width:47px;height:35px;text-align:center;font-family:"arial";cursor:pointer;color:#000;font-size:22px}.keyboard .number:hover{background-color:#fafafa}.keyboard .number:active{background-color:#999;color:#fff}.keyboard .margin{width:40px;height:50px}.teclado-activar{background-color:#17d236}.boton-activar-teclado{margin-top:-10%;position:absolute;z-index:100000}.tabla-articulo{max-height:420px}.tabla-articulo tr{display:inline-table;table-layout:fixed}.tabla-articulo tbody{overflow-y:auto;max-height:280px;display:block}.acciones-mobile{line-height:2.5em;color:orange;font-size:1.25em}.swiper-container{height:400px}.swiper-slide{background:transparent;height:400px;text-align:unset;-webkit-align-items:unset;align-items:unset}.crear-nota-pedido-fecha input[type="date"]::-webkit-clear-button{display:none} | ||
46 | |||
47 | </style> | ||
44 | <div ng-view class="container-fluid"></div> | 48 | <div ng-view class="container-fluid"></div> |
45 | </body> | 49 | </body> |
46 | </html> | 50 | </html> |
47 | 51 |
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+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" |
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-busqueda-cliente": "git+https://debo.suite.repo/modulos-npm/foca-busqueda-cliente.git", |
24 | "foca-directivas": "git+https://debo.suite.repo/modulos-npm/foca-directivas.git", | 24 | "foca-directivas": "git+https://debo.suite.repo/modulos-npm/foca-directivas.git", |
25 | "foca-modal": "git+https://debo.suite.repo/modulos-npm/foca-modal.git", | ||
25 | "foca-modal-busqueda-productos": "git+https://debo.suite.repo/modulos-npm/foca-modal-busqueda-productos", | 26 | "foca-modal-busqueda-productos": "git+https://debo.suite.repo/modulos-npm/foca-modal-busqueda-productos", |
27 | "foca-modal-cotizacion": "git+https://debo.suite.repo/modulos-npm/foca-modal-cotizacion.git", | ||
28 | "foca-modal-domicilio": "git+https://debo.suite.repo/modulos-npm/foca-modal-domicilio.git", | ||
29 | "foca-modal-flete": "git+https://debo.suite.repo/modulos-npm/foca-modal-flete", | ||
30 | "foca-modal-moneda": "git+https://debo.suite.repo/modulos-npm/foca-modal-moneda.git", | ||
31 | "foca-modal-precio-condiciones": "git+https://debo.suite.repo/modulos-npm/foca-modal-precio-condiciones.git", | ||
26 | "foca-modal-proveedor": "git+https://debo.suite.repo/modulos-npm/foca-modal-proveedor.git", | 32 | "foca-modal-proveedor": "git+https://debo.suite.repo/modulos-npm/foca-modal-proveedor.git", |
27 | "foca-modal-vendedores": "git+https://debo.suite.repo/modulos-npm/foca-modal-vendedores.git", | 33 | "foca-modal-vendedores": "git+https://debo.suite.repo/modulos-npm/foca-modal-vendedores.git", |
28 | "foca-seguimiento": "git+https://debo.suite.repo/modulos-npm/foca-seguimiento.git" | 34 | "foca-seguimiento": "git+https://debo.suite.repo/modulos-npm/foca-seguimiento.git" |
29 | }, | 35 | }, |
30 | "devDependencies": { | 36 | "devDependencies": { |
31 | "angular": "^1.7.5", | 37 | "angular": "^1.7.5", |
32 | "angular-ladda": "^0.4.3", | 38 | "angular-ladda": "^0.4.3", |
33 | "angular-route": "^1.7.5", | 39 | "angular-route": "^1.7.5", |
34 | "bootstrap": "^4.1.3", | 40 | "bootstrap": "^4.1.3", |
35 | "foca-busqueda-cliente": "git+https://debo.suite.repo/modulos-npm/foca-busqueda-cliente.git", | 41 | "foca-busqueda-cliente": "git+https://debo.suite.repo/modulos-npm/foca-busqueda-cliente.git", |
36 | "foca-directivas": "git+https://debo.suite.repo/modulos-npm/foca-directivas.git", | 42 | "foca-directivas": "git+https://debo.suite.repo/modulos-npm/foca-directivas.git", |
37 | "foca-modal": "git+https://debo.suite.repo/modulos-npm/foca-modal.git", | 43 | "foca-modal": "git+https://debo.suite.repo/modulos-npm/foca-modal.git", |
38 | "foca-modal-busqueda-productos": "git+https://debo.suite.repo/modulos-npm/foca-modal-busqueda-productos", | 44 | "foca-modal-busqueda-productos": "git+https://debo.suite.repo/modulos-npm/foca-modal-busqueda-productos", |
39 | "foca-modal-cotizacion": "git+https://debo.suite.repo/modulos-npm/foca-modal-cotizacion.git", | 45 | "foca-modal-cotizacion": "git+https://debo.suite.repo/modulos-npm/foca-modal-cotizacion.git", |
40 | "foca-modal-domicilio": "git+https://debo.suite.repo/modulos-npm/foca-modal-domicilio.git", | 46 | "foca-modal-domicilio": "git+https://debo.suite.repo/modulos-npm/foca-modal-domicilio.git", |
41 | "foca-modal-flete": "git+https://debo.suite.repo/modulos-npm/foca-modal-flete", | 47 | "foca-modal-flete": "git+https://debo.suite.repo/modulos-npm/foca-modal-flete", |
42 | "foca-modal-moneda": "git+https://debo.suite.repo/modulos-npm/foca-modal-moneda.git", | 48 | "foca-modal-moneda": "git+https://debo.suite.repo/modulos-npm/foca-modal-moneda.git", |
43 | "foca-modal-precio-condiciones": "git+https://debo.suite.repo/modulos-npm/foca-modal-precio-condiciones.git", | 49 | "foca-modal-precio-condiciones": "git+https://debo.suite.repo/modulos-npm/foca-modal-precio-condiciones.git", |
44 | "foca-modal-proveedor": "git+https://debo.suite.repo/modulos-npm/foca-modal-proveedor.git", | 50 | "foca-modal-proveedor": "git+https://debo.suite.repo/modulos-npm/foca-modal-proveedor.git", |
45 | "foca-modal-vendedores": "git+https://debo.suite.repo/modulos-npm/foca-modal-vendedores.git", | 51 | "foca-modal-vendedores": "git+https://debo.suite.repo/modulos-npm/foca-modal-vendedores.git", |
46 | "foca-seguimiento": "git+https://debo.suite.repo/modulos-npm/foca-seguimiento.git", | 52 | "foca-seguimiento": "git+https://debo.suite.repo/modulos-npm/foca-seguimiento.git", |
47 | "font-awesome": "^4.7.0", | 53 | "font-awesome": "^4.7.0", |
48 | "gulp": "^3.9.1", | 54 | "gulp": "^3.9.1", |
49 | "gulp-angular-templatecache": "^2.2.2", | 55 | "gulp-angular-templatecache": "^2.2.3", |
50 | "gulp-clean": "^0.4.0", | 56 | "gulp-clean": "^0.4.0", |
51 | "gulp-concat": "^2.6.1", | 57 | "gulp-concat": "^2.6.1", |
52 | "gulp-connect": "^5.6.1", | 58 | "gulp-connect": "^5.6.1", |
53 | "gulp-htmlmin": "^5.0.1", | 59 | "gulp-htmlmin": "^5.0.1", |
54 | "gulp-jshint": "^2.1.0", | 60 | "gulp-jshint": "^2.1.0", |
55 | "gulp-rename": "^1.4.0", | 61 | "gulp-rename": "^1.4.0", |
56 | "gulp-replace": "^1.0.0", | 62 | "gulp-replace": "^1.0.0", |
57 | "gulp-sequence": "^1.0.0", | 63 | "gulp-sequence": "^1.0.0", |
58 | "gulp-uglify": "^3.0.1", | 64 | "gulp-uglify": "^3.0.1", |
59 | "gulp-uglify-es": "^1.0.4", | 65 | "gulp-uglify-es": "^1.0.4", |
60 | "jasmine-core": "^3.3.0", | 66 | "jasmine-core": "^3.3.0", |
61 | "jquery": "^3.3.1", | 67 | "jquery": "^3.3.1", |
62 | "jshint": "^2.9.6", | 68 | "jshint": "^2.9.6", |
63 | "ladda": "1.0.6", | 69 | "ladda": "^1.0.6", |
64 | "pre-commit": "^1.2.2", | 70 | "pre-commit": "^1.2.2", |
65 | "pump": "^3.0.0", | 71 | "pump": "^3.0.0", |
66 | "ui-bootstrap4": "^3.0.5" | 72 | "ui-bootstrap4": "^3.0.5" |
67 | } | 73 | } |
68 | } | 74 | } |
69 | 75 |
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', 'focaSeguimientoService', 'notaPedidoBusinessService', | 4 | 'focaModalService', 'focaSeguimientoService', 'notaPedidoBusinessService', |
5 | function( | 5 | function( |
6 | $scope, $uibModal, $location, $filter, crearNotaPedidoService, focaModalService, | 6 | $scope, $uibModal, $location, $filter, crearNotaPedidoService, focaModalService, |
7 | focaSeguimientoService, notaPedidoBusinessService | 7 | focaSeguimientoService, notaPedidoBusinessService |
8 | ) { | 8 | ) { |
9 | $scope.botonera = [ | 9 | $scope.botonera = [ |
10 | {texto: 'Vendedor', accion: function() {$scope.seleccionarVendedor();}}, | 10 | {texto: 'Vendedor', accion: function() {$scope.seleccionarVendedor();}}, |
11 | {texto: 'Cliente', accion: function() {$scope.seleccionarCliente();}}, | 11 | {texto: 'Cliente', accion: function() {$scope.seleccionarCliente();}}, |
12 | {texto: 'Proveedor', accion: function() {$scope.seleccionarProveedor();}}, | 12 | {texto: 'Proveedor', accion: function() {$scope.seleccionarProveedor();}}, |
13 | {texto: 'Moneda', accion: function() {$scope.abrirModalMoneda();}}, | 13 | {texto: 'Moneda', accion: function() {$scope.abrirModalMoneda();}}, |
14 | { | 14 | { |
15 | texto: 'Precios y condiciones', | 15 | texto: 'Precios y condiciones', |
16 | accion: function() {$scope.abrirModalListaPrecio();}}, | 16 | accion: function() {$scope.abrirModalListaPrecio();}}, |
17 | {texto: 'Flete', accion: function() {$scope.abrirModalFlete();}}, | 17 | {texto: 'Flete', accion: function() {$scope.abrirModalFlete();}}, |
18 | {texto: '', accion: function() {}}, | 18 | {texto: '', accion: function() {}}, |
19 | {texto: '', accion: function() {}} | 19 | {texto: '', accion: function() {}} |
20 | ]; | 20 | ]; |
21 | $scope.datepickerAbierto = false; | 21 | $scope.datepickerAbierto = false; |
22 | 22 | ||
23 | $scope.show = false; | 23 | $scope.show = false; |
24 | $scope.cargando = true; | 24 | $scope.cargando = true; |
25 | $scope.dateOptions = { | 25 | $scope.dateOptions = { |
26 | maxDate: new Date(), | 26 | maxDate: new Date(), |
27 | minDate: new Date(2010, 0, 1) | 27 | minDate: new Date(2010, 0, 1) |
28 | }; | 28 | }; |
29 | 29 | ||
30 | $scope.notaPedido = { | 30 | $scope.notaPedido = { |
31 | vendedor: {}, | 31 | vendedor: {}, |
32 | cliente: {}, | 32 | cliente: {}, |
33 | proveedor: {}, | 33 | proveedor: {}, |
34 | domicilio: {dom: ''}, | 34 | domicilio: {dom: ''}, |
35 | moneda: {}, | 35 | moneda: {}, |
36 | cotizacion: {} | 36 | cotizacion: {} |
37 | }; | 37 | }; |
38 | var monedaPorDefecto; | 38 | var monedaPorDefecto; |
39 | //Trabajo con la cotización más reciente, por eso uso siempre la primera '[0]' | 39 | //Trabajo con la cotización más reciente, por eso uso siempre la primera '[0]' |
40 | crearNotaPedidoService.getCotizacionByIdMoneda(1).then(function(res) { | 40 | crearNotaPedidoService.getCotizacionByIdMoneda(1).then(function(res) { |
41 | monedaPorDefecto = { | 41 | monedaPorDefecto = { |
42 | id: res.data[0].ID, | 42 | id: res.data[0].ID, |
43 | detalle: res.data[0].DETALLE, | 43 | detalle: res.data[0].DETALLE, |
44 | simbolo: res.data[0].SIMBOLO, | 44 | simbolo: res.data[0].SIMBOLO, |
45 | cotizaciones: res.data[0].cotizaciones | 45 | cotizaciones: res.data[0].cotizaciones |
46 | }; | 46 | }; |
47 | addCabecera('Moneda:', monedaPorDefecto.detalle); | 47 | addCabecera('Moneda:', monedaPorDefecto.detalle); |
48 | addCabecera('Fecha cotizacion:', | 48 | addCabecera('Fecha cotizacion:', |
49 | new Date(monedaPorDefecto.cotizaciones[0].FECHA).toLocaleDateString()); | 49 | new Date(monedaPorDefecto.cotizaciones[0].FECHA).toLocaleDateString()); |
50 | addCabecera('Cotizacion:', monedaPorDefecto.cotizaciones[0].COTIZACION); | 50 | addCabecera('Cotizacion:', monedaPorDefecto.cotizaciones[0].COTIZACION); |
51 | $scope.notaPedido.moneda = monedaPorDefecto; | 51 | $scope.notaPedido.moneda = monedaPorDefecto; |
52 | $scope.notaPedido.cotizacion = monedaPorDefecto.cotizaciones[0]; | 52 | $scope.notaPedido.cotizacion = monedaPorDefecto.cotizaciones[0]; |
53 | }); | 53 | }); |
54 | 54 | ||
55 | $scope.cabecera = []; | 55 | $scope.cabecera = []; |
56 | $scope.showCabecera = true; | 56 | $scope.showCabecera = true; |
57 | 57 | ||
58 | $scope.now = new Date(); | 58 | $scope.now = new Date(); |
59 | $scope.puntoVenta = Math.round(Math.random() * 10000); | 59 | $scope.puntoVenta = '0000'; |
60 | $scope.comprobante = Math.round(Math.random() * 1000000); | 60 | $scope.comprobante = '00000000'; |
61 | |||
62 | $scope.articulosTabla = []; | 61 | $scope.articulosTabla = []; |
63 | $scope.idLista = undefined; | 62 | $scope.idLista = undefined; |
64 | //La pantalla solo se usa para cargar pedidos | 63 | //La pantalla solo se usa para cargar pedidos |
65 | //var notaPedidoTemp = crearNotaPedidoService.getNotaPedido(); | 64 | //var notaPedidoTemp = crearNotaPedidoService.getNotaPedido(); |
66 | 65 | ||
67 | crearNotaPedidoService.getPrecioCondicion().then( | 66 | crearNotaPedidoService.getPrecioCondicion().then( |
68 | function(res) { | 67 | function(res) { |
69 | $scope.precioCondiciones = res.data; | 68 | $scope.precioCondiciones = res.data; |
70 | } | 69 | } |
71 | ); | 70 | ); |
71 | |||
72 | crearNotaPedidoService.getNumeroNotaPedido().then( | ||
73 | function(res) { | ||
74 | $scope.puntoVenta = rellenar(res.data.sucursal, 4); | ||
75 | $scope.comprobante = rellenar(res.data.numeroNotaPedido, 8); | ||
76 | } | ||
77 | ); | ||
72 | //La pantalla solo se usa para cargar pedidos | 78 | //La pantalla solo se usa para cargar pedidos |
73 | // if (notaPedidoTemp !== undefined) { | 79 | // if (notaPedidoTemp !== undefined) { |
74 | // notaPedidoTemp.fechaCarga = new Date(notaPedidoTemp.fechaCarga); | 80 | // notaPedidoTemp.fechaCarga = new Date(notaPedidoTemp.fechaCarga); |
75 | // $scope.notaPedido = notaPedidoTemp; | 81 | // $scope.notaPedido = notaPedidoTemp; |
76 | // $scope.notaPedido.flete = ($scope.notaPedido.flete).toString(); | 82 | // $scope.notaPedido.flete = ($scope.notaPedido.flete).toString(); |
77 | // $scope.notaPedido.bomba = ($scope.notaPedido.bomba).toString(); | 83 | // $scope.notaPedido.bomba = ($scope.notaPedido.bomba).toString(); |
78 | // $scope.idLista = $scope.notaPedido.precioCondicion; | 84 | // $scope.idLista = $scope.notaPedido.precioCondicion; |
79 | // crearNotaPedidoService | 85 | // crearNotaPedidoService |
80 | // .getArticulosByIdNotaPedido($scope.notaPedido.id).then( | 86 | // .getArticulosByIdNotaPedido($scope.notaPedido.id).then( |
81 | // function(res) { | 87 | // function(res) { |
82 | // $scope.articulosTabla = res.data; | 88 | // $scope.articulosTabla = res.data; |
83 | // } | 89 | // } |
84 | // ); | 90 | // ); |
85 | //TODO DOMICILIOS QUE SE CARGAN AL EDITAR NOTA DE PEDIDO | 91 | //TODO DOMICILIOS QUE SE CARGAN AL EDITAR NOTA DE PEDIDO |
86 | //(NO REQUERIDO EN ESTA VERSION) | 92 | //(NO REQUERIDO EN ESTA VERSION) |
87 | // crearNotaPedidoService.getDomiciliosByIdNotaPedido($scope.notaPedido.id).then( | 93 | // crearNotaPedidoService.getDomiciliosByIdNotaPedido($scope.notaPedido.id).then( |
88 | // function(res) { | 94 | // function(res) { |
89 | // $scope.notaPedido.domicilio = res.data; | 95 | // $scope.notaPedido.domicilio = res.data; |
90 | // } | 96 | // } |
91 | // ); | 97 | // ); |
92 | // } else { | 98 | // } else { |
93 | // $scope.notaPedido.fechaCarga = new Date(); | 99 | // $scope.notaPedido.fechaCarga = new Date(); |
94 | // $scope.notaPedido.bomba = '0'; | 100 | // $scope.notaPedido.bomba = '0'; |
95 | // $scope.notaPedido.flete = '0'; | 101 | // $scope.notaPedido.flete = '0'; |
96 | // $scope.idLista = undefined; | 102 | // $scope.idLista = undefined; |
97 | // } | 103 | // } |
98 | //TO DO - FUNCIONES PARA MULTIPLES DOMICILIOS NO IMPLEMENTADAS EN ESTA DEMO | 104 | //TO DO - FUNCIONES PARA MULTIPLES DOMICILIOS NO IMPLEMENTADAS EN ESTA DEMO |
99 | // $scope.addNewDom = function() { | 105 | // $scope.addNewDom = function() { |
100 | // $scope.notaPedido.domicilio.push({ 'id': 0 }); | 106 | // $scope.notaPedido.domicilio.push({ 'id': 0 }); |
101 | // }; | 107 | // }; |
102 | // $scope.removeNewChoice = function(choice) { | 108 | // $scope.removeNewChoice = function(choice) { |
103 | // if ($scope.notaPedido.domicilio.length > 1) { | 109 | // if ($scope.notaPedido.domicilio.length > 1) { |
104 | // $scope.notaPedido.domicilio.splice($scope.notaPedido.domicilio.findIndex( | 110 | // $scope.notaPedido.domicilio.splice($scope.notaPedido.domicilio.findIndex( |
105 | // function(c) { | 111 | // function(c) { |
106 | // return c.$$hashKey === choice.$$hashKey; | 112 | // return c.$$hashKey === choice.$$hashKey; |
107 | // } | 113 | // } |
108 | // ), 1); | 114 | // ), 1); |
109 | // } | 115 | // } |
110 | // }; | 116 | // }; |
111 | 117 | ||
112 | $scope.crearNotaPedido = function() { | 118 | $scope.crearNotaPedido = function() { |
113 | if(!$scope.notaPedido.vendedor.codigo) { | 119 | if(!$scope.notaPedido.vendedor.codigo) { |
114 | focaModalService.alert('Ingrese Vendedor'); | 120 | focaModalService.alert('Ingrese Vendedor'); |
115 | return; | 121 | return; |
116 | } else if(!$scope.notaPedido.cliente.cod) { | 122 | } else if(!$scope.notaPedido.cliente.cod) { |
117 | focaModalService.alert('Ingrese Cliente'); | 123 | focaModalService.alert('Ingrese Cliente'); |
118 | return; | 124 | return; |
119 | } else if(!$scope.notaPedido.proveedor.codigo) { | 125 | } else if(!$scope.notaPedido.proveedor.codigo) { |
120 | focaModalService.alert('Ingrese Proveedor'); | 126 | focaModalService.alert('Ingrese Proveedor'); |
121 | return; | 127 | return; |
122 | } else if(!$scope.notaPedido.moneda.id) { | 128 | } else if(!$scope.notaPedido.moneda.id) { |
123 | focaModalService.alert('Ingrese Moneda'); | 129 | focaModalService.alert('Ingrese Moneda'); |
124 | return; | 130 | return; |
125 | } else if(!$scope.notaPedido.cotizacion.ID) { | 131 | } else if(!$scope.notaPedido.cotizacion.ID) { |
126 | focaModalService.alert('Ingrese Cotización'); | 132 | focaModalService.alert('Ingrese Cotización'); |
127 | return; | 133 | return; |
128 | } else if(!$scope.plazosPagos) { | 134 | } else if(!$scope.plazosPagos) { |
129 | focaModalService.alert('Ingrese Precios y Condiciones'); | 135 | focaModalService.alert('Ingrese Precios y Condiciones'); |
130 | return; | 136 | return; |
131 | } else if( | 137 | } else if( |
132 | $scope.notaPedido.flete === undefined || $scope.notaPedido.flete === null) | 138 | $scope.notaPedido.flete === undefined || $scope.notaPedido.flete === null) |
133 | { | 139 | { |
134 | focaModalService.alert('Ingrese Flete'); | 140 | focaModalService.alert('Ingrese Flete'); |
135 | return; | 141 | return; |
136 | } else if(!$scope.notaPedido.domicilio.id) { | 142 | } else if(!$scope.notaPedido.domicilio.id) { |
137 | focaModalService.aler('Ingrese Domicilio'); | 143 | focaModalService.aler('Ingrese Domicilio'); |
138 | return; | 144 | return; |
139 | } else if($scope.articulosTabla.length === 0) { | 145 | } else if($scope.articulosTabla.length === 0) { |
140 | focaModalService.alert('Debe cargar al menos un articulo'); | 146 | focaModalService.alert('Debe cargar al menos un articulo'); |
141 | return; | 147 | return; |
142 | } | 148 | } |
143 | var date = new Date(); | 149 | var date = new Date(); |
144 | var notaPedido = { | 150 | var notaPedido = { |
145 | id: 0, | 151 | id: 0, |
146 | fechaCarga: new Date(date.getTime() - (date.getTimezoneOffset() * 60000)) | 152 | fechaCarga: new Date(date.getTime() - (date.getTimezoneOffset() * 60000)) |
147 | .toISOString().slice(0, 19).replace('T', ' '), | 153 | .toISOString().slice(0, 19).replace('T', ' '), |
148 | idVendedor: $scope.notaPedido.vendedor.codigo, | 154 | idVendedor: $scope.notaPedido.vendedor.codigo, |
149 | idCliente: $scope.notaPedido.cliente.cod, | 155 | idCliente: $scope.notaPedido.cliente.cod, |
150 | nombreCliente: $scope.notaPedido.cliente.nom, | 156 | nombreCliente: $scope.notaPedido.cliente.nom, |
151 | cuitCliente: $scope.notaPedido.cliente.cuit, | 157 | cuitCliente: $scope.notaPedido.cliente.cuit, |
152 | idProveedor: $scope.notaPedido.proveedor.codigo, | 158 | idProveedor: $scope.notaPedido.proveedor.codigo, |
153 | idDomicilio: $scope.notaPedido.domicilio.id, | 159 | idDomicilio: $scope.notaPedido.domicilio.id, |
154 | idCotizacion: $scope.notaPedido.cotizacion.ID, | 160 | idCotizacion: $scope.notaPedido.cotizacion.ID, |
155 | cotizacion: $scope.notaPedido.cotizacion.COTIZACION, | 161 | cotizacion: $scope.notaPedido.cotizacion.COTIZACION, |
156 | flete: $scope.notaPedido.flete, | 162 | flete: $scope.notaPedido.flete, |
157 | fob: $scope.notaPedido.fob, | 163 | fob: $scope.notaPedido.fob, |
158 | bomba: $scope.notaPedido.bomba, | 164 | bomba: $scope.notaPedido.bomba, |
159 | kilometros: $scope.notaPedido.kilometros, | 165 | kilometros: $scope.notaPedido.kilometros, |
160 | estado: 0, | 166 | estado: 0, |
161 | total: $scope.getTotal() | 167 | total: $scope.getTotal() |
162 | }; | 168 | }; |
163 | crearNotaPedidoService.crearNotaPedido(notaPedido).then( | 169 | crearNotaPedidoService.crearNotaPedido(notaPedido).then( |
164 | function(data) { | 170 | function(data) { |
165 | notaPedidoBusinessService.addArticulos($scope.articulosTabla, | 171 | notaPedidoBusinessService.addArticulos($scope.articulosTabla, |
166 | data.data.id, $scope.notaPedido.cotizacion.COTIZACION); | 172 | data.data.id, $scope.notaPedido.cotizacion.COTIZACION); |
167 | focaSeguimientoService.guardarPosicion('crear nota pedido', ''); | 173 | focaSeguimientoService.guardarPosicion('crear nota pedido', ''); |
168 | var plazos = $scope.plazosPagos; | 174 | var plazos = $scope.plazosPagos; |
175 | |||
169 | for(var j = 0; j < plazos.length; j++) { | 176 | for(var j = 0; j < plazos.length; j++) { |
170 | var json = { | 177 | var json = { |
171 | idPedido: data.data.id, | 178 | idPedido: data.data.id, |
172 | dias: plazos[j].dias | 179 | dias: plazos[j].dias |
173 | }; | 180 | }; |
174 | crearNotaPedidoService.crearPlazosParaNotaPedido(json); | 181 | crearNotaPedidoService.crearPlazosParaNotaPedido(json); |
175 | } | 182 | } |
176 | notaPedidoBusinessService.addEstado(data.data.id, | 183 | notaPedidoBusinessService.addEstado(data.data.id, |
177 | $scope.notaPedido.vendedor.codigo); | 184 | $scope.notaPedido.vendedor.codigo); |
178 | 185 | ||
179 | focaModalService.alert('Nota pedido creada'); | 186 | focaModalService.alert('Nota pedido creada'); |
180 | $scope.cabecera = []; | 187 | $scope.cabecera = []; |
181 | addCabecera('Moneda:', $scope.notaPedido.moneda.detalle); | 188 | addCabecera('Moneda:', $scope.notaPedido.moneda.detalle); |
182 | addCabecera( | 189 | addCabecera( |
183 | 'Fecha cotizacion:', | 190 | 'Fecha cotizacion:', |
184 | $filter('date')($scope.notaPedido.cotizacion.FECHA, 'dd/MM/yyyy') | 191 | $filter('date')($scope.notaPedido.cotizacion.FECHA, 'dd/MM/yyyy') |
185 | ); | 192 | ); |
186 | addCabecera('Cotizacion:', $scope.notaPedido.cotizacion.COTIZACION); | 193 | addCabecera('Cotizacion:', $scope.notaPedido.cotizacion.COTIZACION); |
187 | $scope.notaPedido.vendedor = {}; | 194 | $scope.notaPedido.vendedor = {}; |
188 | $scope.notaPedido.cliente = {}; | 195 | $scope.notaPedido.cliente = {}; |
189 | $scope.notaPedido.proveedor = {}; | 196 | $scope.notaPedido.proveedor = {}; |
190 | $scope.notaPedido.domicilio = {}; | 197 | $scope.notaPedido.domicilio = {}; |
191 | $scope.notaPedido.flete = null; | 198 | $scope.notaPedido.flete = null; |
192 | $scope.notaPedido.fob = null; | 199 | $scope.notaPedido.fob = null; |
193 | $scope.notaPedido.bomba = null; | 200 | $scope.notaPedido.bomba = null; |
194 | $scope.notaPedido.kilometros = null; | 201 | $scope.notaPedido.kilometros = null; |
195 | $scope.articulosTabla = []; | 202 | $scope.articulosTabla = []; |
196 | } | 203 | } |
197 | ); | 204 | ); |
198 | }; | 205 | }; |
199 | 206 | ||
200 | $scope.seleccionarArticulo = function() { | 207 | $scope.seleccionarArticulo = function() { |
201 | if ($scope.idLista === undefined) { | 208 | if ($scope.idLista === undefined) { |
202 | focaModalService.alert( | 209 | focaModalService.alert( |
203 | 'Primero seleccione una lista de precio y condicion'); | 210 | 'Primero seleccione una lista de precio y condicion'); |
204 | return; | 211 | return; |
205 | } | 212 | } |
206 | var modalInstance = $uibModal.open( | 213 | var modalInstance = $uibModal.open( |
207 | { | 214 | { |
208 | ariaLabelledBy: 'Busqueda de Productos', | 215 | ariaLabelledBy: 'Busqueda de Productos', |
209 | templateUrl: 'modal-busqueda-productos.html', | 216 | templateUrl: 'modal-busqueda-productos.html', |
210 | controller: 'modalBusquedaProductosCtrl', | 217 | controller: 'modalBusquedaProductosCtrl', |
211 | resolve: { | 218 | resolve: { |
212 | parametroProducto: { | 219 | parametroProducto: { |
213 | idLista: $scope.idLista, | 220 | idLista: $scope.idLista, |
214 | cotizacion: $scope.notaPedido.cotizacion.COTIZACION, | 221 | cotizacion: $scope.notaPedido.cotizacion.COTIZACION, |
215 | simbolo: $scope.notaPedido.moneda.simbolo | 222 | simbolo: $scope.notaPedido.moneda.simbolo |
216 | } | 223 | } |
217 | }, | 224 | }, |
218 | size: 'lg' | 225 | size: 'lg' |
219 | } | 226 | } |
220 | ); | 227 | ); |
221 | modalInstance.result.then( | 228 | modalInstance.result.then( |
222 | function(producto) { | 229 | function(producto) { |
223 | var newArt = | 230 | var newArt = |
224 | { | 231 | { |
225 | id: 0, | 232 | id: 0, |
226 | codigo: producto.codigo, | 233 | codigo: producto.codigo, |
227 | sector: producto.sector, | 234 | sector: producto.sector, |
228 | sectorCodigo: producto.sector + '-' + producto.codigo, | 235 | sectorCodigo: producto.sector + '-' + producto.codigo, |
229 | descripcion: producto.descripcion, | 236 | descripcion: producto.descripcion, |
230 | item: $scope.articulosTabla.length + 1, | 237 | item: $scope.articulosTabla.length + 1, |
231 | nombre: producto.descripcion, | 238 | nombre: producto.descripcion, |
232 | precio: parseFloat(producto.precio.toFixed(4)), | 239 | precio: parseFloat(producto.precio.toFixed(4)), |
233 | costoUnitario: producto.costo, | 240 | costoUnitario: producto.costo, |
234 | editCantidad: false, | 241 | editCantidad: false, |
235 | editPrecio: false | 242 | editPrecio: false |
236 | }; | 243 | }; |
237 | $scope.articuloACargar = newArt; | 244 | $scope.articuloACargar = newArt; |
238 | $scope.cargando = false; | 245 | $scope.cargando = false; |
239 | }, function() { | 246 | }, function() { |
240 | // funcion ejecutada cuando se cancela el modal | 247 | // funcion ejecutada cuando se cancela el modal |
241 | } | 248 | } |
242 | ); | 249 | ); |
243 | }; | 250 | }; |
244 | 251 | ||
245 | $scope.seleccionarVendedor = function() { | 252 | $scope.seleccionarVendedor = function() { |
246 | var modalInstance = $uibModal.open( | 253 | var modalInstance = $uibModal.open( |
247 | { | 254 | { |
248 | ariaLabelledBy: 'Busqueda de Vendedores', | 255 | ariaLabelledBy: 'Busqueda de Vendedores', |
249 | templateUrl: 'modal-vendedores.html', | 256 | templateUrl: 'modal-vendedores.html', |
250 | controller: 'modalVendedoresCtrl', | 257 | controller: 'modalVendedoresCtrl', |
251 | size: 'lg' | 258 | size: 'lg' |
252 | } | 259 | } |
253 | ); | 260 | ); |
254 | modalInstance.result.then( | 261 | modalInstance.result.then( |
255 | function(vendedor) { | 262 | function(vendedor) { |
256 | addCabecera('Vendedor:', vendedor.NomVen); | 263 | addCabecera('Vendedor:', vendedor.NomVen); |
257 | $scope.notaPedido.vendedor.codigo = vendedor.CodVen; | 264 | $scope.notaPedido.vendedor.codigo = vendedor.CodVen; |
258 | }, function() { | 265 | }, function() { |
259 | 266 | ||
260 | } | 267 | } |
261 | ); | 268 | ); |
262 | }; | 269 | }; |
263 | 270 | ||
264 | $scope.seleccionarProveedor = function() { | 271 | $scope.seleccionarProveedor = function() { |
265 | var modalInstance = $uibModal.open( | 272 | var modalInstance = $uibModal.open( |
266 | { | 273 | { |
267 | ariaLabelledBy: 'Busqueda de Proveedor', | 274 | ariaLabelledBy: 'Busqueda de Proveedor', |
268 | templateUrl: 'modal-proveedor.html', | 275 | templateUrl: 'modal-proveedor.html', |
269 | controller: 'focaModalProveedorCtrl', | 276 | controller: 'focaModalProveedorCtrl', |
270 | size: 'lg' | 277 | size: 'lg' |
271 | } | 278 | } |
272 | ); | 279 | ); |
273 | modalInstance.result.then( | 280 | modalInstance.result.then( |
274 | function(proveedor) { | 281 | function(proveedor) { |
275 | $scope.notaPedido.proveedor.codigo = proveedor.COD; | 282 | $scope.notaPedido.proveedor.codigo = proveedor.COD; |
276 | addCabecera('Proveedor:', proveedor.NOM); | 283 | addCabecera('Proveedor:', proveedor.NOM); |
277 | }, function() { | 284 | }, function() { |
278 | 285 | ||
279 | } | 286 | } |
280 | ); | 287 | ); |
281 | }; | 288 | }; |
282 | 289 | ||
283 | $scope.seleccionarCliente = function() { | 290 | $scope.seleccionarCliente = function() { |
284 | 291 | ||
285 | var modalInstance = $uibModal.open( | 292 | var modalInstance = $uibModal.open( |
286 | { | 293 | { |
287 | ariaLabelledBy: 'Busqueda de Cliente', | 294 | ariaLabelledBy: 'Busqueda de Cliente', |
288 | templateUrl: 'foca-busqueda-cliente-modal.html', | 295 | templateUrl: 'foca-busqueda-cliente-modal.html', |
289 | controller: 'focaBusquedaClienteModalController', | 296 | controller: 'focaBusquedaClienteModalController', |
290 | size: 'lg' | 297 | size: 'lg' |
291 | } | 298 | } |
292 | ); | 299 | ); |
293 | modalInstance.result.then( | 300 | modalInstance.result.then( |
294 | function(cliente) { | 301 | function(cliente) { |
295 | $scope.abrirModalDomicilios(cliente); | 302 | $scope.abrirModalDomicilios(cliente); |
296 | }, function() { | 303 | }, function() { |
297 | 304 | ||
298 | } | 305 | } |
299 | ); | 306 | ); |
300 | }; | 307 | }; |
301 | 308 | ||
302 | $scope.abrirModalDomicilios = function(cliente) { | 309 | $scope.abrirModalDomicilios = function(cliente) { |
303 | var modalInstanceDomicilio = $uibModal.open( | 310 | var modalInstanceDomicilio = $uibModal.open( |
304 | { | 311 | { |
305 | ariaLabelledBy: 'Busqueda de Domicilios', | 312 | ariaLabelledBy: 'Busqueda de Domicilios', |
306 | templateUrl: 'modal-domicilio.html', | 313 | templateUrl: 'modal-domicilio.html', |
307 | controller: 'focaModalDomicilioController', | 314 | controller: 'focaModalDomicilioController', |
308 | resolve: { idCliente: function() { return cliente.cod; }}, | 315 | resolve: { idCliente: function() { return cliente.cod; }}, |
309 | size: 'lg', | 316 | size: 'lg', |
310 | } | 317 | } |
311 | ); | 318 | ); |
312 | modalInstanceDomicilio.result.then( | 319 | modalInstanceDomicilio.result.then( |
313 | function(domicilio) { | 320 | function(domicilio) { |
314 | $scope.notaPedido.domicilio.id = domicilio.id; | 321 | $scope.notaPedido.domicilio.id = domicilio.id; |
315 | $scope.notaPedido.cliente = cliente; | 322 | $scope.notaPedido.cliente = cliente; |
316 | 323 | ||
317 | addCabecera('Cliente:', cliente.nom); | 324 | addCabecera('Cliente:', cliente.nom); |
318 | addCabecera('Domicilio:', domicilio.dom); | 325 | addCabecera('Domicilio:', domicilio.dom); |
319 | }, function() { | 326 | }, function() { |
320 | $scope.seleccionarCliente(); | 327 | $scope.seleccionarCliente(); |
321 | return; | 328 | return; |
322 | } | 329 | } |
323 | ); | 330 | ); |
324 | }; | 331 | }; |
325 | 332 | ||
326 | $scope.mostrarFichaCliente = function() { | 333 | $scope.mostrarFichaCliente = function() { |
327 | $uibModal.open( | 334 | $uibModal.open( |
328 | { | 335 | { |
329 | ariaLabelledBy: 'Datos del Cliente', | 336 | ariaLabelledBy: 'Datos del Cliente', |
330 | templateUrl: 'foca-crear-nota-pedido-ficha-cliente.html', | 337 | templateUrl: 'foca-crear-nota-pedido-ficha-cliente.html', |
331 | controller: 'focaCrearNotaPedidoFichaClienteController', | 338 | controller: 'focaCrearNotaPedidoFichaClienteController', |
332 | size: 'lg' | 339 | size: 'lg' |
333 | } | 340 | } |
334 | ); | 341 | ); |
335 | }; | 342 | }; |
336 | 343 | ||
337 | $scope.getTotal = function() { | 344 | $scope.getTotal = function() { |
338 | var total = 0; | 345 | var total = 0; |
339 | var arrayTempArticulos = $scope.articulosTabla; | 346 | var arrayTempArticulos = $scope.articulosTabla; |
340 | for (var i = 0; i < arrayTempArticulos.length; i++) { | 347 | for (var i = 0; i < arrayTempArticulos.length; i++) { |
341 | total += arrayTempArticulos[i].precio * arrayTempArticulos[i].cantidad; | 348 | total += arrayTempArticulos[i].precio * arrayTempArticulos[i].cantidad; |
342 | } | 349 | } |
343 | return parseFloat(total.toFixed(2)); | 350 | return parseFloat(total.toFixed(2)); |
344 | }; | 351 | }; |
345 | 352 | ||
346 | $scope.getSubTotal = function() { | 353 | $scope.getSubTotal = function() { |
347 | if($scope.articuloACargar) { | 354 | if($scope.articuloACargar) { |
348 | return $scope.articuloACargar.precio * $scope.articuloACargar.cantidad; | 355 | return $scope.articuloACargar.precio * $scope.articuloACargar.cantidad; |
349 | } | 356 | } |
350 | }; | 357 | }; |
351 | 358 | ||
352 | $scope.abrirModalListaPrecio = function() { | 359 | $scope.abrirModalListaPrecio = function() { |
353 | var modalInstance = $uibModal.open( | 360 | var modalInstance = $uibModal.open( |
354 | { | 361 | { |
355 | ariaLabelledBy: 'Busqueda de Precio Condición', | 362 | ariaLabelledBy: 'Busqueda de Precio Condición', |
356 | templateUrl: 'modal-precio-condicion.html', | 363 | templateUrl: 'modal-precio-condicion.html', |
357 | controller: 'focaModalPrecioCondicionController', | 364 | controller: 'focaModalPrecioCondicionController', |
358 | size: 'lg' | 365 | size: 'lg' |
359 | } | 366 | } |
360 | ); | 367 | ); |
361 | modalInstance.result.then( | 368 | modalInstance.result.then( |
362 | function(precioCondicion) { | 369 | function(precioCondicion) { |
363 | var cabecera = ''; | 370 | var cabecera = ''; |
364 | var plazosConcat = ''; | 371 | var plazosConcat = ''; |
365 | if(!Array.isArray(precioCondicion)) { | 372 | if(!Array.isArray(precioCondicion)) { |
366 | $scope.plazosPagos = precioCondicion.plazoPago; | 373 | $scope.plazosPagos = precioCondicion.plazoPago; |
367 | $scope.idLista = precioCondicion.idListaPrecio; | 374 | $scope.idLista = precioCondicion.idListaPrecio; |
368 | for(var i = 0; i < precioCondicion.plazoPago.length; i++) { | 375 | for(var i = 0; i < precioCondicion.plazoPago.length; i++) { |
369 | plazosConcat += precioCondicion.plazoPago[i].dias + ' '; | 376 | plazosConcat += precioCondicion.plazoPago[i].dias + ' '; |
370 | } | 377 | } |
371 | cabecera = precioCondicion.nombre + ' ' + plazosConcat.trim(); | 378 | cabecera = precioCondicion.nombre + ' ' + plazosConcat.trim(); |
372 | } else { //Cuando se ingresan los plazos manualmente | 379 | } else { //Cuando se ingresan los plazos manualmente |
373 | $scope.idLista = -1; //-1, el modal productos busca todos los productos | 380 | $scope.idLista = -1; //-1, el modal productos busca todos los productos |
374 | $scope.plazosPagos = precioCondicion; | 381 | $scope.plazosPagos = precioCondicion; |
375 | for(var j = 0; j < precioCondicion.length; j++) { | 382 | for(var j = 0; j < precioCondicion.length; j++) { |
376 | plazosConcat += precioCondicion[j].dias + ' '; | 383 | plazosConcat += precioCondicion[j].dias + ' '; |
377 | } | 384 | } |
378 | cabecera = 'Ingreso manual ' + plazosConcat.trim(); | 385 | cabecera = 'Ingreso manual ' + plazosConcat.trim(); |
379 | } | 386 | } |
380 | $scope.articulosTabla = []; | 387 | $scope.articulosTabla = []; |
381 | addCabecera('Precios y condiciones:', cabecera); | 388 | addCabecera('Precios y condiciones:', cabecera); |
382 | }, function() { | 389 | }, function() { |
383 | 390 | ||
384 | } | 391 | } |
385 | ); | 392 | ); |
386 | }; | 393 | }; |
387 | 394 | ||
388 | $scope.abrirModalFlete = function() { | 395 | $scope.abrirModalFlete = function() { |
389 | var modalInstance = $uibModal.open( | 396 | var modalInstance = $uibModal.open( |
390 | { | 397 | { |
391 | ariaLabelledBy: 'Busqueda de Flete', | 398 | ariaLabelledBy: 'Busqueda de Flete', |
392 | templateUrl: 'modal-flete.html', | 399 | templateUrl: 'modal-flete.html', |
393 | controller: 'focaModalFleteController', | 400 | controller: 'focaModalFleteController', |
394 | size: 'lg', | 401 | size: 'lg', |
395 | resolve: { | 402 | resolve: { |
396 | parametrosFlete: | 403 | parametrosFlete: |
397 | function() { | 404 | function() { |
398 | return { | 405 | return { |
399 | flete: $scope.notaPedido.flete ? '1' : | 406 | flete: $scope.notaPedido.flete ? '1' : |
400 | ($scope.notaPedido.fob ? 'FOB' : | 407 | ($scope.notaPedido.fob ? 'FOB' : |
401 | ($scope.notaPedido.flete === undefined ? null : '0')), | 408 | ($scope.notaPedido.flete === undefined ? null : '0')), |
402 | bomba: $scope.notaPedido.bomba ? '1' : | 409 | bomba: $scope.notaPedido.bomba ? '1' : |
403 | ($scope.notaPedido.bomba === undefined ? null : '0'), | 410 | ($scope.notaPedido.bomba === undefined ? null : '0'), |
404 | kilometros: $scope.notaPedido.kilometros | 411 | kilometros: $scope.notaPedido.kilometros |
405 | }; | 412 | }; |
406 | } | 413 | } |
407 | } | 414 | } |
408 | } | 415 | } |
409 | ); | 416 | ); |
410 | modalInstance.result.then( | 417 | modalInstance.result.then( |
411 | function(datos) { | 418 | function(datos) { |
412 | $scope.notaPedido.flete = datos.flete; | 419 | $scope.notaPedido.flete = datos.flete; |
413 | $scope.notaPedido.fob = datos.FOB; | 420 | $scope.notaPedido.fob = datos.FOB; |
414 | $scope.notaPedido.bomba = datos.bomba; | 421 | $scope.notaPedido.bomba = datos.bomba; |
415 | $scope.notaPedido.kilometros = datos.kilometros; | 422 | $scope.notaPedido.kilometros = datos.kilometros; |
416 | 423 | ||
417 | addCabecera('Flete:', datos.flete ? 'Si' : | 424 | addCabecera('Flete:', datos.flete ? 'Si' : |
418 | ($scope.notaPedido.fob ? 'FOB' : 'No')); | 425 | ($scope.notaPedido.fob ? 'FOB' : 'No')); |
419 | if(datos.flete) { | 426 | if(datos.flete) { |
420 | addCabecera('Bomba:', datos.bomba ? 'Si' : 'No'); | 427 | addCabecera('Bomba:', datos.bomba ? 'Si' : 'No'); |
421 | addCabecera('Kilometros:', datos.kilometros); | 428 | addCabecera('Kilometros:', datos.kilometros); |
422 | } else { | 429 | } else { |
423 | removeCabecera('Bomba:'); | 430 | removeCabecera('Bomba:'); |
424 | removeCabecera('Kilometros:'); | 431 | removeCabecera('Kilometros:'); |
425 | $scope.notaPedido.fob = false; | 432 | $scope.notaPedido.fob = false; |
426 | $scope.notaPedido.bomba = false; | 433 | $scope.notaPedido.bomba = false; |
427 | $scope.notaPedido.kilometros = null; | 434 | $scope.notaPedido.kilometros = null; |
428 | } | 435 | } |
429 | }, function() { | 436 | }, function() { |
430 | 437 | ||
431 | } | 438 | } |
432 | ); | 439 | ); |
433 | }; | 440 | }; |
434 | 441 | ||
435 | $scope.abrirModalMoneda = function() { | 442 | $scope.abrirModalMoneda = function() { |
436 | var modalInstance = $uibModal.open( | 443 | var modalInstance = $uibModal.open( |
437 | { | 444 | { |
438 | ariaLabelledBy: 'Busqueda de Moneda', | 445 | ariaLabelledBy: 'Busqueda de Moneda', |
439 | templateUrl: 'modal-moneda.html', | 446 | templateUrl: 'modal-moneda.html', |
440 | controller: 'focaModalMonedaController', | 447 | controller: 'focaModalMonedaController', |
441 | size: 'lg' | 448 | size: 'lg' |
442 | } | 449 | } |
443 | ); | 450 | ); |
444 | modalInstance.result.then( | 451 | modalInstance.result.then( |
445 | function(moneda) { | 452 | function(moneda) { |
446 | $scope.abrirModalCotizacion(moneda); | 453 | $scope.abrirModalCotizacion(moneda); |
447 | }, function() { | 454 | }, function() { |
448 | 455 | ||
449 | } | 456 | } |
450 | ); | 457 | ); |
451 | }; | 458 | }; |
452 | 459 | ||
453 | $scope.abrirModalCotizacion = function(moneda) { | 460 | $scope.abrirModalCotizacion = function(moneda) { |
454 | var modalInstance = $uibModal.open( | 461 | var modalInstance = $uibModal.open( |
455 | { | 462 | { |
456 | ariaLabelledBy: 'Busqueda de Cotización', | 463 | ariaLabelledBy: 'Busqueda de Cotización', |
457 | templateUrl: 'modal-cotizacion.html', | 464 | templateUrl: 'modal-cotizacion.html', |
458 | controller: 'focaModalCotizacionController', | 465 | controller: 'focaModalCotizacionController', |
459 | size: 'lg', | 466 | size: 'lg', |
460 | resolve: {idMoneda: function() {return moneda.ID;}} | 467 | resolve: {idMoneda: function() {return moneda.ID;}} |
461 | } | 468 | } |
462 | ); | 469 | ); |
463 | modalInstance.result.then( | 470 | modalInstance.result.then( |
464 | function(cotizacion) { | 471 | function(cotizacion) { |
465 | var articulosTablaTemp = $scope.articulosTabla; | 472 | var articulosTablaTemp = $scope.articulosTabla; |
466 | for(var i = 0; i < articulosTablaTemp.length; i++) { | 473 | for(var i = 0; i < articulosTablaTemp.length; i++) { |
467 | articulosTablaTemp[i].precio = articulosTablaTemp[i].precio * | 474 | articulosTablaTemp[i].precio = articulosTablaTemp[i].precio * |
468 | $scope.notaPedido.cotizacion.COTIZACION; | 475 | $scope.notaPedido.cotizacion.COTIZACION; |
469 | articulosTablaTemp[i].precio = articulosTablaTemp[i].precio / | 476 | articulosTablaTemp[i].precio = articulosTablaTemp[i].precio / |
470 | cotizacion.COTIZACION; | 477 | cotizacion.COTIZACION; |
471 | } | 478 | } |
472 | $scope.articulosTabla = articulosTablaTemp; | 479 | $scope.articulosTabla = articulosTablaTemp; |
473 | $scope.notaPedido.moneda = { | 480 | $scope.notaPedido.moneda = { |
474 | id: moneda.ID, | 481 | id: moneda.ID, |
475 | detalle: moneda.DETALLE, | 482 | detalle: moneda.DETALLE, |
476 | simbolo: moneda.SIMBOLO | 483 | simbolo: moneda.SIMBOLO |
477 | }; | 484 | }; |
478 | $scope.notaPedido.cotizacion = { | 485 | $scope.notaPedido.cotizacion = { |
479 | ID: cotizacion.ID, | 486 | ID: cotizacion.ID, |
480 | COTIZACION: cotizacion.COTIZACION, | 487 | COTIZACION: cotizacion.COTIZACION, |
481 | FECHA: cotizacion.FECHA | 488 | FECHA: cotizacion.FECHA |
482 | }; | 489 | }; |
483 | addCabecera('Moneda:', moneda.DETALLE); | 490 | addCabecera('Moneda:', moneda.DETALLE); |
484 | addCabecera( | 491 | addCabecera( |
485 | 'Fecha cotizacion:', | 492 | 'Fecha cotizacion:', |
486 | $filter('date')(cotizacion.FECHA, 'dd/MM/yyyy') | 493 | $filter('date')(cotizacion.FECHA, 'dd/MM/yyyy') |
487 | ); | 494 | ); |
488 | addCabecera('Cotizacion:', cotizacion.COTIZACION); | 495 | addCabecera('Cotizacion:', cotizacion.COTIZACION); |
489 | }, function() { | 496 | }, function() { |
490 | 497 | ||
491 | } | 498 | } |
492 | ); | 499 | ); |
493 | }; | 500 | }; |
494 | 501 | ||
495 | $scope.agregarATabla = function(key) { | 502 | $scope.agregarATabla = function(key) { |
496 | if(key === 13) { | 503 | if(key === 13) { |
497 | if($scope.articuloACargar.cantidad === undefined || | 504 | if($scope.articuloACargar.cantidad === undefined || |
498 | $scope.articuloACargar.cantidad === 0 || | 505 | $scope.articuloACargar.cantidad === 0 || |
499 | $scope.articuloACargar.cantidad === null ){ | 506 | $scope.articuloACargar.cantidad === null ){ |
500 | focaModalService.alert('El valor debe ser al menos 1'); | 507 | focaModalService.alert('El valor debe ser al menos 1'); |
501 | return; | 508 | return; |
502 | } | 509 | } |
503 | delete $scope.articuloACargar.sectorCodigo; | 510 | delete $scope.articuloACargar.sectorCodigo; |
504 | $scope.articulosTabla.push($scope.articuloACargar); | 511 | $scope.articulosTabla.push($scope.articuloACargar); |
505 | $scope.cargando = true; | 512 | $scope.cargando = true; |
506 | } | 513 | } |
507 | }; | 514 | }; |
508 | 515 | ||
509 | $scope.quitarArticulo = function(key) { | 516 | $scope.quitarArticulo = function(key) { |
510 | $scope.articulosTabla.splice(key, 1); | 517 | $scope.articulosTabla.splice(key, 1); |
511 | }; | 518 | }; |
512 | 519 | ||
513 | $scope.editarArticulo = function(key, articulo) { | 520 | $scope.editarArticulo = function(key, articulo) { |
514 | if(key === 13) { | 521 | if(key === 13) { |
515 | if(articulo.cantidad === null || articulo.cantidad === 0 || | 522 | if(articulo.cantidad === null || articulo.cantidad === 0 || |
516 | articulo.cantidad === undefined){ | 523 | articulo.cantidad === undefined){ |
517 | focaModalService.alert('El valor debe ser al menos 1'); | 524 | focaModalService.alert('El valor debe ser al menos 1'); |
518 | return; | 525 | return; |
519 | } | 526 | } |
520 | articulo.editCantidad = false; | 527 | articulo.editCantidad = false; |
521 | articulo.editPrecio = false; | 528 | articulo.editPrecio = false; |
522 | } | 529 | } |
523 | }; | 530 | }; |
524 | 531 | ||
525 | $scope.cambioEdit = function(articulo, propiedad) { | 532 | $scope.cambioEdit = function(articulo, propiedad) { |
526 | if(propiedad === 'cantidad') { | 533 | if(propiedad === 'cantidad') { |
527 | articulo.editCantidad = true; | 534 | articulo.editCantidad = true; |
528 | } else if(propiedad === 'precio') { | 535 | } else if(propiedad === 'precio') { |
529 | articulo.editPrecio = true; | 536 | articulo.editPrecio = true; |
530 | } | 537 | } |
531 | }; | 538 | }; |
532 | 539 | ||
533 | $scope.limpiarFlete = function() { | 540 | $scope.limpiarFlete = function() { |
534 | $scope.notaPedido.fleteNombre = ''; | 541 | $scope.notaPedido.fleteNombre = ''; |
535 | $scope.notaPedido.chofer = ''; | 542 | $scope.notaPedido.chofer = ''; |
536 | $scope.notaPedido.vehiculo = ''; | 543 | $scope.notaPedido.vehiculo = ''; |
537 | $scope.notaPedido.kilometros = ''; | 544 | $scope.notaPedido.kilometros = ''; |
538 | $scope.notaPedido.costoUnitarioKmFlete = ''; | 545 | $scope.notaPedido.costoUnitarioKmFlete = ''; |
539 | $scope.choferes = ''; | 546 | $scope.choferes = ''; |
540 | $scope.vehiculos = ''; | 547 | $scope.vehiculos = ''; |
541 | }; | 548 | }; |
542 | 549 | ||
543 | $scope.limpiarPantalla = function() { | 550 | $scope.limpiarPantalla = function() { |
544 | $scope.limpiarFlete(); | 551 | $scope.limpiarFlete(); |
545 | $scope.notaPedido.flete = '0'; | 552 | $scope.notaPedido.flete = '0'; |
546 | $scope.notaPedido.bomba = '0'; | 553 | $scope.notaPedido.bomba = '0'; |
547 | $scope.notaPedido.precioCondicion = ''; | 554 | $scope.notaPedido.precioCondicion = ''; |
548 | $scope.articulosTabla = []; | 555 | $scope.articulosTabla = []; |
549 | $scope.notaPedido.vendedor.nombre = ''; | 556 | $scope.notaPedido.vendedor.nombre = ''; |
550 | $scope.notaPedido.cliente = {nombre: ''}; | 557 | $scope.notaPedido.cliente = {nombre: ''}; |
551 | $scope.notaPedido.domicilio = {dom: ''}; | 558 | $scope.notaPedido.domicilio = {dom: ''}; |
552 | $scope.domiciliosCliente = []; | 559 | $scope.domiciliosCliente = []; |
553 | }; | 560 | }; |
554 | 561 | ||
555 | $scope.resetFilter = function() { | 562 | $scope.resetFilter = function() { |
556 | $scope.articuloACargar = {}; | 563 | $scope.articuloACargar = {}; |
557 | $scope.cargando = true; | 564 | $scope.cargando = true; |
558 | }; | 565 | }; |
559 | 566 | ||
560 | $scope.selectFocus = function($event) { | 567 | $scope.selectFocus = function($event) { |
561 | $event.target.select(); | 568 | $event.target.select(); |
562 | }; | 569 | }; |
563 | 570 | ||
564 | $scope.salir = function() { | 571 | $scope.salir = function() { |
565 | $location.path('/'); | 572 | $location.path('/'); |
566 | }; | 573 | }; |
567 | 574 | ||
568 | function addCabecera(label, valor) { | 575 | function addCabecera(label, valor) { |
569 | var propiedad = $filter('filter')($scope.cabecera, {label: label}, true); | 576 | var propiedad = $filter('filter')($scope.cabecera, {label: label}, true); |
570 | if(propiedad.length === 1) { | 577 | if(propiedad.length === 1) { |
571 | propiedad[0].valor = valor; | 578 | propiedad[0].valor = valor; |
572 | } else { | 579 | } else { |
573 | $scope.cabecera.push({label: label, valor: valor}); | 580 | $scope.cabecera.push({label: label, valor: valor}); |
574 | } | 581 | } |
575 | } | 582 | } |
576 | 583 | ||
577 | function removeCabecera(label) { | 584 | function removeCabecera(label) { |
578 | var propiedad = $filter('filter')($scope.cabecera, {label: label}, true); | 585 | var propiedad = $filter('filter')($scope.cabecera, {label: label}, true); |
579 | if(propiedad.length === 1){ | 586 | if(propiedad.length === 1){ |
580 | $scope.cabecera.splice($scope.cabecera.indexOf(propiedad[0]), 1); | 587 | $scope.cabecera.splice($scope.cabecera.indexOf(propiedad[0]), 1); |
581 | } | 588 | } |
582 | } | 589 | } |
590 | |||
591 | function rellenar(relleno, longitud) { | ||
592 | relleno = '' + relleno; | ||
593 | while (relleno.length < longitud) { | ||
594 | relleno = '0' + relleno; | ||
595 | } | ||
596 | |||
597 | return relleno; | ||
598 | } | ||
583 | } | 599 | } |
584 | ] | 600 | ] |
585 | ) | 601 | ) |
586 | .controller('notaPedidoListaCtrl', [ | 602 | .controller('notaPedidoListaCtrl', [ |
587 | '$scope', | 603 | '$scope', |
588 | 'crearNotaPedidoService', | 604 | 'crearNotaPedidoService', |
589 | '$location', | 605 | '$location', |
590 | function($scope, crearNotaPedidoService, $location) { | 606 | function($scope, crearNotaPedidoService, $location) { |
591 | crearNotaPedidoService.obtenerNotaPedido().then(function(datos) { | 607 | crearNotaPedidoService.obtenerNotaPedido().then(function(datos) { |
592 | $scope.notaPedidos = datos.data; | 608 | $scope.notaPedidos = datos.data; |
593 | }); | 609 | }); |
594 | $scope.editar = function(notaPedido) { | 610 | $scope.editar = function(notaPedido) { |
595 | crearNotaPedidoService.setNotaPedido(notaPedido); | 611 | crearNotaPedidoService.setNotaPedido(notaPedido); |
596 | $location.path('/venta-nota-pedido/abm/'); | 612 | $location.path('/venta-nota-pedido/abm/'); |
597 | }; | 613 | }; |
598 | $scope.crearPedido = function() { | 614 | $scope.crearPedido = function() { |
599 | crearNotaPedidoService.clearNotaPedido(); | 615 | crearNotaPedidoService.clearNotaPedido(); |
600 | $location.path('/venta-nota-pedido/abm/'); | 616 | $location.path('/venta-nota-pedido/abm/'); |
601 | }; | 617 | }; |
602 | } | 618 | } |
603 | ]) | 619 | ]) |
604 | .controller('focaCrearNotaPedidoFichaClienteController', [ | 620 | .controller('focaCrearNotaPedidoFichaClienteController', [ |
605 | '$scope', | 621 | '$scope', |
606 | 'crearNotaPedidoService', | 622 | 'crearNotaPedidoService', |
607 | '$location', | 623 | '$location', |
608 | function($scope, crearNotaPedidoService, $location) { | 624 | function($scope, crearNotaPedidoService, $location) { |
609 | crearNotaPedidoService.obtenerNotaPedido().then(function(datos) { | 625 | crearNotaPedidoService.obtenerNotaPedido().then(function(datos) { |
610 | $scope.notaPedidos = datos.data; | 626 | $scope.notaPedidos = datos.data; |
611 | }); | 627 | }); |
612 | $scope.editar = function(notaPedido) { | 628 | $scope.editar = function(notaPedido) { |
613 | crearNotaPedidoService.setNotaPedido(notaPedido); | 629 | crearNotaPedidoService.setNotaPedido(notaPedido); |
614 | $location.path('/venta-nota-pedido/abm/'); | 630 | $location.path('/venta-nota-pedido/abm/'); |
615 | }; | 631 | }; |
616 | $scope.crearPedido = function() { | 632 | $scope.crearPedido = function() { |
617 | crearNotaPedidoService.clearNotaPedido(); | 633 | crearNotaPedidoService.clearNotaPedido(); |
618 | $location.path('/venta-nota-pedido/abm/'); | 634 | $location.path('/venta-nota-pedido/abm/'); |
619 | }; | 635 | }; |
620 | } | 636 | } |
621 | ]); | 637 | ]); |
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 | }, | ||
55 | getNumeroNotaPedido: function() { | ||
56 | return $http.get(route + '/nota-pedido/numero-siguiente'); | ||
54 | } | 57 | } |
55 | }; | 58 | }; |
56 | }]); | 59 | }]); |
57 | 60 |