Commit 570ac1a4af8293030b8043a2ce5674569f6bfa16

Authored by Jose Pinto
1 parent ae1676e213
Exists in master and in 1 other branch develop

agrego foca-botonera-facturador

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