Commit 44e9157d362b3393e138c81212b1fb080b79ce49
1 parent
275df735ff
Exists in
master
and in
1 other branch
numero remito verdadero
Showing
5 changed files
with
34 additions
and
8 deletions
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 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: 'Vendedor', accion: function() {$scope.seleccionarVendedor();}}, | 10 | {texto: 'Vendedor', accion: function() {$scope.seleccionarVendedor();}}, |
| 11 | {texto: 'Cliente', accion: function() {$scope.seleccionarCliente();}}, | 11 | {texto: 'Cliente', accion: function() {$scope.seleccionarCliente();}}, |
| 12 | {texto: 'Proveedor', accion: function() {$scope.seleccionarProveedor();}}, | 12 | {texto: 'Proveedor', accion: function() {$scope.seleccionarProveedor();}}, |
| 13 | {texto: 'Moneda', accion: function() {$scope.abrirModalMoneda();}}, | 13 | {texto: 'Moneda', accion: function() {$scope.abrirModalMoneda();}}, |
| 14 | { | 14 | { |
| 15 | texto: 'Precios y condiciones', | 15 | texto: 'Precios y condiciones', |
| 16 | accion: function() {$scope.abrirModalListaPrecio();}}, | 16 | accion: function() {$scope.abrirModalListaPrecio();}}, |
| 17 | {texto: 'Flete', accion: function() {$scope.abrirModalFlete();}}, | 17 | {texto: 'Flete', accion: function() {$scope.abrirModalFlete();}}, |
| 18 | {texto: '', accion: function() {}}, | 18 | {texto: '', accion: function() {}}, |
| 19 | {texto: '', accion: function() {}} | 19 | {texto: '', accion: function() {}} |
| 20 | ]; | 20 | ]; |
| 21 | $scope.datepickerAbierto = false; | 21 | $scope.datepickerAbierto = false; |
| 22 | 22 | ||
| 23 | $scope.show = false; | 23 | $scope.show = false; |
| 24 | $scope.cargando = true; | 24 | $scope.cargando = true; |
| 25 | $scope.dateOptions = { | 25 | $scope.dateOptions = { |
| 26 | maxDate: new Date(), | 26 | maxDate: new Date(), |
| 27 | minDate: new Date(2010, 0, 1) | 27 | minDate: new Date(2010, 0, 1) |
| 28 | }; | 28 | }; |
| 29 | 29 | ||
| 30 | $scope.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 | ); | ||
| 72 | //La pantalla solo se usa para cargar remitos | 83 | //La pantalla solo se usa para cargar remitos |
| 73 | // if (remitoTemp !== undefined) { | 84 | // if (remitoTemp !== undefined) { |
| 74 | // remitoTemp.fechaCarga = new Date(remitoTemp.fechaCarga); | 85 | // remitoTemp.fechaCarga = new Date(remitoTemp.fechaCarga); |
| 75 | // $scope.remito = remitoTemp; | 86 | // $scope.remito = remitoTemp; |
| 76 | // $scope.remito.flete = ($scope.remito.flete).toString(); | 87 | // $scope.remito.flete = ($scope.remito.flete).toString(); |
| 77 | // $scope.remito.bomba = ($scope.remito.bomba).toString(); | 88 | // $scope.remito.bomba = ($scope.remito.bomba).toString(); |
| 78 | // $scope.idLista = $scope.remito.precioCondicion; | 89 | // $scope.idLista = $scope.remito.precioCondicion; |
| 79 | // crearRemitoService | 90 | // crearRemitoService |
| 80 | // .getArticulosByIdRemito($scope.remito.id).then( | 91 | // .getArticulosByIdRemito($scope.remito.id).then( |
| 81 | // function(res) { | 92 | // function(res) { |
| 82 | // $scope.articulosTabla = res.data; | 93 | // $scope.articulosTabla = res.data; |
| 83 | // } | 94 | // } |
| 84 | // ); | 95 | // ); |
| 85 | //TODO DOMICILIOS QUE SE CARGAN AL EDITAR REMITO | 96 | //TODO DOMICILIOS QUE SE CARGAN AL EDITAR REMITO |
| 86 | //(NO REQUERIDO EN ESTA VERSION) | 97 | //(NO REQUERIDO EN ESTA VERSION) |
| 87 | // crearRemitoService.getDomiciliosByIdRemito($scope.remito.id).then( | 98 | // crearRemitoService.getDomiciliosByIdRemito($scope.remito.id).then( |
| 88 | // function(res) { | 99 | // function(res) { |
| 89 | // $scope.remito.domicilio = res.data; | 100 | // $scope.remito.domicilio = res.data; |
| 90 | // } | 101 | // } |
| 91 | // ); | 102 | // ); |
| 92 | // } else { | 103 | // } else { |
| 93 | // $scope.remito.fechaCarga = new Date(); | 104 | // $scope.remito.fechaCarga = new Date(); |
| 94 | // $scope.remito.bomba = '0'; | 105 | // $scope.remito.bomba = '0'; |
| 95 | // $scope.remito.flete = '0'; | 106 | // $scope.remito.flete = '0'; |
| 96 | // $scope.idLista = undefined; | 107 | // $scope.idLista = undefined; |
| 97 | // } | 108 | // } |
| 98 | //TO DO - FUNCIONES PARA MULTIPLES DOMICILIOS NO IMPLEMENTADAS EN ESTA DEMO | 109 | //TO DO - FUNCIONES PARA MULTIPLES DOMICILIOS NO IMPLEMENTADAS EN ESTA DEMO |
| 99 | // $scope.addNewDom = function() { | 110 | // $scope.addNewDom = function() { |
| 100 | // $scope.remito.domicilio.push({ 'id': 0 }); | 111 | // $scope.remito.domicilio.push({ 'id': 0 }); |
| 101 | // }; | 112 | // }; |
| 102 | // $scope.removeNewChoice = function(choice) { | 113 | // $scope.removeNewChoice = function(choice) { |
| 103 | // if ($scope.remito.domicilio.length > 1) { | 114 | // if ($scope.remito.domicilio.length > 1) { |
| 104 | // $scope.remito.domicilio.splice($scope.remito.domicilio.findIndex( | 115 | // $scope.remito.domicilio.splice($scope.remito.domicilio.findIndex( |
| 105 | // function(c) { | 116 | // function(c) { |
| 106 | // return c.$$hashKey === choice.$$hashKey; | 117 | // return c.$$hashKey === choice.$$hashKey; |
| 107 | // } | 118 | // } |
| 108 | // ), 1); | 119 | // ), 1); |
| 109 | // } | 120 | // } |
| 110 | // }; | 121 | // }; |
| 111 | 122 | ||
| 112 | $scope.crearRemito = function() { | 123 | $scope.crearRemito = function() { |
| 113 | if(!$scope.remito.vendedor.codigo) { | 124 | if(!$scope.remito.vendedor.codigo) { |
| 114 | focaModalService.alert('Ingrese Vendedor'); | 125 | focaModalService.alert('Ingrese Vendedor'); |
| 115 | return; | 126 | return; |
| 116 | } else if(!$scope.remito.cliente.cod) { | 127 | } else if(!$scope.remito.cliente.cod) { |
| 117 | focaModalService.alert('Ingrese Cliente'); | 128 | focaModalService.alert('Ingrese Cliente'); |
| 118 | return; | 129 | return; |
| 119 | } else if(!$scope.remito.proveedor.codigo) { | 130 | } else if(!$scope.remito.proveedor.codigo) { |
| 120 | focaModalService.alert('Ingrese Proveedor'); | 131 | focaModalService.alert('Ingrese Proveedor'); |
| 121 | return; | 132 | return; |
| 122 | } else if(!$scope.remito.moneda.id) { | 133 | } else if(!$scope.remito.moneda.id) { |
| 123 | focaModalService.alert('Ingrese Moneda'); | 134 | focaModalService.alert('Ingrese Moneda'); |
| 124 | return; | 135 | return; |
| 125 | } else if(!$scope.remito.cotizacion.ID) { | 136 | } else if(!$scope.remito.cotizacion.ID) { |
| 126 | focaModalService.alert('Ingrese Cotización'); | 137 | focaModalService.alert('Ingrese Cotización'); |
| 127 | return; | 138 | return; |
| 128 | } else if(!$scope.plazosPagos) { | 139 | } else if(!$scope.plazosPagos) { |
| 129 | focaModalService.alert('Ingrese Precios y Condiciones'); | 140 | focaModalService.alert('Ingrese Precios y Condiciones'); |
| 130 | return; | 141 | return; |
| 131 | } else if( | 142 | } else if( |
| 132 | $scope.remito.flete === undefined || $scope.remito.flete === null) | 143 | $scope.remito.flete === undefined || $scope.remito.flete === null) |
| 133 | { | 144 | { |
| 134 | focaModalService.alert('Ingrese Flete'); | 145 | focaModalService.alert('Ingrese Flete'); |
| 135 | return; | 146 | return; |
| 136 | } else if(!$scope.remito.domicilio.id) { | 147 | } else if(!$scope.remito.domicilio.id) { |
| 137 | focaModalService.alert('Ingrese Domicilio'); | 148 | focaModalService.alert('Ingrese Domicilio'); |
| 138 | return; | 149 | return; |
| 139 | } else if($scope.articulosTabla.length === 0) { | 150 | } else if($scope.articulosTabla.length === 0) { |
| 140 | focaModalService.alert('Debe cargar al menos un articulo'); | 151 | focaModalService.alert('Debe cargar al menos un articulo'); |
| 141 | return; | 152 | return; |
| 142 | } | 153 | } |
| 143 | var date = new Date(); | 154 | var date = new Date(); |
| 144 | var remito = { | 155 | var remito = { |
| 145 | id: 0, | 156 | id: 0, |
| 146 | fechaCarga: new Date(date.getTime() - (date.getTimezoneOffset() * 60000)) | 157 | fechaCarga: new Date(date.getTime() - (date.getTimezoneOffset() * 60000)) |
| 147 | .toISOString().slice(0, 19).replace('T', ' '), | 158 | .toISOString().slice(0, 19).replace('T', ' '), |
| 148 | idVendedor: $scope.remito.vendedor.codigo, | 159 | idVendedor: $scope.remito.vendedor.codigo, |
| 149 | idCliente: $scope.remito.cliente.cod, | 160 | idCliente: $scope.remito.cliente.cod, |
| 150 | nombreCliente: $scope.remito.cliente.nom, | 161 | nombreCliente: $scope.remito.cliente.nom, |
| 151 | cuitCliente: $scope.remito.cliente.cuit, | 162 | cuitCliente: $scope.remito.cliente.cuit, |
| 152 | idProveedor: $scope.remito.proveedor.codigo, | 163 | idProveedor: $scope.remito.proveedor.codigo, |
| 153 | idDomicilio: $scope.remito.domicilio.id, | 164 | idDomicilio: $scope.remito.domicilio.id, |
| 154 | idCotizacion: $scope.remito.cotizacion.ID, | 165 | idCotizacion: $scope.remito.cotizacion.ID, |
| 155 | cotizacion: $scope.remito.cotizacion.COTIZACION, | 166 | cotizacion: $scope.remito.cotizacion.COTIZACION, |
| 156 | flete: $scope.remito.flete, | 167 | flete: $scope.remito.flete, |
| 157 | fob: $scope.remito.fob, | 168 | fob: $scope.remito.fob, |
| 158 | bomba: $scope.remito.bomba, | 169 | bomba: $scope.remito.bomba, |
| 159 | kilometros: $scope.remito.kilometros, | 170 | kilometros: $scope.remito.kilometros, |
| 160 | estado: 0, | 171 | estado: 0, |
| 161 | total: $scope.getTotal() | 172 | total: $scope.getTotal() |
| 162 | }; | 173 | }; |
| 163 | crearRemitoService.crearRemito(remito).then( | 174 | crearRemitoService.crearRemito(remito).then( |
| 164 | function(data) { | 175 | function(data) { |
| 165 | remitoBusinessService.addArticulos($scope.articulosTabla, | 176 | remitoBusinessService.addArticulos($scope.articulosTabla, |
| 166 | data.data.id, $scope.remito.cotizacion.COTIZACION); | 177 | data.data.id, $scope.remito.cotizacion.COTIZACION); |
| 167 | focaSeguimientoService.guardarPosicion('crear nota remito', ''); | ||
| 168 | var plazos = $scope.plazosPagos; | 178 | var plazos = $scope.plazosPagos; |
| 169 | for(var j = 0; j < plazos.length; j++) { | 179 | for(var j = 0; j < plazos.length; j++) { |
| 170 | var json = { | 180 | var json = { |
| 171 | idRemito: data.data.id, | 181 | idRemito: data.data.id, |
| 172 | dias: plazos[j].dias | 182 | dias: plazos[j].dias |
| 173 | }; | 183 | }; |
| 174 | crearRemitoService.crearPlazosParaRemito(json); | 184 | crearRemitoService.crearPlazosParaRemito(json); |
| 175 | } | 185 | } |
| 176 | remitoBusinessService.addEstado(data.data.id, | 186 | remitoBusinessService.addEstado(data.data.id, |
| 177 | $scope.remito.vendedor.codigo); | 187 | $scope.remito.vendedor.codigo); |
| 178 | 188 | ||
| 179 | focaModalService.alert('Nota remito creada'); | 189 | focaModalService.alert('Nota remito creada'); |
| 180 | $scope.cabecera = []; | 190 | $scope.cabecera = []; |
| 181 | addCabecera('Moneda:', $scope.remito.moneda.detalle); | 191 | addCabecera('Moneda:', $scope.remito.moneda.detalle); |
| 182 | addCabecera( | 192 | addCabecera( |
| 183 | 'Fecha cotizacion:', | 193 | 'Fecha cotizacion:', |
| 184 | $filter('date')($scope.remito.cotizacion.FECHA, 'dd/MM/yyyy') | 194 | $filter('date')($scope.remito.cotizacion.FECHA, 'dd/MM/yyyy') |
| 185 | ); | 195 | ); |
| 186 | addCabecera('Cotizacion:', $scope.remito.cotizacion.COTIZACION); | 196 | addCabecera('Cotizacion:', $scope.remito.cotizacion.COTIZACION); |
| 187 | $scope.remito.vendedor = {}; | 197 | $scope.remito.vendedor = {}; |
| 188 | $scope.remito.cliente = {}; | 198 | $scope.remito.cliente = {}; |
| 189 | $scope.remito.proveedor = {}; | 199 | $scope.remito.proveedor = {}; |
| 190 | $scope.remito.domicilio = {}; | 200 | $scope.remito.domicilio = {}; |
| 191 | $scope.remito.flete = null; | 201 | $scope.remito.flete = null; |
| 192 | $scope.remito.fob = null; | 202 | $scope.remito.fob = null; |
| 193 | $scope.remito.bomba = null; | 203 | $scope.remito.bomba = null; |
| 194 | $scope.remito.kilometros = null; | 204 | $scope.remito.kilometros = null; |
| 195 | $scope.articulosTabla = []; | 205 | $scope.articulosTabla = []; |
| 196 | } | 206 | } |
| 197 | ); | 207 | ); |
| 198 | }; | 208 | }; |
| 199 | 209 | ||
| 200 | $scope.seleccionarArticulo = function() { | 210 | $scope.seleccionarArticulo = function() { |
| 201 | if ($scope.idLista === undefined) { | 211 | if ($scope.idLista === undefined) { |
| 202 | focaModalService.alert( | 212 | focaModalService.alert( |
| 203 | 'Primero seleccione una lista de precio y condicion'); | 213 | 'Primero seleccione una lista de precio y condicion'); |
| 204 | return; | 214 | return; |
| 205 | } | 215 | } |
| 206 | var modalInstance = $uibModal.open( | 216 | var modalInstance = $uibModal.open( |
| 207 | { | 217 | { |
| 208 | ariaLabelledBy: 'Busqueda de Productos', | 218 | ariaLabelledBy: 'Busqueda de Productos', |
| 209 | templateUrl: 'modal-busqueda-productos.html', | 219 | templateUrl: 'modal-busqueda-productos.html', |
| 210 | controller: 'modalBusquedaProductosCtrl', | 220 | controller: 'modalBusquedaProductosCtrl', |
| 211 | resolve: { | 221 | resolve: { |
| 212 | parametroProducto: { | 222 | parametroProducto: { |
| 213 | idLista: $scope.idLista, | 223 | idLista: $scope.idLista, |
| 214 | cotizacion: $scope.remito.cotizacion.COTIZACION, | 224 | cotizacion: $scope.remito.cotizacion.COTIZACION, |
| 215 | simbolo: $scope.remito.moneda.simbolo | 225 | simbolo: $scope.remito.moneda.simbolo |
| 216 | } | 226 | } |
| 217 | }, | 227 | }, |
| 218 | size: 'lg' | 228 | size: 'lg' |
| 219 | } | 229 | } |
| 220 | ); | 230 | ); |
| 221 | modalInstance.result.then( | 231 | modalInstance.result.then( |
| 222 | function(producto) { | 232 | function(producto) { |
| 223 | var newArt = | 233 | var newArt = |
| 224 | { | 234 | { |
| 225 | id: 0, | 235 | id: 0, |
| 226 | codigo: producto.codigo, | 236 | codigo: producto.codigo, |
| 227 | sector: producto.sector, | 237 | sector: producto.sector, |
| 228 | sectorCodigo: producto.sector + '-' + producto.codigo, | 238 | sectorCodigo: producto.sector + '-' + producto.codigo, |
| 229 | descripcion: producto.descripcion, | 239 | descripcion: producto.descripcion, |
| 230 | item: $scope.articulosTabla.length + 1, | 240 | item: $scope.articulosTabla.length + 1, |
| 231 | nombre: producto.descripcion, | 241 | nombre: producto.descripcion, |
| 232 | precio: parseFloat(producto.precio.toFixed(4)), | 242 | precio: parseFloat(producto.precio.toFixed(4)), |
| 233 | costoUnitario: producto.costo, | 243 | costoUnitario: producto.costo, |
| 234 | editCantidad: false, | 244 | editCantidad: false, |
| 235 | editPrecio: false | 245 | editPrecio: false |
| 236 | }; | 246 | }; |
| 237 | $scope.articuloACargar = newArt; | 247 | $scope.articuloACargar = newArt; |
| 238 | $scope.cargando = false; | 248 | $scope.cargando = false; |
| 239 | }, function() { | 249 | }, function() { |
| 240 | // funcion ejecutada cuando se cancela el modal | 250 | // funcion ejecutada cuando se cancela el modal |
| 241 | } | 251 | } |
| 242 | ); | 252 | ); |
| 243 | }; | 253 | }; |
| 244 | 254 | ||
| 245 | $scope.seleccionarVendedor = function() { | 255 | $scope.seleccionarVendedor = function() { |
| 246 | var modalInstance = $uibModal.open( | 256 | var modalInstance = $uibModal.open( |
| 247 | { | 257 | { |
| 248 | ariaLabelledBy: 'Busqueda de Vendedores', | 258 | ariaLabelledBy: 'Busqueda de Vendedores', |
| 249 | templateUrl: 'modal-vendedores.html', | 259 | templateUrl: 'modal-vendedores.html', |
| 250 | controller: 'modalVendedoresCtrl', | 260 | controller: 'modalVendedoresCtrl', |
| 251 | size: 'lg' | 261 | size: 'lg' |
| 252 | } | 262 | } |
| 253 | ); | 263 | ); |
| 254 | modalInstance.result.then( | 264 | modalInstance.result.then( |
| 255 | function(vendedor) { | 265 | function(vendedor) { |
| 256 | addCabecera('Vendedor:', vendedor.NomVen); | 266 | addCabecera('Vendedor:', vendedor.NomVen); |
| 257 | $scope.remito.vendedor.codigo = vendedor.CodVen; | 267 | $scope.remito.vendedor.codigo = vendedor.CodVen; |
| 258 | }, function() { | 268 | }, function() { |
| 259 | 269 | ||
| 260 | } | 270 | } |
| 261 | ); | 271 | ); |
| 262 | }; | 272 | }; |
| 263 | 273 | ||
| 264 | $scope.seleccionarProveedor = function() { | 274 | $scope.seleccionarProveedor = function() { |
| 265 | var modalInstance = $uibModal.open( | 275 | var modalInstance = $uibModal.open( |
| 266 | { | 276 | { |
| 267 | ariaLabelledBy: 'Busqueda de Proveedor', | 277 | ariaLabelledBy: 'Busqueda de Proveedor', |
| 268 | templateUrl: 'modal-proveedor.html', | 278 | templateUrl: 'modal-proveedor.html', |
| 269 | controller: 'focaModalProveedorCtrl', | 279 | controller: 'focaModalProveedorCtrl', |
| 270 | size: 'lg' | 280 | size: 'lg' |
| 271 | } | 281 | } |
| 272 | ); | 282 | ); |
| 273 | modalInstance.result.then( | 283 | modalInstance.result.then( |
| 274 | function(proveedor) { | 284 | function(proveedor) { |
| 275 | $scope.remito.proveedor.codigo = proveedor.COD; | 285 | $scope.remito.proveedor.codigo = proveedor.COD; |
| 276 | addCabecera('Proveedor:', proveedor.NOM); | 286 | addCabecera('Proveedor:', proveedor.NOM); |
| 277 | }, function() { | 287 | }, function() { |
| 278 | 288 | ||
| 279 | } | 289 | } |
| 280 | ); | 290 | ); |
| 281 | }; | 291 | }; |
| 282 | 292 | ||
| 283 | $scope.seleccionarCliente = function() { | 293 | $scope.seleccionarCliente = function() { |
| 284 | 294 | ||
| 285 | var modalInstance = $uibModal.open( | 295 | var modalInstance = $uibModal.open( |
| 286 | { | 296 | { |
| 287 | ariaLabelledBy: 'Busqueda de Cliente', | 297 | ariaLabelledBy: 'Busqueda de Cliente', |
| 288 | templateUrl: 'foca-busqueda-cliente-modal.html', | 298 | templateUrl: 'foca-busqueda-cliente-modal.html', |
| 289 | controller: 'focaBusquedaClienteModalController', | 299 | controller: 'focaBusquedaClienteModalController', |
| 290 | size: 'lg' | 300 | size: 'lg' |
| 291 | } | 301 | } |
| 292 | ); | 302 | ); |
| 293 | modalInstance.result.then( | 303 | modalInstance.result.then( |
| 294 | function(cliente) { | 304 | function(cliente) { |
| 295 | $scope.abrirModalDomicilios(cliente); | 305 | $scope.abrirModalDomicilios(cliente); |
| 296 | }, function() { | 306 | }, function() { |
| 297 | 307 | ||
| 298 | } | 308 | } |
| 299 | ); | 309 | ); |
| 300 | }; | 310 | }; |
| 301 | 311 | ||
| 302 | $scope.abrirModalDomicilios = function(cliente) { | 312 | $scope.abrirModalDomicilios = function(cliente) { |
| 303 | var modalInstanceDomicilio = $uibModal.open( | 313 | var modalInstanceDomicilio = $uibModal.open( |
| 304 | { | 314 | { |
| 305 | ariaLabelledBy: 'Busqueda de Domicilios', | 315 | ariaLabelledBy: 'Busqueda de Domicilios', |
| 306 | templateUrl: 'modal-domicilio.html', | 316 | templateUrl: 'modal-domicilio.html', |
| 307 | controller: 'focaModalDomicilioController', | 317 | controller: 'focaModalDomicilioController', |
| 308 | resolve: { idCliente: function() { return cliente.cod; }}, | 318 | resolve: { idCliente: function() { return cliente.cod; }}, |
| 309 | size: 'lg', | 319 | size: 'lg', |
| 310 | } | 320 | } |
| 311 | ); | 321 | ); |
| 312 | modalInstanceDomicilio.result.then( | 322 | modalInstanceDomicilio.result.then( |
| 313 | function(domicilio) { | 323 | function(domicilio) { |
| 314 | $scope.remito.domicilio.id = domicilio.nivel2; | 324 | $scope.remito.domicilio.id = domicilio.nivel2; |
| 315 | $scope.remito.cliente = cliente; | 325 | $scope.remito.cliente = cliente; |
| 316 | 326 | ||
| 317 | addCabecera('Cliente:', cliente.nom); | 327 | addCabecera('Cliente:', cliente.nom); |
| 318 | addCabecera('Domicilio:', domicilio.dom); | 328 | addCabecera('Domicilio:', domicilio.dom); |
| 319 | }, function() { | 329 | }, function() { |
| 320 | $scope.seleccionarCliente(); | 330 | $scope.seleccionarCliente(); |
| 321 | return; | 331 | return; |
| 322 | } | 332 | } |
| 323 | ); | 333 | ); |
| 324 | }; | 334 | }; |
| 325 | 335 | ||
| 326 | $scope.mostrarFichaCliente = function() { | 336 | $scope.mostrarFichaCliente = function() { |
| 327 | $uibModal.open( | 337 | $uibModal.open( |
| 328 | { | 338 | { |
| 329 | ariaLabelledBy: 'Datos del Cliente', | 339 | ariaLabelledBy: 'Datos del Cliente', |
| 330 | templateUrl: 'foca-crear-remito-ficha-cliente.html', | 340 | templateUrl: 'foca-crear-remito-ficha-cliente.html', |
| 331 | controller: 'focaCrearRemitoFichaClienteController', | 341 | controller: 'focaCrearRemitoFichaClienteController', |
| 332 | size: 'lg' | 342 | size: 'lg' |
| 333 | } | 343 | } |
| 334 | ); | 344 | ); |
| 335 | }; | 345 | }; |
| 336 | 346 | ||
| 337 | $scope.getTotal = function() { | 347 | $scope.getTotal = function() { |
| 338 | var total = 0; | 348 | var total = 0; |
| 339 | var arrayTempArticulos = $scope.articulosTabla; | 349 | var arrayTempArticulos = $scope.articulosTabla; |
| 340 | for (var i = 0; i < arrayTempArticulos.length; i++) { | 350 | for (var i = 0; i < arrayTempArticulos.length; i++) { |
| 341 | total += arrayTempArticulos[i].precio * arrayTempArticulos[i].cantidad; | 351 | total += arrayTempArticulos[i].precio * arrayTempArticulos[i].cantidad; |
| 342 | } | 352 | } |
| 343 | return parseFloat(total.toFixed(2)); | 353 | return parseFloat(total.toFixed(2)); |
| 344 | }; | 354 | }; |
| 345 | 355 | ||
| 346 | $scope.getSubTotal = function() { | 356 | $scope.getSubTotal = function() { |
| 347 | if($scope.articuloACargar) { | 357 | if($scope.articuloACargar) { |
| 348 | return $scope.articuloACargar.precio * $scope.articuloACargar.cantidad; | 358 | return $scope.articuloACargar.precio * $scope.articuloACargar.cantidad; |
| 349 | } | 359 | } |
| 350 | }; | 360 | }; |
| 351 | 361 | ||
| 352 | $scope.abrirModalListaPrecio = function() { | 362 | $scope.abrirModalListaPrecio = function() { |
| 353 | var modalInstance = $uibModal.open( | 363 | var modalInstance = $uibModal.open( |
| 354 | { | 364 | { |
| 355 | ariaLabelledBy: 'Busqueda de Precio Condición', | 365 | ariaLabelledBy: 'Busqueda de Precio Condición', |
| 356 | templateUrl: 'modal-precio-condicion.html', | 366 | templateUrl: 'modal-precio-condicion.html', |
| 357 | controller: 'focaModalPrecioCondicionController', | 367 | controller: 'focaModalPrecioCondicionController', |
| 358 | size: 'lg' | 368 | size: 'lg' |
| 359 | } | 369 | } |
| 360 | ); | 370 | ); |
| 361 | modalInstance.result.then( | 371 | modalInstance.result.then( |
| 362 | function(precioCondicion) { | 372 | function(precioCondicion) { |
| 363 | var cabecera = ''; | 373 | var cabecera = ''; |
| 364 | var plazosConcat = ''; | 374 | var plazosConcat = ''; |
| 365 | if(!Array.isArray(precioCondicion)) { | 375 | if(!Array.isArray(precioCondicion)) { |
| 366 | $scope.plazosPagos = precioCondicion.plazoPago; | 376 | $scope.plazosPagos = precioCondicion.plazoPago; |
| 367 | $scope.idLista = precioCondicion.idListaPrecio; | 377 | $scope.idLista = precioCondicion.idListaPrecio; |
| 368 | for(var i = 0; i < precioCondicion.plazoPago.length; i++) { | 378 | for(var i = 0; i < precioCondicion.plazoPago.length; i++) { |
| 369 | plazosConcat += precioCondicion.plazoPago[i].dias + ' '; | 379 | plazosConcat += precioCondicion.plazoPago[i].dias + ' '; |
| 370 | } | 380 | } |
| 371 | cabecera = precioCondicion.nombre + ' ' + plazosConcat.trim(); | 381 | cabecera = precioCondicion.nombre + ' ' + plazosConcat.trim(); |
| 372 | } else { //Cuando se ingresan los plazos manualmente | 382 | } else { //Cuando se ingresan los plazos manualmente |
| 373 | $scope.idLista = -1; //-1, el modal productos busca todos los productos | 383 | $scope.idLista = -1; //-1, el modal productos busca todos los productos |
| 374 | $scope.plazosPagos = precioCondicion; | 384 | $scope.plazosPagos = precioCondicion; |
| 375 | for(var j = 0; j < precioCondicion.length; j++) { | 385 | for(var j = 0; j < precioCondicion.length; j++) { |
| 376 | plazosConcat += precioCondicion[j].dias + ' '; | 386 | plazosConcat += precioCondicion[j].dias + ' '; |
| 377 | } | 387 | } |
| 378 | cabecera = 'Ingreso manual ' + plazosConcat.trim(); | 388 | cabecera = 'Ingreso manual ' + plazosConcat.trim(); |
| 379 | } | 389 | } |
| 380 | $scope.articulosTabla = []; | 390 | $scope.articulosTabla = []; |
| 381 | addCabecera('Precios y condiciones:', cabecera); | 391 | addCabecera('Precios y condiciones:', cabecera); |
| 382 | }, function() { | 392 | }, function() { |
| 383 | 393 | ||
| 384 | } | 394 | } |
| 385 | ); | 395 | ); |
| 386 | }; | 396 | }; |
| 387 | 397 | ||
| 388 | $scope.abrirModalFlete = function() { | 398 | $scope.abrirModalFlete = function() { |
| 389 | var modalInstance = $uibModal.open( | 399 | var modalInstance = $uibModal.open( |
| 390 | { | 400 | { |
| 391 | ariaLabelledBy: 'Busqueda de Flete', | 401 | ariaLabelledBy: 'Busqueda de Flete', |
| 392 | templateUrl: 'modal-flete.html', | 402 | templateUrl: 'modal-flete.html', |
| 393 | controller: 'focaModalFleteController', | 403 | controller: 'focaModalFleteController', |
| 394 | size: 'lg', | 404 | size: 'lg', |
| 395 | resolve: { | 405 | resolve: { |
| 396 | parametrosFlete: | 406 | parametrosFlete: |
| 397 | function() { | 407 | function() { |
| 398 | return { | 408 | return { |
| 399 | flete: $scope.remito.flete ? '1' : | 409 | flete: $scope.remito.flete ? '1' : |
| 400 | ($scope.remito.fob ? 'FOB' : | 410 | ($scope.remito.fob ? 'FOB' : |
| 401 | ($scope.remito.flete === undefined ? null : '0')), | 411 | ($scope.remito.flete === undefined ? null : '0')), |
| 402 | bomba: $scope.remito.bomba ? '1' : | 412 | bomba: $scope.remito.bomba ? '1' : |
| 403 | ($scope.remito.bomba === undefined ? null : '0'), | 413 | ($scope.remito.bomba === undefined ? null : '0'), |
| 404 | kilometros: $scope.remito.kilometros | 414 | kilometros: $scope.remito.kilometros |
| 405 | }; | 415 | }; |
| 406 | } | 416 | } |
| 407 | } | 417 | } |
| 408 | } | 418 | } |
| 409 | ); | 419 | ); |
| 410 | modalInstance.result.then( | 420 | modalInstance.result.then( |
| 411 | function(datos) { | 421 | function(datos) { |
| 412 | $scope.remito.flete = datos.flete; | 422 | $scope.remito.flete = datos.flete; |
| 413 | $scope.remito.fob = datos.FOB; | 423 | $scope.remito.fob = datos.FOB; |
| 414 | $scope.remito.bomba = datos.bomba; | 424 | $scope.remito.bomba = datos.bomba; |
| 415 | $scope.remito.kilometros = datos.kilometros; | 425 | $scope.remito.kilometros = datos.kilometros; |
| 416 | 426 | ||
| 417 | addCabecera('Flete:', datos.flete ? 'Si' : | 427 | addCabecera('Flete:', datos.flete ? 'Si' : |
| 418 | ($scope.remito.fob ? 'FOB' : 'No')); | 428 | ($scope.remito.fob ? 'FOB' : 'No')); |
| 419 | if(datos.flete) { | 429 | if(datos.flete) { |
| 420 | addCabecera('Bomba:', datos.bomba ? 'Si' : 'No'); | 430 | addCabecera('Bomba:', datos.bomba ? 'Si' : 'No'); |
| 421 | addCabecera('Kilometros:', datos.kilometros); | 431 | addCabecera('Kilometros:', datos.kilometros); |
| 422 | } else { | 432 | } else { |
| 423 | removeCabecera('Bomba:'); | 433 | removeCabecera('Bomba:'); |
| 424 | removeCabecera('Kilometros:'); | 434 | removeCabecera('Kilometros:'); |
| 425 | $scope.remito.fob = false; | 435 | $scope.remito.fob = false; |
| 426 | $scope.remito.bomba = false; | 436 | $scope.remito.bomba = false; |
| 427 | $scope.remito.kilometros = null; | 437 | $scope.remito.kilometros = null; |
| 428 | } | 438 | } |
| 429 | }, function() { | 439 | }, function() { |
| 430 | 440 | ||
| 431 | } | 441 | } |
| 432 | ); | 442 | ); |
| 433 | }; | 443 | }; |
| 434 | 444 | ||
| 435 | $scope.abrirModalMoneda = function() { | 445 | $scope.abrirModalMoneda = function() { |
| 436 | var modalInstance = $uibModal.open( | 446 | var modalInstance = $uibModal.open( |
| 437 | { | 447 | { |
| 438 | ariaLabelledBy: 'Busqueda de Moneda', | 448 | ariaLabelledBy: 'Busqueda de Moneda', |
| 439 | templateUrl: 'modal-moneda.html', | 449 | templateUrl: 'modal-moneda.html', |
| 440 | controller: 'focaModalMonedaController', | 450 | controller: 'focaModalMonedaController', |
| 441 | size: 'lg' | 451 | size: 'lg' |
| 442 | } | 452 | } |
| 443 | ); | 453 | ); |
| 444 | modalInstance.result.then( | 454 | modalInstance.result.then( |
| 445 | function(moneda) { | 455 | function(moneda) { |
| 446 | $scope.abrirModalCotizacion(moneda); | 456 | $scope.abrirModalCotizacion(moneda); |
| 447 | }, function() { | 457 | }, function() { |
| 448 | 458 | ||
| 449 | } | 459 | } |
| 450 | ); | 460 | ); |
| 451 | }; | 461 | }; |
| 452 | 462 | ||
| 453 | $scope.abrirModalCotizacion = function(moneda) { | 463 | $scope.abrirModalCotizacion = function(moneda) { |
| 454 | var modalInstance = $uibModal.open( | 464 | var modalInstance = $uibModal.open( |
| 455 | { | 465 | { |
| 456 | ariaLabelledBy: 'Busqueda de Cotización', | 466 | ariaLabelledBy: 'Busqueda de Cotización', |
| 457 | templateUrl: 'modal-cotizacion.html', | 467 | templateUrl: 'modal-cotizacion.html', |
| 458 | controller: 'focaModalCotizacionController', | 468 | controller: 'focaModalCotizacionController', |
| 459 | size: 'lg', | 469 | size: 'lg', |
| 460 | resolve: {idMoneda: function() {return moneda.ID;}} | 470 | resolve: {idMoneda: function() {return moneda.ID;}} |
| 461 | } | 471 | } |
| 462 | ); | 472 | ); |
| 463 | modalInstance.result.then( | 473 | modalInstance.result.then( |
| 464 | function(cotizacion) { | 474 | function(cotizacion) { |
| 465 | var articulosTablaTemp = $scope.articulosTabla; | 475 | var articulosTablaTemp = $scope.articulosTabla; |
| 466 | for(var i = 0; i < articulosTablaTemp.length; i++) { | 476 | for(var i = 0; i < articulosTablaTemp.length; i++) { |
| 467 | articulosTablaTemp[i].precio = articulosTablaTemp[i].precio * | 477 | articulosTablaTemp[i].precio = articulosTablaTemp[i].precio * |
| 468 | $scope.remito.cotizacion.COTIZACION; | 478 | $scope.remito.cotizacion.COTIZACION; |
| 469 | articulosTablaTemp[i].precio = articulosTablaTemp[i].precio / | 479 | articulosTablaTemp[i].precio = articulosTablaTemp[i].precio / |
| 470 | cotizacion.COTIZACION; | 480 | cotizacion.COTIZACION; |
| 471 | } | 481 | } |
| 472 | $scope.articulosTabla = articulosTablaTemp; | 482 | $scope.articulosTabla = articulosTablaTemp; |
| 473 | $scope.remito.moneda = { | 483 | $scope.remito.moneda = { |
| 474 | id: moneda.ID, | 484 | id: moneda.ID, |
| 475 | detalle: moneda.DETALLE, | 485 | detalle: moneda.DETALLE, |
| 476 | simbolo: moneda.SIMBOLO | 486 | simbolo: moneda.SIMBOLO |
| 477 | }; | 487 | }; |
| 478 | $scope.remito.cotizacion = { | 488 | $scope.remito.cotizacion = { |
| 479 | ID: cotizacion.ID, | 489 | ID: cotizacion.ID, |
| 480 | COTIZACION: cotizacion.COTIZACION, | 490 | COTIZACION: cotizacion.COTIZACION, |
| 481 | FECHA: cotizacion.FECHA | 491 | FECHA: cotizacion.FECHA |
| 482 | }; | 492 | }; |
| 483 | addCabecera('Moneda:', moneda.DETALLE); | 493 | addCabecera('Moneda:', moneda.DETALLE); |
| 484 | addCabecera( | 494 | addCabecera( |
| 485 | 'Fecha cotizacion:', | 495 | 'Fecha cotizacion:', |
| 486 | $filter('date')(cotizacion.FECHA, 'dd/MM/yyyy') | 496 | $filter('date')(cotizacion.FECHA, 'dd/MM/yyyy') |
| 487 | ); | 497 | ); |
| 488 | addCabecera('Cotizacion:', cotizacion.COTIZACION); | 498 | addCabecera('Cotizacion:', cotizacion.COTIZACION); |
| 489 | }, function() { | 499 | }, function() { |
| 490 | 500 | ||
| 491 | } | 501 | } |
| 492 | ); | 502 | ); |
| 493 | }; | 503 | }; |
| 494 | 504 | ||
| 495 | $scope.agregarATabla = function(key) { | 505 | $scope.agregarATabla = function(key) { |
| 496 | if(key === 13) { | 506 | if(key === 13) { |
| 497 | if($scope.articuloACargar.cantidad === undefined || | 507 | if($scope.articuloACargar.cantidad === undefined || |
| 498 | $scope.articuloACargar.cantidad === 0 || | 508 | $scope.articuloACargar.cantidad === 0 || |
| 499 | $scope.articuloACargar.cantidad === null ){ | 509 | $scope.articuloACargar.cantidad === null ){ |
| 500 | focaModalService.alert('El valor debe ser al menos 1'); | 510 | focaModalService.alert('El valor debe ser al menos 1'); |
| 501 | return; | 511 | return; |
| 502 | } | 512 | } |
| 503 | delete $scope.articuloACargar.sectorCodigo; | 513 | delete $scope.articuloACargar.sectorCodigo; |
| 504 | $scope.articulosTabla.push($scope.articuloACargar); | 514 | $scope.articulosTabla.push($scope.articuloACargar); |
| 505 | $scope.cargando = true; | 515 | $scope.cargando = true; |
| 506 | } | 516 | } |
| 507 | }; | 517 | }; |
| 508 | 518 | ||
| 509 | $scope.quitarArticulo = function(key) { | 519 | $scope.quitarArticulo = function(key) { |
| 510 | $scope.articulosTabla.splice(key, 1); | 520 | $scope.articulosTabla.splice(key, 1); |
| 511 | }; | 521 | }; |
| 512 | 522 | ||
| 513 | $scope.editarArticulo = function(key, articulo) { | 523 | $scope.editarArticulo = function(key, articulo) { |
| 514 | if(key === 13) { | 524 | if(key === 13) { |
| 515 | if(articulo.cantidad === null || articulo.cantidad === 0 || | 525 | if(articulo.cantidad === null || articulo.cantidad === 0 || |
| 516 | articulo.cantidad === undefined){ | 526 | articulo.cantidad === undefined){ |
| 517 | focaModalService.alert('El valor debe ser al menos 1'); | 527 | focaModalService.alert('El valor debe ser al menos 1'); |
| 518 | return; | 528 | return; |
| 519 | } | 529 | } |
| 520 | articulo.editCantidad = false; | 530 | articulo.editCantidad = false; |
| 521 | articulo.editPrecio = false; | 531 | articulo.editPrecio = false; |
| 522 | } | 532 | } |
| 523 | }; | 533 | }; |
| 524 | 534 | ||
| 525 | $scope.cambioEdit = function(articulo, propiedad) { | 535 | $scope.cambioEdit = function(articulo, propiedad) { |
| 526 | if(propiedad === 'cantidad') { | 536 | if(propiedad === 'cantidad') { |
| 527 | articulo.editCantidad = true; | 537 | articulo.editCantidad = true; |
| 528 | } else if(propiedad === 'precio') { | 538 | } else if(propiedad === 'precio') { |
| 529 | articulo.editPrecio = true; | 539 | articulo.editPrecio = true; |
| 530 | } | 540 | } |
| 531 | }; | 541 | }; |
| 532 | 542 | ||
| 533 | $scope.limpiarFlete = function() { | 543 | $scope.limpiarFlete = function() { |
| 534 | $scope.remito.fleteNombre = ''; | 544 | $scope.remito.fleteNombre = ''; |
| 535 | $scope.remito.chofer = ''; | 545 | $scope.remito.chofer = ''; |
| 536 | $scope.remito.vehiculo = ''; | 546 | $scope.remito.vehiculo = ''; |
| 537 | $scope.remito.kilometros = ''; | 547 | $scope.remito.kilometros = ''; |
| 538 | $scope.remito.costoUnitarioKmFlete = ''; | 548 | $scope.remito.costoUnitarioKmFlete = ''; |
| 539 | $scope.choferes = ''; | 549 | $scope.choferes = ''; |
| 540 | $scope.vehiculos = ''; | 550 | $scope.vehiculos = ''; |
| 541 | }; | 551 | }; |
| 542 | 552 | ||
| 543 | $scope.limpiarPantalla = function() { | 553 | $scope.limpiarPantalla = function() { |
| 544 | $scope.limpiarFlete(); | 554 | $scope.limpiarFlete(); |
| 545 | $scope.remito.flete = '0'; | 555 | $scope.remito.flete = '0'; |
| 546 | $scope.remito.bomba = '0'; | 556 | $scope.remito.bomba = '0'; |
| 547 | $scope.remito.precioCondicion = ''; | 557 | $scope.remito.precioCondicion = ''; |
| 548 | $scope.articulosTabla = []; | 558 | $scope.articulosTabla = []; |
| 549 | $scope.remito.vendedor.nombre = ''; | 559 | $scope.remito.vendedor.nombre = ''; |
| 550 | $scope.remito.cliente = {nombre: ''}; | 560 | $scope.remito.cliente = {nombre: ''}; |
| 551 | $scope.remito.domicilio = {dom: ''}; | 561 | $scope.remito.domicilio = {dom: ''}; |
| 552 | $scope.domiciliosCliente = []; | 562 | $scope.domiciliosCliente = []; |
| 553 | }; | 563 | }; |
| 554 | 564 | ||
| 555 | $scope.resetFilter = function() { | 565 | $scope.resetFilter = function() { |
| 556 | $scope.articuloACargar = {}; | 566 | $scope.articuloACargar = {}; |
| 557 | $scope.cargando = true; | 567 | $scope.cargando = true; |
| 558 | }; | 568 | }; |
| 559 | 569 | ||
| 560 | $scope.selectFocus = function($event) { | 570 | $scope.selectFocus = function($event) { |
| 561 | $event.target.select(); | 571 | $event.target.select(); |
| 562 | }; | 572 | }; |
| 563 | 573 | ||
| 564 | $scope.salir = function() { | 574 | $scope.salir = function() { |
| 565 | $location.path('/'); | 575 | $location.path('/'); |
| 566 | }; | 576 | }; |
| 567 | 577 | ||
| 568 | function addCabecera(label, valor) { | 578 | function addCabecera(label, valor) { |
| 569 | var propiedad = $filter('filter')($scope.cabecera, {label: label}, true); | 579 | var propiedad = $filter('filter')($scope.cabecera, {label: label}, true); |
| 570 | if(propiedad.length === 1) { | 580 | if(propiedad.length === 1) { |
| 571 | propiedad[0].valor = valor; | 581 | propiedad[0].valor = valor; |
| 572 | } else { | 582 | } else { |
| 573 | $scope.cabecera.push({label: label, valor: valor}); | 583 | $scope.cabecera.push({label: label, valor: valor}); |
| 574 | } | 584 | } |
| 575 | } | 585 | } |
| 576 | 586 | ||
| 577 | function removeCabecera(label) { | 587 | function removeCabecera(label) { |
| 578 | var propiedad = $filter('filter')($scope.cabecera, {label: label}, true); | 588 | var propiedad = $filter('filter')($scope.cabecera, {label: label}, true); |
| 579 | if(propiedad.length === 1){ | 589 | if(propiedad.length === 1){ |
| 580 | $scope.cabecera.splice($scope.cabecera.indexOf(propiedad[0]), 1); | 590 | $scope.cabecera.splice($scope.cabecera.indexOf(propiedad[0]), 1); |
| 581 | } | 591 | } |
| 582 | } | 592 | } |
| 593 | |||
| 594 | function rellenar(relleno, longitud) { | ||
| 595 | relleno = '' + relleno; | ||
| 596 | while (relleno.length < longitud) { | ||
| 597 | relleno = '0' + relleno; | ||
| 598 | } | ||
| 599 | |||
| 600 | return relleno; | ||
| 601 | } | ||
| 583 | } | 602 | } |
| 584 | ] | 603 | ] |
| 585 | ) | 604 | ) |
| 586 | .controller('remitoListaCtrl', [ | 605 | .controller('remitoListaCtrl', [ |
| 587 | '$scope', | 606 | '$scope', |
| 588 | 'crearRemitoService', | 607 | 'crearRemitoService', |
| 589 | '$location', | 608 | '$location', |
| 590 | function($scope, crearRemitoService, $location) { | 609 | function($scope, crearRemitoService, $location) { |
| 591 | crearRemitoService.obtenerRemito().then(function(datos) { | 610 | crearRemitoService.obtenerRemito().then(function(datos) { |
| 592 | $scope.remitos = datos.data; | 611 | $scope.remitos = datos.data; |
| 593 | }); | 612 | }); |
| 594 | $scope.editar = function(remito) { | 613 | $scope.editar = function(remito) { |
| 595 | crearRemitoService.setRemito(remito); | 614 | crearRemitoService.setRemito(remito); |
| 596 | $location.path('/venta-nota-remito/abm/'); | 615 | $location.path('/venta-nota-remito/abm/'); |
| 597 | }; | 616 | }; |
| 598 | $scope.crearRemito = function() { | 617 | $scope.crearRemito = function() { |
| 599 | crearRemitoService.clearRemito(); | 618 | crearRemitoService.clearRemito(); |
| 600 | $location.path('/venta-nota-remito/abm/'); | 619 | $location.path('/venta-nota-remito/abm/'); |
| 601 | }; | 620 | }; |
| 602 | } | 621 | } |
| 603 | ]) | 622 | ]) |
| 604 | .controller('focaCrearRemitoFichaClienteController', [ | 623 | .controller('focaCrearRemitoFichaClienteController', [ |
| 605 | '$scope', | 624 | '$scope', |
| 606 | 'crearRemitoService', | 625 | 'crearRemitoService', |
| 607 | '$location', | 626 | '$location', |
| 608 | function($scope, crearRemitoService, $location) { | 627 | function($scope, crearRemitoService, $location) { |
| 609 | crearRemitoService.obtenerRemito().then(function(datos) { | 628 | crearRemitoService.obtenerRemito().then(function(datos) { |
| 610 | $scope.remitos = datos.data; | 629 | $scope.remitos = datos.data; |
| 611 | }); | 630 | }); |
| 612 | $scope.editar = function(remito) { | 631 | $scope.editar = function(remito) { |
| 613 | crearRemitoService.setRemito(remito); | 632 | crearRemitoService.setRemito(remito); |
| 614 | $location.path('/venta-nota-remito/abm/'); | 633 | $location.path('/venta-nota-remito/abm/'); |
| 615 | }; | 634 | }; |
| 616 | $scope.crearRemito = function() { | 635 | $scope.crearRemito = function() { |
| 617 | crearRemitoService.clearRemito(); | 636 | crearRemitoService.clearRemito(); |
| 618 | $location.path('/venta-nota-remito/abm/'); | 637 | $location.path('/venta-nota-remito/abm/'); |
| 619 | }; | 638 | }; |
| 620 | } | 639 | } |
| 621 | ]); | 640 | ]); |
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 |