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