Commit e202c4bf9769982fea33ee329f687074e7b09ad5
Exists in
master
Merge branch 'master' into 'master'
Master See merge request modulos-npm/foca-crear-remito!7
Showing
4 changed files
Show diff stats
index.html
| 1 | <html ng-app="focaCrearRemito"> | 1 | <html ng-app="focaCrearRemito"> |
| 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/angular-cookies/angular-cookies.min.js"></script> | 16 | <script src="node_modules/angular-cookies/angular-cookies.min.js"></script> |
| 17 | <script src="node_modules/ui-bootstrap4/dist/ui-bootstrap-tpls.js"></script> | 17 | <script src="node_modules/ui-bootstrap4/dist/ui-bootstrap-tpls.js"></script> |
| 18 | <script src="node_modules/ladda/dist/spin.min.js"></script> | 18 | <script src="node_modules/ladda/dist/spin.min.js"></script> |
| 19 | <script src="node_modules/ladda/dist/ladda.min.js"></script> | 19 | <script src="node_modules/ladda/dist/ladda.min.js"></script> |
| 20 | <script src="node_modules/angular-ladda/dist/angular-ladda.min.js"></script> | 20 | <script src="node_modules/angular-ladda/dist/angular-ladda.min.js"></script> |
| 21 | <script src="vendor/cordovaGeolocationModule.min.js"></script> | 21 | <script src="vendor/cordovaGeolocationModule.min.js"></script> |
| 22 | 22 | ||
| 23 | <script src="node_modules/foca-directivas/dist/foca-directivas.min.js"></script> | 23 | <script src="node_modules/foca-directivas/dist/foca-directivas.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-vendedores/dist/foca-modal-vendedores.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-busqueda-productos/dist/foca-busqueda-productos.min.js"></script> |
| 26 | <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> |
| 27 | <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> |
| 28 | <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> |
| 29 | <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> |
| 30 | <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> |
| 31 | <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> |
| 32 | <script src="./node_modules/foca-configuracion/dist/foca-configuracion.min.js"></script> | 32 | <script src="./node_modules/foca-configuracion/dist/foca-configuracion.min.js"></script> |
| 33 | <script src="node_modules/foca-modal-moneda/dist/foca-modal-moneda.min.js"></script> | 33 | <script src="node_modules/foca-modal-moneda/dist/foca-modal-moneda.min.js"></script> |
| 34 | <script src="node_modules/foca-modal-cotizacion/dist/foca-modal-cotizacion.min.js"></script> | 34 | <script src="node_modules/foca-modal-cotizacion/dist/foca-modal-cotizacion.min.js"></script> |
| 35 | <script src="node_modules/foca-seguimiento/dist/foca-seguimiento.min.js"></script> | 35 | <script src="node_modules/foca-seguimiento/dist/foca-seguimiento.min.js"></script> |
| 36 | <script src="node_modules/foca-modal-nota-pedido/dist/foca-modal-nota-pedido.min.js"></script> | ||
| 36 | 37 | ||
| 37 | <script src="src/js/app.js"></script> | 38 | <script src="src/js/app.js"></script> |
| 38 | <script src="src/js/controller.js"></script> | 39 | <script src="src/js/controller.js"></script> |
| 39 | <script src="src/js/service.js"></script> | 40 | <script src="src/js/service.js"></script> |
| 40 | <script src="src/js/businessService.js"></script> | 41 | <script src="src/js/businessService.js"></script> |
| 41 | <script src="src/js/route.js"></script> | 42 | <script src="src/js/route.js"></script> |
| 42 | 43 | ||
| 43 | <script src="src/etc/develop.js"></script> | 44 | <script src="src/etc/develop.js"></script> |
| 44 | </head> | 45 | </head> |
| 45 | <body> | 46 | <body> |
| 46 | <div ng-view class="container-fluid"></div> | 47 | <div ng-view class="container-fluid"></div> |
| 47 | </body> | 48 | </body> |
| 48 | </html> | 49 | </html> |
| 49 | 50 |
package.json
| 1 | { | 1 | { |
| 2 | "name": "foca-crear-remito", | 2 | "name": "foca-crear-remito", |
| 3 | "version": "0.0.1", | 3 | "version": "0.0.1", |
| 4 | "description": "Listado y ABM nota de remitos", | 4 | "description": "Listado y ABM nota de remitos", |
| 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 angular-cookies bootstrap ui-bootstrap4 font-awesome gulp gulp-angular-templatecache gulp-connect gulp-clean gulp-htmlmin gulp-jshint gulp-rename gulp-replace gulp-sequence gulp-uglify-es gulp-uglify jquery jshint pump 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 git+https://debo.suite.repo/modulos-npm/foca-configuracion.git" | 11 | "install-dev": "npm install -D jasmine-core pre-commit angular angular-ladda ladda@1.0.6 angular-route angular-cookies bootstrap ui-bootstrap4 font-awesome gulp gulp-angular-templatecache gulp-connect gulp-clean gulp-htmlmin gulp-jshint gulp-rename gulp-replace gulp-sequence gulp-uglify-es gulp-uglify jquery jshint pump 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 git+https://debo.suite.repo/modulos-npm/foca-configuracion.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-remito.git" | 18 | "url": "https://debo.suite.repo/modulos-npm/foca-crear-remito.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-busqueda-productos": "git+https://debo.suite.repo/modulos-npm/foca-modal-busqueda-productos", | 25 | "foca-modal-busqueda-productos": "git+https://debo.suite.repo/modulos-npm/foca-modal-busqueda-productos", |
| 26 | "foca-modal-proveedor": "git+https://debo.suite.repo/modulos-npm/foca-modal-proveedor.git", | 26 | "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", | 27 | "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" | 28 | "foca-seguimiento": "git+https://debo.suite.repo/modulos-npm/foca-seguimiento.git" |
| 29 | }, | 29 | }, |
| 30 | "devDependencies": { | 30 | "devDependencies": { |
| 31 | "angular": "^1.7.5", | 31 | "angular": "^1.7.5", |
| 32 | "angular-cookies": "^1.7.5", | ||
| 32 | "angular-ladda": "^0.4.3", | 33 | "angular-ladda": "^0.4.3", |
| 33 | "angular-route": "^1.7.5", | 34 | "angular-route": "^1.7.5", |
| 34 | "bootstrap": "^4.1.3", | 35 | "bootstrap": "^4.1.3", |
| 35 | "foca-busqueda-cliente": "git+https://debo.suite.repo/modulos-npm/foca-busqueda-cliente.git", | 36 | "foca-busqueda-cliente": "git+https://debo.suite.repo/modulos-npm/foca-busqueda-cliente.git", |
| 37 | "foca-configuracion": "git+https://debo.suite.repo/modulos-npm/foca-configuracion.git", | ||
| 36 | "foca-directivas": "git+https://debo.suite.repo/modulos-npm/foca-directivas.git", | 38 | "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", | 39 | "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", | 40 | "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", | 41 | "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", | 42 | "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", | 43 | "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", | 44 | "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", | 45 | "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", | 46 | "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", | 47 | "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", | 48 | "foca-seguimiento": "git+https://debo.suite.repo/modulos-npm/foca-seguimiento.git", |
| 47 | "font-awesome": "^4.7.0", | 49 | "font-awesome": "^4.7.0", |
| 48 | "gulp": "^3.9.1", | 50 | "gulp": "^3.9.1", |
| 49 | "gulp-angular-templatecache": "^2.2.2", | 51 | "gulp-angular-templatecache": "^2.2.5", |
| 50 | "gulp-clean": "^0.4.0", | 52 | "gulp-clean": "^0.4.0", |
| 51 | "gulp-concat": "^2.6.1", | 53 | "gulp-concat": "^2.6.1", |
| 52 | "gulp-connect": "^5.6.1", | 54 | "gulp-connect": "^5.6.1", |
| 53 | "gulp-htmlmin": "^5.0.1", | 55 | "gulp-htmlmin": "^5.0.1", |
| 54 | "gulp-jshint": "^2.1.0", | 56 | "gulp-jshint": "^2.1.0", |
| 55 | "gulp-rename": "^1.4.0", | 57 | "gulp-rename": "^1.4.0", |
| 56 | "gulp-replace": "^1.0.0", | 58 | "gulp-replace": "^1.0.0", |
| 57 | "gulp-sequence": "^1.0.0", | 59 | "gulp-sequence": "^1.0.0", |
| 58 | "gulp-uglify": "^3.0.1", | 60 | "gulp-uglify": "^3.0.1", |
| 59 | "gulp-uglify-es": "^1.0.4", | 61 | "gulp-uglify-es": "^1.0.4", |
| 60 | "jasmine-core": "^3.3.0", | 62 | "jasmine-core": "^3.3.0", |
| 61 | "jquery": "^3.3.1", | 63 | "jquery": "^3.3.1", |
| 62 | "jshint": "^2.9.6", | 64 | "jshint": "^2.9.6", |
| 63 | "ladda": "1.0.6", | 65 | "ladda": "1.0.6", |
| 64 | "pre-commit": "^1.2.2", | 66 | "pre-commit": "^1.2.2", |
| 65 | "pump": "^3.0.0", | 67 | "pump": "^3.0.0", |
| 66 | "ui-bootstrap4": "^3.0.5", | 68 | "ui-bootstrap4": "^3.0.5" |
| 67 | "angular-cookies": "^1.7.5", | ||
| 68 | "foca-configuracion": "git+https://debo.suite.repo/modulos-npm/foca-configuracion.git" | ||
| 69 | } | 69 | } |
src/js/app.js
| 1 | angular.module('focaCrearRemito', [ | 1 | angular.module('focaCrearRemito', [ |
| 2 | 'ngRoute', | 2 | 'ngRoute', |
| 3 | 'ngCookies', | 3 | 'ngCookies', |
| 4 | 'ui.bootstrap', | 4 | 'ui.bootstrap', |
| 5 | 'focaModalVendedores', | 5 | 'focaModalVendedores', |
| 6 | 'focaBusquedaProductos', | 6 | 'focaBusquedaProductos', |
| 7 | 'focaModalProveedor', | 7 | 'focaModalProveedor', |
| 8 | 'focaBusquedaCliente', | 8 | 'focaBusquedaCliente', |
| 9 | 'focaModalPrecioCondicion', | 9 | 'focaModalPrecioCondicion', |
| 10 | 'focaModalFlete', | 10 | 'focaModalFlete', |
| 11 | 'focaDirectivas', | 11 | 'focaDirectivas', |
| 12 | 'focaModal', | 12 | 'focaModal', |
| 13 | 'focaModalDomicilio', | 13 | 'focaModalDomicilio', |
| 14 | 'focaModalMoneda', | 14 | 'focaModalMoneda', |
| 15 | 'focaModalCotizacion', | 15 | 'focaModalCotizacion', |
| 16 | 'focaConfiguracion', | 16 | 'focaConfiguracion', |
| 17 | 'angular-ladda' | 17 | 'angular-ladda', |
| 18 | 'focaModalNotaPedido' | ||
| 18 | ]); | 19 | ]); |
| 19 | 20 |
src/js/controller.js
| 1 | angular.module('focaCrearRemito') .controller('remitoController', | 1 | angular.module('focaCrearRemito') .controller('remitoController', |
| 2 | [ | 2 | [ |
| 3 | '$scope', '$uibModal', '$location', '$filter', 'crearRemitoService', | 3 | '$scope', '$uibModal', '$location', '$filter', 'crearRemitoService', |
| 4 | 'focaModalService', 'remitoBusinessService', | 4 | 'focaModalService', 'remitoBusinessService', |
| 5 | function( | 5 | function( |
| 6 | $scope, $uibModal, $location, $filter, crearRemitoService, focaModalService, | 6 | $scope, $uibModal, $location, $filter, crearRemitoService, focaModalService, |
| 7 | remitoBusinessService | 7 | remitoBusinessService |
| 8 | ) { | 8 | ) { |
| 9 | $scope.botonera = [ | 9 | $scope.botonera = [ |
| 10 | {texto: 'Nota Pedido', accion: function() {$scope.seleccionarNotaPedido();}}, | 10 | {texto: 'Nota Pedido', accion: function() {$scope.seleccionarNotaPedido();}}, |
| 11 | {texto: 'Vendedor', accion: function() {$scope.seleccionarVendedor();}}, | 11 | {texto: 'Vendedor', accion: function() {$scope.seleccionarVendedor();}}, |
| 12 | {texto: 'Cliente', accion: function() {$scope.seleccionarCliente();}}, | 12 | {texto: 'Cliente', accion: function() {$scope.seleccionarCliente();}}, |
| 13 | {texto: 'Proveedor', accion: function() {$scope.seleccionarProveedor();}}, | 13 | {texto: 'Proveedor', accion: function() {$scope.seleccionarProveedor();}}, |
| 14 | {texto: 'Moneda', accion: function() {$scope.abrirModalMoneda();}}, | 14 | {texto: 'Moneda', accion: function() {$scope.abrirModalMoneda();}}, |
| 15 | { | 15 | { |
| 16 | texto: 'Precios y condiciones', | 16 | texto: 'Precios y condiciones', |
| 17 | accion: function() {$scope.abrirModalListaPrecio();}}, | 17 | accion: function() {$scope.abrirModalListaPrecio();}}, |
| 18 | {texto: 'Flete', accion: function() {$scope.abrirModalFlete();}}, | 18 | {texto: 'Flete', accion: function() {$scope.abrirModalFlete();}}, |
| 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.remito = { | 30 | $scope.remito = { |
| 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 | crearRemitoService.getCotizacionByIdMoneda(1).then(function(res) { | 40 | crearRemitoService.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.remito.moneda = monedaPorDefecto; | 51 | $scope.remito.moneda = monedaPorDefecto; |
| 52 | $scope.remito.cotizacion = monedaPorDefecto.cotizaciones[0]; | 52 | $scope.remito.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 = Math.round(Math.random() * 10000); |
| 60 | $scope.comprobante = Math.round(Math.random() * 1000000); | 60 | $scope.comprobante = Math.round(Math.random() * 1000000); |
| 61 | 61 | ||
| 62 | $scope.articulosTabla = []; | 62 | $scope.articulosTabla = []; |
| 63 | $scope.idLista = undefined; | 63 | $scope.idLista = undefined; |
| 64 | //La pantalla solo se usa para cargar remitos | 64 | //La pantalla solo se usa para cargar remitos |
| 65 | //var remitoTemp = crearRemitoService.getRemito(); | 65 | //var remitoTemp = crearRemitoService.getRemito(); |
| 66 | 66 | ||
| 67 | crearRemitoService.getPrecioCondicion().then( | 67 | crearRemitoService.getPrecioCondicion().then( |
| 68 | function(res) { | 68 | function(res) { |
| 69 | $scope.precioCondiciones = res.data; | 69 | $scope.precioCondiciones = res.data; |
| 70 | } | 70 | } |
| 71 | ); | 71 | ); |
| 72 | 72 | ||
| 73 | crearRemitoService.getNumeroRemito().then( | 73 | crearRemitoService.getNumeroRemito().then( |
| 74 | function(res) { | 74 | function(res) { |
| 75 | $scope.puntoVenta = rellenar(res.data.sucursal, 4); | 75 | $scope.puntoVenta = rellenar(res.data.sucursal, 4); |
| 76 | $scope.comprobante = rellenar(res.data.numeroNotaPedido, 8); | 76 | $scope.comprobante = rellenar(res.data.numeroNotaPedido, 8); |
| 77 | }, | 77 | }, |
| 78 | function(err) { | 78 | function(err) { |
| 79 | focaModalService.alert('La terminal no esta configurada correctamente'); | 79 | focaModalService.alert('La terminal no esta configurada correctamente'); |
| 80 | console.info(err); | 80 | console.info(err); |
| 81 | } | 81 | } |
| 82 | ); | 82 | ); |
| 83 | 83 | ||
| 84 | $scope.seleccionarNotaPedido = function() { | 84 | $scope.seleccionarNotaPedido = function() { |
| 85 | var modalInstance = $uibModal.open( | 85 | var modalInstance = $uibModal.open( |
| 86 | { | 86 | { |
| 87 | ariaLabelledBy: 'Busqueda de Nota de Pedido', | 87 | ariaLabelledBy: 'Busqueda de Nota de Pedido', |
| 88 | templateUrl: 'foca-modal-nota-pedido.html', | 88 | templateUrl: 'foca-modal-nota-pedido.html', |
| 89 | controller: 'focaModalNotaPedidoController', | 89 | controller: 'focaModalNotaPedidoController', |
| 90 | size: 'lg' | 90 | size: 'lg' |
| 91 | } | 91 | } |
| 92 | ); | 92 | ); |
| 93 | modalInstance.result.then( | 93 | modalInstance.result.then( |
| 94 | { | 94 | function(notaPedido) { |
| 95 | // TODO: Implementar nota de pedido | 95 | //añado cabeceras |
| 96 | removeCabecera('Moneda:'); | ||
| 97 | removeCabecera('Fecha cotizacion:'); | ||
| 98 | removeCabecera('Cotizacion:'); | ||
| 99 | var cabeceras = [ | ||
| 100 | { | ||
| 101 | label: 'Moneda', | ||
| 102 | valor: notaPedido.cotizacion[0].moneda[0].DETALLE | ||
| 103 | }, | ||
| 104 | { | ||
| 105 | label: 'Fecha cotizacion', | ||
| 106 | valor: $filter('date')(notaPedido.cotizacion[0].FECHA, | ||
| 107 | 'dd/MM/yyyy') | ||
| 108 | }, | ||
| 109 | { | ||
| 110 | label: 'Cotizacion', | ||
| 111 | valor: notaPedido.cotizacion[0].VENDEDOR | ||
| 112 | }, | ||
| 113 | { | ||
| 114 | label: 'Cliente:', | ||
| 115 | valor: notaPedido.cliente[0].NOM | ||
| 116 | }, | ||
| 117 | { | ||
| 118 | label: 'Vendedor:', | ||
| 119 | valor: notaPedido.vendedor[0].NomVen | ||
| 120 | }, | ||
| 121 | { | ||
| 122 | label: 'Proveedor:', | ||
| 123 | valor: notaPedido.proveedor[0].NOM | ||
| 124 | }, | ||
| 125 | { | ||
| 126 | label: 'Flete:', | ||
| 127 | valor: notaPedido.flete === 1 ? 'Si' : 'No' | ||
| 128 | }, | ||
| 129 | { | ||
| 130 | label: 'FOB:', | ||
| 131 | valor: notaPedido.fob === 1 ? 'Si' : 'No' | ||
| 132 | }, | ||
| 133 | { | ||
| 134 | label: 'Precio condicion:', | ||
| 135 | valor: valorPrecioCondicion() | ||
| 136 | } | ||
| 137 | ]; | ||
| 138 | //TO DO CUANDO MOSTRAR PLAZOS | ||
| 139 | function valorPrecioCondicion() { | ||
| 140 | if(notaPedido.idPrecioCondicion > 0) { | ||
| 141 | return notaPedido.precioCondicion[0].nombre; | ||
| 142 | } else { | ||
| 143 | return 'Ingreso Manual'; | ||
| 144 | } | ||
| 145 | |||
| 146 | } | ||
| 147 | |||
| 148 | if(notaPedido.flete === 1) { | ||
| 149 | var cabeceraBomba = { | ||
| 150 | label: 'Bomba', | ||
| 151 | valor: notaPedido.bomba === 1 ? 'Si' : 'No' | ||
| 152 | }; | ||
| 153 | if(notaPedido.kilometros) { | ||
| 154 | var cabeceraKilometros = { | ||
| 155 | label: 'Kilometros', | ||
| 156 | valor: notaPedido.kilometros | ||
| 157 | }; | ||
| 158 | cabeceras.push(cabeceraKilometros); | ||
| 159 | } | ||
| 160 | cabeceras.push(cabeceraBomba); | ||
| 161 | } | ||
| 162 | $scope.articulosTabla = notaPedido.articulosNotaPedido; | ||
| 163 | $scope.remito = notaPedido; | ||
| 164 | addArrayCabecera(cabeceras); | ||
| 165 | |||
| 96 | }, function() { | 166 | }, function() { |
| 97 | // funcion ejecutada cuando se cancela el modal | 167 | // funcion ejecutada cuando se cancela el modal |
| 98 | } | 168 | } |
| 99 | ); | 169 | ); |
| 100 | }; | 170 | }; |
| 101 | 171 | ||
| 102 | $scope.seleccionarRemito = function() { | 172 | $scope.seleccionarRemito = function() { |
| 103 | var modalInstance = $uibModal.open( | 173 | var modalInstance = $uibModal.open( |
| 104 | { | 174 | { |
| 105 | ariaLabelledBy: 'Busqueda de Remito', | 175 | ariaLabelledBy: 'Busqueda de Remito', |
| 106 | templateUrl: 'foca-modal-remito.html', | 176 | templateUrl: 'foca-modal-remito.html', |
| 107 | controller: 'focaModalRemitoController', | 177 | controller: 'focaModalRemitoController', |
| 108 | size: 'lg' | 178 | size: 'lg' |
| 109 | } | 179 | } |
| 110 | ); | 180 | ); |
| 111 | modalInstance.result.then( | 181 | modalInstance.result.then( |
| 112 | function(remito) { | 182 | function() { |
| 113 | // TODO: Implementar carga remito | 183 | // TODO: Implementar carga remito |
| 114 | }, function() { | 184 | }, function() { |
| 115 | // funcion ejecutada cuando se cancela el modal | 185 | // funcion ejecutada cuando se cancela el modal |
| 116 | } | 186 | } |
| 117 | ); | 187 | ); |
| 118 | }; | 188 | }; |
| 119 | 189 | ||
| 120 | //La pantalla solo se usa para cargar remitos | 190 | //La pantalla solo se usa para cargar remitos |
| 121 | // if (remitoTemp !== undefined) { | 191 | // if (remitoTemp !== undefined) { |
| 122 | // remitoTemp.fechaCarga = new Date(remitoTemp.fechaCarga); | 192 | // remitoTemp.fechaCarga = new Date(remitoTemp.fechaCarga); |
| 123 | // $scope.remito = remitoTemp; | 193 | // $scope.remito = remitoTemp; |
| 124 | // $scope.remito.flete = ($scope.remito.flete).toString(); | 194 | // $scope.remito.flete = ($scope.remito.flete).toString(); |
| 125 | // $scope.remito.bomba = ($scope.remito.bomba).toString(); | 195 | // $scope.remito.bomba = ($scope.remito.bomba).toString(); |
| 126 | // $scope.idLista = $scope.remito.precioCondicion; | 196 | // $scope.idLista = $scope.remito.precioCondicion; |
| 127 | // crearRemitoService | 197 | // crearRemitoService |
| 128 | // .getArticulosByIdRemito($scope.remito.id).then( | 198 | // .getArticulosByIdRemito($scope.remito.id).then( |
| 129 | // function(res) { | 199 | // function(res) { |
| 130 | // $scope.articulosTabla = res.data; | 200 | // $scope.articulosTabla = res.data; |
| 131 | // } | 201 | // } |
| 132 | // ); | 202 | // ); |
| 133 | //TODO DOMICILIOS QUE SE CARGAN AL EDITAR REMITO | 203 | //TODO DOMICILIOS QUE SE CARGAN AL EDITAR REMITO |
| 134 | //(NO REQUERIDO EN ESTA VERSION) | 204 | //(NO REQUERIDO EN ESTA VERSION) |
| 135 | // crearRemitoService.getDomiciliosByIdRemito($scope.remito.id).then( | 205 | // crearRemitoService.getDomiciliosByIdRemito($scope.remito.id).then( |
| 136 | // function(res) { | 206 | // function(res) { |
| 137 | // $scope.remito.domicilio = res.data; | 207 | // $scope.remito.domicilio = res.data; |
| 138 | // } | 208 | // } |
| 139 | // ); | 209 | // ); |
| 140 | // } else { | 210 | // } else { |
| 141 | // $scope.remito.fechaCarga = new Date(); | 211 | // $scope.remito.fechaCarga = new Date(); |
| 142 | // $scope.remito.bomba = '0'; | 212 | // $scope.remito.bomba = '0'; |
| 143 | // $scope.remito.flete = '0'; | 213 | // $scope.remito.flete = '0'; |
| 144 | // $scope.idLista = undefined; | 214 | // $scope.idLista = undefined; |
| 145 | // } | 215 | // } |
| 146 | //TO DO - FUNCIONES PARA MULTIPLES DOMICILIOS NO IMPLEMENTADAS EN ESTA DEMO | 216 | //TO DO - FUNCIONES PARA MULTIPLES DOMICILIOS NO IMPLEMENTADAS EN ESTA DEMO |
| 147 | // $scope.addNewDom = function() { | 217 | // $scope.addNewDom = function() { |
| 148 | // $scope.remito.domicilio.push({ 'id': 0 }); | 218 | // $scope.remito.domicilio.push({ 'id': 0 }); |
| 149 | // }; | 219 | // }; |
| 150 | // $scope.removeNewChoice = function(choice) { | 220 | // $scope.removeNewChoice = function(choice) { |
| 151 | // if ($scope.remito.domicilio.length > 1) { | 221 | // if ($scope.remito.domicilio.length > 1) { |
| 152 | // $scope.remito.domicilio.splice($scope.remito.domicilio.findIndex( | 222 | // $scope.remito.domicilio.splice($scope.remito.domicilio.findIndex( |
| 153 | // function(c) { | 223 | // function(c) { |
| 154 | // return c.$$hashKey === choice.$$hashKey; | 224 | // return c.$$hashKey === choice.$$hashKey; |
| 155 | // } | 225 | // } |
| 156 | // ), 1); | 226 | // ), 1); |
| 157 | // } | 227 | // } |
| 158 | // }; | 228 | // }; |
| 159 | 229 | ||
| 160 | $scope.crearRemito = function() { | 230 | $scope.crearRemito = function() { |
| 161 | if(!$scope.remito.vendedor.codigo) { | 231 | if(!$scope.remito.vendedor.codigo) { |
| 162 | focaModalService.alert('Ingrese Vendedor'); | 232 | focaModalService.alert('Ingrese Vendedor'); |
| 163 | return; | 233 | return; |
| 164 | } else if(!$scope.remito.cliente.cod) { | 234 | } else if(!$scope.remito.cliente.cod) { |
| 165 | focaModalService.alert('Ingrese Cliente'); | 235 | focaModalService.alert('Ingrese Cliente'); |
| 166 | return; | 236 | return; |
| 167 | } else if(!$scope.remito.proveedor.codigo) { | 237 | } else if(!$scope.remito.proveedor.codigo) { |
| 168 | focaModalService.alert('Ingrese Proveedor'); | 238 | focaModalService.alert('Ingrese Proveedor'); |
| 169 | return; | 239 | return; |
| 170 | } else if(!$scope.remito.moneda.id) { | 240 | } else if(!$scope.remito.moneda.id) { |
| 171 | focaModalService.alert('Ingrese Moneda'); | 241 | focaModalService.alert('Ingrese Moneda'); |
| 172 | return; | 242 | return; |
| 173 | } else if(!$scope.remito.cotizacion.ID) { | 243 | } else if(!$scope.remito.cotizacion.ID) { |
| 174 | focaModalService.alert('Ingrese Cotización'); | 244 | focaModalService.alert('Ingrese Cotización'); |
| 175 | return; | 245 | return; |
| 176 | } else if(!$scope.plazosPagos) { | 246 | } else if(!$scope.plazosPagos) { |
| 177 | focaModalService.alert('Ingrese Precios y Condiciones'); | 247 | focaModalService.alert('Ingrese Precios y Condiciones'); |
| 178 | return; | 248 | return; |
| 179 | } else if( | 249 | } else if( |
| 180 | $scope.remito.flete === undefined || $scope.remito.flete === null) | 250 | $scope.remito.flete === undefined || $scope.remito.flete === null) |
| 181 | { | 251 | { |
| 182 | focaModalService.alert('Ingrese Flete'); | 252 | focaModalService.alert('Ingrese Flete'); |
| 183 | return; | 253 | return; |
| 184 | } else if(!$scope.remito.domicilio.id) { | 254 | } else if(!$scope.remito.domicilio.id) { |
| 185 | focaModalService.alert('Ingrese Domicilio'); | 255 | focaModalService.alert('Ingrese Domicilio'); |
| 186 | return; | 256 | return; |
| 187 | } else if($scope.articulosTabla.length === 0) { | 257 | } else if($scope.articulosTabla.length === 0) { |
| 188 | focaModalService.alert('Debe cargar al menos un articulo'); | 258 | focaModalService.alert('Debe cargar al menos un articulo'); |
| 189 | return; | 259 | return; |
| 190 | } | 260 | } |
| 191 | var date = new Date(); | 261 | var date = new Date(); |
| 192 | var remito = { | 262 | var remito = { |
| 193 | id: 0, | 263 | id: 0, |
| 194 | fechaCarga: new Date(date.getTime() - (date.getTimezoneOffset() * 60000)) | 264 | fechaCarga: new Date(date.getTime() - (date.getTimezoneOffset() * 60000)) |
| 195 | .toISOString().slice(0, 19).replace('T', ' '), | 265 | .toISOString().slice(0, 19).replace('T', ' '), |
| 196 | idVendedor: $scope.remito.vendedor.codigo, | 266 | idVendedor: $scope.remito.vendedor.codigo, |
| 197 | idCliente: $scope.remito.cliente.cod, | 267 | idCliente: $scope.remito.cliente.cod, |
| 198 | nombreCliente: $scope.remito.cliente.nom, | 268 | nombreCliente: $scope.remito.cliente.nom, |
| 199 | cuitCliente: $scope.remito.cliente.cuit, | 269 | cuitCliente: $scope.remito.cliente.cuit, |
| 200 | idProveedor: $scope.remito.proveedor.codigo, | 270 | idProveedor: $scope.remito.proveedor.codigo, |
| 201 | idDomicilio: $scope.remito.domicilio.id, | 271 | idDomicilio: $scope.remito.domicilio.id, |
| 202 | idCotizacion: $scope.remito.cotizacion.ID, | 272 | idCotizacion: $scope.remito.cotizacion.ID, |
| 203 | cotizacion: $scope.remito.cotizacion.COTIZACION, | 273 | cotizacion: $scope.remito.cotizacion.COTIZACION, |
| 204 | flete: $scope.remito.flete, | 274 | flete: $scope.remito.flete, |
| 205 | fob: $scope.remito.fob, | 275 | fob: $scope.remito.fob, |
| 206 | bomba: $scope.remito.bomba, | 276 | bomba: $scope.remito.bomba, |
| 207 | kilometros: $scope.remito.kilometros, | 277 | kilometros: $scope.remito.kilometros, |
| 208 | estado: 0, | 278 | estado: 0, |
| 209 | total: $scope.getTotal() | 279 | total: $scope.getTotal() |
| 210 | }; | 280 | }; |
| 211 | crearRemitoService.crearRemito(remito).then( | 281 | crearRemitoService.crearRemito(remito).then( |
| 212 | function(data) { | 282 | function(data) { |
| 213 | remitoBusinessService.addArticulos($scope.articulosTabla, | 283 | remitoBusinessService.addArticulos($scope.articulosTabla, |
| 214 | data.data.id, $scope.remito.cotizacion.COTIZACION); | 284 | data.data.id, $scope.remito.cotizacion.COTIZACION); |
| 215 | var plazos = $scope.plazosPagos; | 285 | var plazos = $scope.plazosPagos; |
| 216 | for(var j = 0; j < plazos.length; j++) { | 286 | for(var j = 0; j < plazos.length; j++) { |
| 217 | var json = { | 287 | var json = { |
| 218 | idRemito: data.data.id, | 288 | idRemito: data.data.id, |
| 219 | dias: plazos[j].dias | 289 | dias: plazos[j].dias |
| 220 | }; | 290 | }; |
| 221 | crearRemitoService.crearPlazosParaRemito(json); | 291 | crearRemitoService.crearPlazosParaRemito(json); |
| 222 | } | 292 | } |
| 223 | remitoBusinessService.addEstado(data.data.id, | 293 | remitoBusinessService.addEstado(data.data.id, |
| 224 | $scope.remito.vendedor.codigo); | 294 | $scope.remito.vendedor.codigo); |
| 225 | 295 | ||
| 226 | focaModalService.alert('Nota remito creada'); | 296 | focaModalService.alert('Nota remito creada'); |
| 227 | $scope.cabecera = []; | 297 | $scope.cabecera = []; |
| 228 | addCabecera('Moneda:', $scope.remito.moneda.detalle); | 298 | addCabecera('Moneda:', $scope.remito.moneda.detalle); |
| 229 | addCabecera( | 299 | addCabecera( |
| 230 | 'Fecha cotizacion:', | 300 | 'Fecha cotizacion:', |
| 231 | $filter('date')($scope.remito.cotizacion.FECHA, 'dd/MM/yyyy') | 301 | $filter('date')($scope.remito.cotizacion.FECHA, 'dd/MM/yyyy') |
| 232 | ); | 302 | ); |
| 233 | addCabecera('Cotizacion:', $scope.remito.cotizacion.COTIZACION); | 303 | addCabecera('Cotizacion:', $scope.remito.cotizacion.COTIZACION); |
| 234 | $scope.remito.vendedor = {}; | 304 | $scope.remito.vendedor = {}; |
| 235 | $scope.remito.cliente = {}; | 305 | $scope.remito.cliente = {}; |
| 236 | $scope.remito.proveedor = {}; | 306 | $scope.remito.proveedor = {}; |
| 237 | $scope.remito.domicilio = {}; | 307 | $scope.remito.domicilio = {}; |
| 238 | $scope.remito.flete = null; | 308 | $scope.remito.flete = null; |
| 239 | $scope.remito.fob = null; | 309 | $scope.remito.fob = null; |
| 240 | $scope.remito.bomba = null; | 310 | $scope.remito.bomba = null; |
| 241 | $scope.remito.kilometros = null; | 311 | $scope.remito.kilometros = null; |
| 242 | $scope.articulosTabla = []; | 312 | $scope.articulosTabla = []; |
| 243 | } | 313 | } |
| 244 | ); | 314 | ); |
| 245 | }; | 315 | }; |
| 246 | 316 | ||
| 247 | $scope.seleccionarArticulo = function() { | 317 | $scope.seleccionarArticulo = function() { |
| 248 | if ($scope.idLista === undefined) { | 318 | if ($scope.idLista === undefined) { |
| 249 | focaModalService.alert( | 319 | focaModalService.alert( |
| 250 | 'Primero seleccione una lista de precio y condicion'); | 320 | 'Primero seleccione una lista de precio y condicion'); |
| 251 | return; | 321 | return; |
| 252 | } | 322 | } |
| 253 | var modalInstance = $uibModal.open( | 323 | var modalInstance = $uibModal.open( |
| 254 | { | 324 | { |
| 255 | ariaLabelledBy: 'Busqueda de Productos', | 325 | ariaLabelledBy: 'Busqueda de Productos', |
| 256 | templateUrl: 'modal-busqueda-productos.html', | 326 | templateUrl: 'modal-busqueda-productos.html', |
| 257 | controller: 'modalBusquedaProductosCtrl', | 327 | controller: 'modalBusquedaProductosCtrl', |
| 258 | resolve: { | 328 | resolve: { |
| 259 | parametroProducto: { | 329 | parametroProducto: { |
| 260 | idLista: $scope.idLista, | 330 | idLista: $scope.idLista, |
| 261 | cotizacion: $scope.remito.cotizacion.COTIZACION, | 331 | cotizacion: $scope.remito.cotizacion.COTIZACION, |
| 262 | simbolo: $scope.remito.moneda.simbolo | 332 | simbolo: $scope.remito.moneda.simbolo |
| 263 | } | 333 | } |
| 264 | }, | 334 | }, |
| 265 | size: 'lg' | 335 | size: 'lg' |
| 266 | } | 336 | } |
| 267 | ); | 337 | ); |
| 268 | modalInstance.result.then( | 338 | modalInstance.result.then( |
| 269 | function(producto) { | 339 | function(producto) { |
| 270 | var newArt = | 340 | var newArt = |
| 271 | { | 341 | { |
| 272 | id: 0, | 342 | id: 0, |
| 273 | codigo: producto.codigo, | 343 | codigo: producto.codigo, |
| 274 | sector: producto.sector, | 344 | sector: producto.sector, |
| 275 | sectorCodigo: producto.sector + '-' + producto.codigo, | 345 | sectorCodigo: producto.sector + '-' + producto.codigo, |
| 276 | descripcion: producto.descripcion, | 346 | descripcion: producto.descripcion, |
| 277 | item: $scope.articulosTabla.length + 1, | 347 | item: $scope.articulosTabla.length + 1, |
| 278 | nombre: producto.descripcion, | 348 | nombre: producto.descripcion, |
| 279 | precio: parseFloat(producto.precio.toFixed(4)), | 349 | precio: parseFloat(producto.precio.toFixed(4)), |
| 280 | costoUnitario: producto.costo, | 350 | costoUnitario: producto.costo, |
| 281 | editCantidad: false, | 351 | editCantidad: false, |
| 282 | editPrecio: false | 352 | editPrecio: false |
| 283 | }; | 353 | }; |
| 284 | $scope.articuloACargar = newArt; | 354 | $scope.articuloACargar = newArt; |
| 285 | $scope.cargando = false; | 355 | $scope.cargando = false; |
| 286 | }, function() { | 356 | }, function() { |
| 287 | // funcion ejecutada cuando se cancela el modal | 357 | // funcion ejecutada cuando se cancela el modal |
| 288 | } | 358 | } |
| 289 | ); | 359 | ); |
| 290 | }; | 360 | }; |
| 291 | 361 | ||
| 292 | $scope.seleccionarVendedor = function() { | 362 | $scope.seleccionarVendedor = function() { |
| 293 | var modalInstance = $uibModal.open( | 363 | var modalInstance = $uibModal.open( |
| 294 | { | 364 | { |
| 295 | ariaLabelledBy: 'Busqueda de Vendedores', | 365 | ariaLabelledBy: 'Busqueda de Vendedores', |
| 296 | templateUrl: 'modal-vendedores.html', | 366 | templateUrl: 'modal-vendedores.html', |
| 297 | controller: 'modalVendedoresCtrl', | 367 | controller: 'modalVendedoresCtrl', |
| 298 | size: 'lg' | 368 | size: 'lg' |
| 299 | } | 369 | } |
| 300 | ); | 370 | ); |
| 301 | modalInstance.result.then( | 371 | modalInstance.result.then( |
| 302 | function(vendedor) { | 372 | function(vendedor) { |
| 303 | addCabecera('Vendedor:', vendedor.NomVen); | 373 | addCabecera('Vendedor:', vendedor.NomVen); |
| 304 | $scope.remito.vendedor.codigo = vendedor.CodVen; | 374 | $scope.remito.vendedor.codigo = vendedor.CodVen; |
| 305 | }, function() { | 375 | }, function() { |
| 306 | 376 | ||
| 307 | } | 377 | } |
| 308 | ); | 378 | ); |
| 309 | }; | 379 | }; |
| 310 | 380 | ||
| 311 | $scope.seleccionarProveedor = function() { | 381 | $scope.seleccionarProveedor = function() { |
| 312 | var modalInstance = $uibModal.open( | 382 | var modalInstance = $uibModal.open( |
| 313 | { | 383 | { |
| 314 | ariaLabelledBy: 'Busqueda de Proveedor', | 384 | ariaLabelledBy: 'Busqueda de Proveedor', |
| 315 | templateUrl: 'modal-proveedor.html', | 385 | templateUrl: 'modal-proveedor.html', |
| 316 | controller: 'focaModalProveedorCtrl', | 386 | controller: 'focaModalProveedorCtrl', |
| 317 | size: 'lg' | 387 | size: 'lg' |
| 318 | } | 388 | } |
| 319 | ); | 389 | ); |
| 320 | modalInstance.result.then( | 390 | modalInstance.result.then( |
| 321 | function(proveedor) { | 391 | function(proveedor) { |
| 322 | $scope.remito.proveedor.codigo = proveedor.COD; | 392 | $scope.remito.proveedor.codigo = proveedor.COD; |
| 323 | addCabecera('Proveedor:', proveedor.NOM); | 393 | addCabecera('Proveedor:', proveedor.NOM); |
| 324 | }, function() { | 394 | }, function() { |
| 325 | 395 | ||
| 326 | } | 396 | } |
| 327 | ); | 397 | ); |
| 328 | }; | 398 | }; |
| 329 | 399 | ||
| 330 | $scope.seleccionarCliente = function() { | 400 | $scope.seleccionarCliente = function() { |
| 331 | 401 | ||
| 332 | var modalInstance = $uibModal.open( | 402 | var modalInstance = $uibModal.open( |
| 333 | { | 403 | { |
| 334 | ariaLabelledBy: 'Busqueda de Cliente', | 404 | ariaLabelledBy: 'Busqueda de Cliente', |
| 335 | templateUrl: 'foca-busqueda-cliente-modal.html', | 405 | templateUrl: 'foca-busqueda-cliente-modal.html', |
| 336 | controller: 'focaBusquedaClienteModalController', | 406 | controller: 'focaBusquedaClienteModalController', |
| 337 | size: 'lg' | 407 | size: 'lg' |
| 338 | } | 408 | } |
| 339 | ); | 409 | ); |
| 340 | modalInstance.result.then( | 410 | modalInstance.result.then( |
| 341 | function(cliente) { | 411 | function(cliente) { |
| 342 | $scope.abrirModalDomicilios(cliente); | 412 | $scope.abrirModalDomicilios(cliente); |
| 343 | }, function() { | 413 | }, function() { |
| 344 | 414 | ||
| 345 | } | 415 | } |
| 346 | ); | 416 | ); |
| 347 | }; | 417 | }; |
| 348 | 418 | ||
| 349 | $scope.abrirModalDomicilios = function(cliente) { | 419 | $scope.abrirModalDomicilios = function(cliente) { |
| 350 | var modalInstanceDomicilio = $uibModal.open( | 420 | var modalInstanceDomicilio = $uibModal.open( |
| 351 | { | 421 | { |
| 352 | ariaLabelledBy: 'Busqueda de Domicilios', | 422 | ariaLabelledBy: 'Busqueda de Domicilios', |
| 353 | templateUrl: 'modal-domicilio.html', | 423 | templateUrl: 'modal-domicilio.html', |
| 354 | controller: 'focaModalDomicilioController', | 424 | controller: 'focaModalDomicilioController', |
| 355 | resolve: { idCliente: function() { return cliente.cod; }}, | 425 | resolve: { idCliente: function() { return cliente.cod; }}, |
| 356 | size: 'lg', | 426 | size: 'lg', |
| 357 | } | 427 | } |
| 358 | ); | 428 | ); |
| 359 | modalInstanceDomicilio.result.then( | 429 | modalInstanceDomicilio.result.then( |
| 360 | function(domicilio) { | 430 | function(domicilio) { |
| 361 | $scope.remito.domicilio.id = domicilio.nivel2; | 431 | $scope.remito.domicilio.id = domicilio.nivel2; |
| 362 | $scope.remito.cliente = cliente; | 432 | $scope.remito.cliente = cliente; |
| 363 | 433 | ||
| 364 | addCabecera('Cliente:', cliente.nom); | 434 | addCabecera('Cliente:', cliente.nom); |
| 365 | addCabecera('Domicilio:', domicilio.dom); | 435 | addCabecera('Domicilio:', domicilio.dom); |
| 366 | }, function() { | 436 | }, function() { |
| 367 | $scope.seleccionarCliente(); | 437 | $scope.seleccionarCliente(); |
| 368 | return; | 438 | return; |
| 369 | } | 439 | } |
| 370 | ); | 440 | ); |
| 371 | }; | 441 | }; |
| 372 | 442 | ||
| 373 | $scope.mostrarFichaCliente = function() { | 443 | $scope.mostrarFichaCliente = function() { |
| 374 | $uibModal.open( | 444 | $uibModal.open( |
| 375 | { | 445 | { |
| 376 | ariaLabelledBy: 'Datos del Cliente', | 446 | ariaLabelledBy: 'Datos del Cliente', |
| 377 | templateUrl: 'foca-crear-remito-ficha-cliente.html', | 447 | templateUrl: 'foca-crear-remito-ficha-cliente.html', |
| 378 | controller: 'focaCrearRemitoFichaClienteController', | 448 | controller: 'focaCrearRemitoFichaClienteController', |
| 379 | size: 'lg' | 449 | size: 'lg' |
| 380 | } | 450 | } |
| 381 | ); | 451 | ); |
| 382 | }; | 452 | }; |
| 383 | 453 | ||
| 384 | $scope.getTotal = function() { | 454 | $scope.getTotal = function() { |
| 385 | var total = 0; | 455 | var total = 0; |
| 386 | var arrayTempArticulos = $scope.articulosTabla; | 456 | var arrayTempArticulos = $scope.articulosTabla; |
| 387 | for (var i = 0; i < arrayTempArticulos.length; i++) { | 457 | for (var i = 0; i < arrayTempArticulos.length; i++) { |
| 388 | total += arrayTempArticulos[i].precio * arrayTempArticulos[i].cantidad; | 458 | total += arrayTempArticulos[i].precio * arrayTempArticulos[i].cantidad; |
| 389 | } | 459 | } |
| 390 | return parseFloat(total.toFixed(2)); | 460 | return parseFloat(total.toFixed(2)); |
| 391 | }; | 461 | }; |
| 392 | 462 | ||
| 393 | $scope.getSubTotal = function() { | 463 | $scope.getSubTotal = function() { |
| 394 | if($scope.articuloACargar) { | 464 | if($scope.articuloACargar) { |
| 395 | return $scope.articuloACargar.precio * $scope.articuloACargar.cantidad; | 465 | return $scope.articuloACargar.precio * $scope.articuloACargar.cantidad; |
| 396 | } | 466 | } |
| 397 | }; | 467 | }; |
| 398 | 468 | ||
| 399 | $scope.abrirModalListaPrecio = function() { | 469 | $scope.abrirModalListaPrecio = function() { |
| 400 | var modalInstance = $uibModal.open( | 470 | var modalInstance = $uibModal.open( |
| 401 | { | 471 | { |
| 402 | ariaLabelledBy: 'Busqueda de Precio Condición', | 472 | ariaLabelledBy: 'Busqueda de Precio Condición', |
| 403 | templateUrl: 'modal-precio-condicion.html', | 473 | templateUrl: 'modal-precio-condicion.html', |
| 404 | controller: 'focaModalPrecioCondicionController', | 474 | controller: 'focaModalPrecioCondicionController', |
| 405 | size: 'lg' | 475 | size: 'lg' |
| 406 | } | 476 | } |
| 407 | ); | 477 | ); |
| 408 | modalInstance.result.then( | 478 | modalInstance.result.then( |
| 409 | function(precioCondicion) { | 479 | function(precioCondicion) { |
| 410 | var cabecera = ''; | 480 | var cabecera = ''; |
| 411 | var plazosConcat = ''; | 481 | var plazosConcat = ''; |
| 412 | if(!Array.isArray(precioCondicion)) { | 482 | if(!Array.isArray(precioCondicion)) { |
| 413 | $scope.plazosPagos = precioCondicion.plazoPago; | 483 | $scope.plazosPagos = precioCondicion.plazoPago; |
| 414 | $scope.idLista = precioCondicion.idListaPrecio; | 484 | $scope.idLista = precioCondicion.idListaPrecio; |
| 415 | for(var i = 0; i < precioCondicion.plazoPago.length; i++) { | 485 | for(var i = 0; i < precioCondicion.plazoPago.length; i++) { |
| 416 | plazosConcat += precioCondicion.plazoPago[i].dias + ' '; | 486 | plazosConcat += precioCondicion.plazoPago[i].dias + ' '; |
| 417 | } | 487 | } |
| 418 | cabecera = precioCondicion.nombre + ' ' + plazosConcat.trim(); | 488 | cabecera = precioCondicion.nombre + ' ' + plazosConcat.trim(); |
| 419 | } else { //Cuando se ingresan los plazos manualmente | 489 | } else { //Cuando se ingresan los plazos manualmente |
| 420 | $scope.idLista = -1; //-1, el modal productos busca todos los productos | 490 | $scope.idLista = -1; //-1, el modal productos busca todos los productos |
| 421 | $scope.plazosPagos = precioCondicion; | 491 | $scope.plazosPagos = precioCondicion; |
| 422 | for(var j = 0; j < precioCondicion.length; j++) { | 492 | for(var j = 0; j < precioCondicion.length; j++) { |
| 423 | plazosConcat += precioCondicion[j].dias + ' '; | 493 | plazosConcat += precioCondicion[j].dias + ' '; |
| 424 | } | 494 | } |
| 425 | cabecera = 'Ingreso manual ' + plazosConcat.trim(); | 495 | cabecera = 'Ingreso manual ' + plazosConcat.trim(); |
| 426 | } | 496 | } |
| 427 | $scope.articulosTabla = []; | 497 | $scope.articulosTabla = []; |
| 428 | addCabecera('Precios y condiciones:', cabecera); | 498 | addCabecera('Precios y condiciones:', cabecera); |
| 429 | }, function() { | 499 | }, function() { |
| 430 | 500 | ||
| 431 | } | 501 | } |
| 432 | ); | 502 | ); |
| 433 | }; | 503 | }; |
| 434 | 504 | ||
| 435 | $scope.abrirModalFlete = function() { | 505 | $scope.abrirModalFlete = function() { |
| 436 | var modalInstance = $uibModal.open( | 506 | var modalInstance = $uibModal.open( |
| 437 | { | 507 | { |
| 438 | ariaLabelledBy: 'Busqueda de Flete', | 508 | ariaLabelledBy: 'Busqueda de Flete', |
| 439 | templateUrl: 'modal-flete.html', | 509 | templateUrl: 'modal-flete.html', |
| 440 | controller: 'focaModalFleteController', | 510 | controller: 'focaModalFleteController', |
| 441 | size: 'lg', | 511 | size: 'lg', |
| 442 | resolve: { | 512 | resolve: { |
| 443 | parametrosFlete: | 513 | parametrosFlete: |
| 444 | function() { | 514 | function() { |
| 445 | return { | 515 | return { |
| 446 | flete: $scope.remito.flete ? '1' : | 516 | flete: $scope.remito.flete ? '1' : |
| 447 | ($scope.remito.fob ? 'FOB' : | 517 | ($scope.remito.fob ? 'FOB' : |
| 448 | ($scope.remito.flete === undefined ? null : '0')), | 518 | ($scope.remito.flete === undefined ? null : '0')), |
| 449 | bomba: $scope.remito.bomba ? '1' : | 519 | bomba: $scope.remito.bomba ? '1' : |
| 450 | ($scope.remito.bomba === undefined ? null : '0'), | 520 | ($scope.remito.bomba === undefined ? null : '0'), |
| 451 | kilometros: $scope.remito.kilometros | 521 | kilometros: $scope.remito.kilometros |
| 452 | }; | 522 | }; |
| 453 | } | 523 | } |
| 454 | } | 524 | } |
| 455 | } | 525 | } |
| 456 | ); | 526 | ); |
| 457 | modalInstance.result.then( | 527 | modalInstance.result.then( |
| 458 | function(datos) { | 528 | function(datos) { |
| 459 | $scope.remito.flete = datos.flete; | 529 | $scope.remito.flete = datos.flete; |
| 460 | $scope.remito.fob = datos.FOB; | 530 | $scope.remito.fob = datos.FOB; |
| 461 | $scope.remito.bomba = datos.bomba; | 531 | $scope.remito.bomba = datos.bomba; |
| 462 | $scope.remito.kilometros = datos.kilometros; | 532 | $scope.remito.kilometros = datos.kilometros; |
| 463 | 533 | ||
| 464 | addCabecera('Flete:', datos.flete ? 'Si' : | 534 | addCabecera('Flete:', datos.flete ? 'Si' : |
| 465 | ($scope.remito.fob ? 'FOB' : 'No')); | 535 | ($scope.remito.fob ? 'FOB' : 'No')); |
| 466 | if(datos.flete) { | 536 | if(datos.flete) { |
| 467 | addCabecera('Bomba:', datos.bomba ? 'Si' : 'No'); | 537 | addCabecera('Bomba:', datos.bomba ? 'Si' : 'No'); |
| 468 | addCabecera('Kilometros:', datos.kilometros); | 538 | addCabecera('Kilometros:', datos.kilometros); |
| 469 | } else { | 539 | } else { |
| 470 | removeCabecera('Bomba:'); | 540 | removeCabecera('Bomba:'); |
| 471 | removeCabecera('Kilometros:'); | 541 | removeCabecera('Kilometros:'); |
| 472 | $scope.remito.fob = false; | 542 | $scope.remito.fob = false; |
| 473 | $scope.remito.bomba = false; | 543 | $scope.remito.bomba = false; |
| 474 | $scope.remito.kilometros = null; | 544 | $scope.remito.kilometros = null; |
| 475 | } | 545 | } |
| 476 | }, function() { | 546 | }, function() { |
| 477 | 547 | ||
| 478 | } | 548 | } |
| 479 | ); | 549 | ); |
| 480 | }; | 550 | }; |
| 481 | 551 | ||
| 482 | $scope.abrirModalMoneda = function() { | 552 | $scope.abrirModalMoneda = function() { |
| 483 | var modalInstance = $uibModal.open( | 553 | var modalInstance = $uibModal.open( |
| 484 | { | 554 | { |
| 485 | ariaLabelledBy: 'Busqueda de Moneda', | 555 | ariaLabelledBy: 'Busqueda de Moneda', |
| 486 | templateUrl: 'modal-moneda.html', | 556 | templateUrl: 'modal-moneda.html', |
| 487 | controller: 'focaModalMonedaController', | 557 | controller: 'focaModalMonedaController', |
| 488 | size: 'lg' | 558 | size: 'lg' |
| 489 | } | 559 | } |
| 490 | ); | 560 | ); |
| 491 | modalInstance.result.then( | 561 | modalInstance.result.then( |
| 492 | function(moneda) { | 562 | function(moneda) { |
| 493 | $scope.abrirModalCotizacion(moneda); | 563 | $scope.abrirModalCotizacion(moneda); |
| 494 | }, function() { | 564 | }, function() { |
| 495 | 565 | ||
| 496 | } | 566 | } |
| 497 | ); | 567 | ); |
| 498 | }; | 568 | }; |
| 499 | 569 | ||
| 500 | $scope.abrirModalCotizacion = function(moneda) { | 570 | $scope.abrirModalCotizacion = function(moneda) { |
| 501 | var modalInstance = $uibModal.open( | 571 | var modalInstance = $uibModal.open( |
| 502 | { | 572 | { |
| 503 | ariaLabelledBy: 'Busqueda de Cotización', | 573 | ariaLabelledBy: 'Busqueda de Cotización', |
| 504 | templateUrl: 'modal-cotizacion.html', | 574 | templateUrl: 'modal-cotizacion.html', |
| 505 | controller: 'focaModalCotizacionController', | 575 | controller: 'focaModalCotizacionController', |
| 506 | size: 'lg', | 576 | size: 'lg', |
| 507 | resolve: {idMoneda: function() {return moneda.ID;}} | 577 | resolve: {idMoneda: function() {return moneda.ID;}} |
| 508 | } | 578 | } |
| 509 | ); | 579 | ); |
| 510 | modalInstance.result.then( | 580 | modalInstance.result.then( |
| 511 | function(cotizacion) { | 581 | function(cotizacion) { |
| 512 | var articulosTablaTemp = $scope.articulosTabla; | 582 | var articulosTablaTemp = $scope.articulosTabla; |
| 513 | for(var i = 0; i < articulosTablaTemp.length; i++) { | 583 | for(var i = 0; i < articulosTablaTemp.length; i++) { |
| 514 | articulosTablaTemp[i].precio = articulosTablaTemp[i].precio * | 584 | articulosTablaTemp[i].precio = articulosTablaTemp[i].precio * |
| 515 | $scope.remito.cotizacion.COTIZACION; | 585 | $scope.remito.cotizacion.COTIZACION; |
| 516 | articulosTablaTemp[i].precio = articulosTablaTemp[i].precio / | 586 | articulosTablaTemp[i].precio = articulosTablaTemp[i].precio / |
| 517 | cotizacion.COTIZACION; | 587 | cotizacion.COTIZACION; |
| 518 | } | 588 | } |
| 519 | $scope.articulosTabla = articulosTablaTemp; | 589 | $scope.articulosTabla = articulosTablaTemp; |
| 520 | $scope.remito.moneda = { | 590 | $scope.remito.moneda = { |
| 521 | id: moneda.ID, | 591 | id: moneda.ID, |
| 522 | detalle: moneda.DETALLE, | 592 | detalle: moneda.DETALLE, |
| 523 | simbolo: moneda.SIMBOLO | 593 | simbolo: moneda.SIMBOLO |
| 524 | }; | 594 | }; |
| 525 | $scope.remito.cotizacion = { | 595 | $scope.remito.cotizacion = { |
| 526 | ID: cotizacion.ID, | 596 | ID: cotizacion.ID, |
| 527 | COTIZACION: cotizacion.COTIZACION, | 597 | COTIZACION: cotizacion.COTIZACION, |
| 528 | FECHA: cotizacion.FECHA | 598 | FECHA: cotizacion.FECHA |
| 529 | }; | 599 | }; |
| 530 | addCabecera('Moneda:', moneda.DETALLE); | 600 | addCabecera('Moneda:', moneda.DETALLE); |
| 531 | addCabecera( | 601 | addCabecera( |
| 532 | 'Fecha cotizacion:', | 602 | 'Fecha cotizacion:', |
| 533 | $filter('date')(cotizacion.FECHA, 'dd/MM/yyyy') | 603 | $filter('date')(cotizacion.FECHA, 'dd/MM/yyyy') |
| 534 | ); | 604 | ); |
| 535 | addCabecera('Cotizacion:', cotizacion.COTIZACION); | 605 | addCabecera('Cotizacion:', cotizacion.COTIZACION); |
| 536 | }, function() { | 606 | }, function() { |
| 537 | 607 | ||
| 538 | } | 608 | } |
| 539 | ); | 609 | ); |
| 540 | }; | 610 | }; |
| 541 | 611 | ||
| 542 | $scope.agregarATabla = function(key) { | 612 | $scope.agregarATabla = function(key) { |
| 543 | if(key === 13) { | 613 | if(key === 13) { |
| 544 | if($scope.articuloACargar.cantidad === undefined || | 614 | if($scope.articuloACargar.cantidad === undefined || |
| 545 | $scope.articuloACargar.cantidad === 0 || | 615 | $scope.articuloACargar.cantidad === 0 || |
| 546 | $scope.articuloACargar.cantidad === null ) { | 616 | $scope.articuloACargar.cantidad === null ) { |
| 547 | focaModalService.alert('El valor debe ser al menos 1'); | 617 | focaModalService.alert('El valor debe ser al menos 1'); |
| 548 | return; | 618 | return; |
| 549 | } | 619 | } |
| 550 | delete $scope.articuloACargar.sectorCodigo; | 620 | delete $scope.articuloACargar.sectorCodigo; |
| 551 | $scope.articulosTabla.push($scope.articuloACargar); | 621 | $scope.articulosTabla.push($scope.articuloACargar); |
| 552 | $scope.cargando = true; | 622 | $scope.cargando = true; |
| 553 | } | 623 | } |
| 554 | }; | 624 | }; |
| 555 | 625 | ||
| 556 | $scope.quitarArticulo = function(key) { | 626 | $scope.quitarArticulo = function(key) { |
| 557 | $scope.articulosTabla.splice(key, 1); | 627 | $scope.articulosTabla.splice(key, 1); |
| 558 | }; | 628 | }; |
| 559 | 629 | ||
| 560 | $scope.editarArticulo = function(key, articulo) { | 630 | $scope.editarArticulo = function(key, articulo) { |
| 561 | if(key === 13) { | 631 | if(key === 13) { |
| 562 | if(articulo.cantidad === null || articulo.cantidad === 0 || | 632 | if(articulo.cantidad === null || articulo.cantidad === 0 || |
| 563 | articulo.cantidad === undefined) { | 633 | articulo.cantidad === undefined) { |
| 564 | focaModalService.alert('El valor debe ser al menos 1'); | 634 | focaModalService.alert('El valor debe ser al menos 1'); |
| 565 | return; | 635 | return; |
| 566 | } | 636 | } |
| 567 | articulo.editCantidad = false; | 637 | articulo.editCantidad = false; |
| 568 | articulo.editPrecio = false; | 638 | articulo.editPrecio = false; |
| 569 | } | 639 | } |
| 570 | }; | 640 | }; |
| 571 | 641 | ||
| 572 | $scope.cambioEdit = function(articulo, propiedad) { | 642 | $scope.cambioEdit = function(articulo, propiedad) { |
| 573 | if(propiedad === 'cantidad') { | 643 | if(propiedad === 'cantidad') { |
| 574 | articulo.editCantidad = true; | 644 | articulo.editCantidad = true; |
| 575 | } else if(propiedad === 'precio') { | 645 | } else if(propiedad === 'precio') { |
| 576 | articulo.editPrecio = true; | 646 | articulo.editPrecio = true; |
| 577 | } | 647 | } |
| 578 | }; | 648 | }; |
| 579 | 649 | ||
| 580 | $scope.limpiarFlete = function() { | 650 | $scope.limpiarFlete = function() { |
| 581 | $scope.remito.fleteNombre = ''; | 651 | $scope.remito.fleteNombre = ''; |
| 582 | $scope.remito.chofer = ''; | 652 | $scope.remito.chofer = ''; |
| 583 | $scope.remito.vehiculo = ''; | 653 | $scope.remito.vehiculo = ''; |
| 584 | $scope.remito.kilometros = ''; | 654 | $scope.remito.kilometros = ''; |
| 585 | $scope.remito.costoUnitarioKmFlete = ''; | 655 | $scope.remito.costoUnitarioKmFlete = ''; |
| 586 | $scope.choferes = ''; | 656 | $scope.choferes = ''; |
| 587 | $scope.vehiculos = ''; | 657 | $scope.vehiculos = ''; |
| 588 | }; | 658 | }; |
| 589 | 659 | ||
| 590 | $scope.limpiarPantalla = function() { | 660 | $scope.limpiarPantalla = function() { |
| 591 | $scope.limpiarFlete(); | 661 | $scope.limpiarFlete(); |
| 592 | $scope.remito.flete = '0'; | 662 | $scope.remito.flete = '0'; |
| 593 | $scope.remito.bomba = '0'; | 663 | $scope.remito.bomba = '0'; |
| 594 | $scope.remito.precioCondicion = ''; | 664 | $scope.remito.precioCondicion = ''; |
| 595 | $scope.articulosTabla = []; | 665 | $scope.articulosTabla = []; |
| 596 | $scope.remito.vendedor.nombre = ''; | 666 | $scope.remito.vendedor.nombre = ''; |
| 597 | $scope.remito.cliente = {nombre: ''}; | 667 | $scope.remito.cliente = {nombre: ''}; |
| 598 | $scope.remito.domicilio = {dom: ''}; | 668 | $scope.remito.domicilio = {dom: ''}; |
| 599 | $scope.domiciliosCliente = []; | 669 | $scope.domiciliosCliente = []; |
| 600 | }; | 670 | }; |
| 601 | 671 | ||
| 602 | $scope.resetFilter = function() { | 672 | $scope.resetFilter = function() { |
| 603 | $scope.articuloACargar = {}; | 673 | $scope.articuloACargar = {}; |
| 604 | $scope.cargando = true; | 674 | $scope.cargando = true; |
| 605 | }; | 675 | }; |
| 606 | 676 | ||
| 607 | $scope.selectFocus = function($event) { | 677 | $scope.selectFocus = function($event) { |
| 608 | $event.target.select(); | 678 | $event.target.select(); |
| 609 | }; | 679 | }; |
| 610 | 680 | ||
| 611 | $scope.salir = function() { | 681 | $scope.salir = function() { |
| 612 | $location.path('/'); | 682 | $location.path('/'); |
| 613 | }; | 683 | }; |
| 684 | function addArrayCabecera(array) { | ||
| 685 | for(var i = 0; i < array.length; i++) { | ||
| 686 | addCabecera(array[i].label, array[i].valor); | ||
| 687 | } | ||
| 688 | } | ||
| 614 | 689 | ||
| 615 | function addCabecera(label, valor) { | 690 | function addCabecera(label, valor) { |
| 616 | var propiedad = $filter('filter')($scope.cabecera, {label: label}, true); | 691 | var propiedad = $filter('filter')($scope.cabecera, {label: label}, true); |
| 617 | if(propiedad.length === 1) { | 692 | if(propiedad.length === 1) { |
| 618 | propiedad[0].valor = valor; | 693 | propiedad[0].valor = valor; |
| 619 | } else { | 694 | } else { |
| 620 | $scope.cabecera.push({label: label, valor: valor}); | 695 | $scope.cabecera.push({label: label, valor: valor}); |
| 621 | } | 696 | } |
| 622 | } | 697 | } |
| 623 | 698 | ||
| 624 | function removeCabecera(label) { | 699 | function removeCabecera(label) { |
| 625 | var propiedad = $filter('filter')($scope.cabecera, {label: label}, true); | 700 | var propiedad = $filter('filter')($scope.cabecera, {label: label}, true); |
| 626 | if(propiedad.length === 1) { | 701 | if(propiedad.length === 1) { |
| 627 | $scope.cabecera.splice($scope.cabecera.indexOf(propiedad[0]), 1); | 702 | $scope.cabecera.splice($scope.cabecera.indexOf(propiedad[0]), 1); |
| 628 | } | 703 | } |
| 629 | } | 704 | } |
| 630 | 705 | ||
| 631 | function rellenar(relleno, longitud) { | 706 | function rellenar(relleno, longitud) { |
| 632 | relleno = '' + relleno; | 707 | relleno = '' + relleno; |
| 633 | while (relleno.length < longitud) { | 708 | while (relleno.length < longitud) { |
| 634 | relleno = '0' + relleno; | 709 | relleno = '0' + relleno; |
| 635 | } | 710 | } |
| 636 | 711 | ||
| 637 | return relleno; | 712 | return relleno; |
| 638 | } | 713 | } |
| 639 | } | 714 | } |
| 640 | ] | 715 | ] |
| 641 | ) | 716 | ) |
| 642 | .controller('remitoListaCtrl', [ | 717 | .controller('remitoListaCtrl', [ |
| 643 | '$scope', | 718 | '$scope', |
| 644 | 'crearRemitoService', | 719 | 'crearRemitoService', |
| 645 | '$location', | 720 | '$location', |
| 646 | function($scope, crearRemitoService, $location) { | 721 | function($scope, crearRemitoService, $location) { |
| 647 | crearRemitoService.obtenerRemito().then(function(datos) { | 722 | crearRemitoService.obtenerRemito().then(function(datos) { |
| 648 | $scope.remitos = datos.data; | 723 | $scope.remitos = datos.data; |
| 649 | }); | 724 | }); |
| 650 | $scope.editar = function(remito) { | 725 | $scope.editar = function(remito) { |
| 651 | crearRemitoService.setRemito(remito); | 726 | crearRemitoService.setRemito(remito); |
| 652 | $location.path('/venta-nota-remito/abm/'); | 727 | $location.path('/venta-nota-remito/abm/'); |
| 653 | }; | 728 | }; |
| 654 | $scope.crearRemito = function() { | 729 | $scope.crearRemito = function() { |
| 655 | crearRemitoService.clearRemito(); | 730 | crearRemitoService.clearRemito(); |
| 656 | $location.path('/venta-nota-remito/abm/'); | 731 | $location.path('/venta-nota-remito/abm/'); |
| 657 | }; | 732 | }; |
| 658 | } | 733 | } |
| 659 | ]) | 734 | ]) |
| 660 | .controller('focaCrearRemitoFichaClienteController', [ | 735 | .controller('focaCrearRemitoFichaClienteController', [ |
| 661 | '$scope', | 736 | '$scope', |
| 662 | 'crearRemitoService', | 737 | 'crearRemitoService', |
| 663 | '$location', | 738 | '$location', |
| 664 | function($scope, crearRemitoService, $location) { | 739 | function($scope, crearRemitoService, $location) { |
| 665 | crearRemitoService.obtenerRemito().then(function(datos) { | 740 | crearRemitoService.obtenerRemito().then(function(datos) { |
| 666 | $scope.remitos = datos.data; | 741 | $scope.remitos = datos.data; |
| 667 | }); | 742 | }); |
| 668 | $scope.editar = function(remito) { | 743 | $scope.editar = function(remito) { |
| 669 | crearRemitoService.setRemito(remito); | 744 | crearRemitoService.setRemito(remito); |
| 670 | $location.path('/venta-nota-remito/abm/'); | 745 | $location.path('/venta-nota-remito/abm/'); |
| 671 | }; | 746 | }; |
| 672 | $scope.crearRemito = function() { | 747 | $scope.crearRemito = function() { |
| 673 | crearRemitoService.clearRemito(); | 748 | crearRemitoService.clearRemito(); |
| 674 | $location.path('/venta-nota-remito/abm/'); | 749 | $location.path('/venta-nota-remito/abm/'); |
| 675 | }; | 750 | }; |
| 676 | } | 751 | } |
| 677 | ]); | 752 | ]); |
| 678 | 753 |