Commit 7170485c7611e2e8e444d16df88d8ef58c8445d7

Authored by Eric Fernandez
Exists in master and in 1 other branch develop

Merge branch 'master' into 'master'

agrego foca-botonera-facturador

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