Commit 02ed9ea9f36236f0dd73335eb0a94c654612f1fd

Authored by Jose Pinto
1 parent 76cf247695
Exists in master

agrego foca-botonera-facturador

1 <html ng-app="focaCrearCobranza"> 1 <html ng-app="focaCrearCobranza">
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/ui-bootstrap4/dist/ui-bootstrap-tpls.js"></script> 16 <script src="node_modules/ui-bootstrap4/dist/ui-bootstrap-tpls.js"></script>
17 <script src="node_modules/ladda/dist/spin.min.js"></script> 17 <script src="node_modules/ladda/dist/spin.min.js"></script>
18 <script src="node_modules/ladda/dist/ladda.min.js"></script> 18 <script src="node_modules/ladda/dist/ladda.min.js"></script>
19 <script src="node_modules/angular-ladda/dist/angular-ladda.min.js"></script> 19 <script src="node_modules/angular-ladda/dist/angular-ladda.min.js"></script>
20 20
21 <script src="node_modules/foca-botonera-facturador/dist/foca-botonera-facturador.min.js"></script>
21 <script src="node_modules/foca-directivas/dist/foca-directivas.min.js"></script> 22 <script src="node_modules/foca-directivas/dist/foca-directivas.min.js"></script>
22 <script src="node_modules/foca-modal/dist/foca-modal.min.js"></script> 23 <script src="node_modules/foca-modal/dist/foca-modal.min.js"></script>
23 <script src="node_modules/foca-directivas/dist/foca-directivas.min.js"></script> 24 <script src="node_modules/foca-directivas/dist/foca-directivas.min.js"></script>
24 <script src="node_modules/foca-modal-factura/dist/foca-modal-factura.min.js"></script> 25 <script src="node_modules/foca-modal-factura/dist/foca-modal-factura.min.js"></script>
25 <script src="node_modules/foca-busqueda-cliente/dist/foca-busqueda-cliente.min.js"></script> 26 <script src="node_modules/foca-busqueda-cliente/dist/foca-busqueda-cliente.min.js"></script>
26 27
27 <script src="src/js/app.js"></script> 28 <script src="src/js/app.js"></script>
28 <script src="src/js/controller.js"></script> 29 <script src="src/js/controller.js"></script>
29 <script src="src/js/service.js"></script> 30 <script src="src/js/service.js"></script>
30 <script src="src/js/businessService.js"></script> 31 <script src="src/js/businessService.js"></script>
31 <script src="src/js/route.js"></script> 32 <script src="src/js/route.js"></script>
32 33
33 <script src="src/etc/develop.js"></script> 34 <script src="src/etc/develop.js"></script>
34 </head> 35 </head>
35 <body> 36 <body>
36 <div ng-view class="container-fluid"></div> 37 <div ng-view class="container-fluid"></div>
37 </body> 38 </body>
38 </html> 39 </html>
39 40
1 { 1 {
2 "name": "foca-crear-cobranza", 2 "name": "foca-crear-cobranza",
3 "version": "0.0.1", 3 "version": "0.0.1",
4 "description": "sistema de cobranzas a partir de facturas", 4 "description": "sistema de cobranzas a partir de facturas",
5 "main": "index.js", 5 "main": "index.js",
6 "scripts": { 6 "scripts": {
7 "test": "echo \"Error: no test specified\" && exit 1", 7 "test": "echo \"Error: no test specified\" && exit 1",
8 "compile": "gulp uglify", 8 "compile": "gulp uglify",
9 "gulp-pre-commit": "gulp pre-commit", 9 "gulp-pre-commit": "gulp pre-commit",
10 "postinstall": "npm run compile && gulp clean-post-install", 10 "postinstall": "npm run compile && gulp clean-post-install",
11 "install-dev": "npm install -D jasmine-core pre-commit angular angular-ladda ladda@1.0.6 angular-route bootstrap ui-bootstrap4 font-awesome gulp gulp-angular-templatecache gulp-connect gulp-clean gulp-htmlmin gulp-jshint gulp-rename gulp-replace gulp-sequence gulp-uglify-es gulp-uglify jquery jshint pump git+http://git.focasoftware.com/npm/foca-directivas.git git+http://git.focasoftware.com/npm/foca-modal-factura.git git+http://git.focasoftware.com/npm/foca-busqueda-cliente.git git+http://git.focasoftware.com/npm/foca-directivas.git" 11 "install-dev": "npm install -D jasmine-core pre-commit angular angular-ladda ladda@1.0.6 angular-route bootstrap ui-bootstrap4 font-awesome gulp gulp-angular-templatecache gulp-connect gulp-clean gulp-htmlmin gulp-jshint gulp-rename gulp-replace gulp-sequence gulp-uglify-es gulp-uglify jquery jshint pump git+http://git.focasoftware.com/npm/foca-directivas.git git+http://git.focasoftware.com/npm/foca-modal-factura.git git+http://git.focasoftware.com/npm/foca-busqueda-cliente.git git+http://git.focasoftware.com/npm/foca-directivas.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": "http://git.focasoftware.com/npm/foca-crear-cobranza.git" 18 "url": "http://git.focasoftware.com/npm/foca-crear-cobranza.git"
19 }, 19 },
20 "author": "Foca Software", 20 "author": "Foca Software",
21 "license": "ISC", 21 "license": "ISC",
22 "devDependencies": { 22 "devDependencies": {
23 "angular": "^1.7.5", 23 "angular": "^1.7.5",
24 "angular-ladda": "^0.4.3", 24 "angular-ladda": "^0.4.3",
25 "angular-route": "^1.7.5", 25 "angular-route": "^1.7.5",
26 "bootstrap": "^4.1.3", 26 "bootstrap": "^4.1.3",
27 "foca-botonera-facturador": "git+http://git.focasoftware.com/npm/foca-botonera-facturador.git",
27 "foca-busqueda-cliente": "git+http://git.focasoftware.com/npm/foca-busqueda-cliente.git", 28 "foca-busqueda-cliente": "git+http://git.focasoftware.com/npm/foca-busqueda-cliente.git",
28 "foca-directivas": "git+http://git.focasoftware.com/npm/foca-directivas.git", 29 "foca-directivas": "git+http://git.focasoftware.com/npm/foca-directivas.git",
29 "foca-modal": "git+http://git.focasoftware.com/npm/foca-modal.git", 30 "foca-modal": "git+http://git.focasoftware.com/npm/foca-modal.git",
30 "foca-modal-factura": "git+http://git.focasoftware.com/npm/foca-modal-factura.git", 31 "foca-modal-factura": "git+http://git.focasoftware.com/npm/foca-modal-factura.git",
31 "font-awesome": "^4.7.0", 32 "font-awesome": "^4.7.0",
32 "gulp": "^3.9.1", 33 "gulp": "^3.9.1",
33 "gulp-angular-templatecache": "^2.2.5", 34 "gulp-angular-templatecache": "^2.2.5",
34 "gulp-clean": "^0.4.0", 35 "gulp-clean": "^0.4.0",
35 "gulp-concat": "^2.6.1", 36 "gulp-concat": "^2.6.1",
36 "gulp-connect": "^5.6.1", 37 "gulp-connect": "^5.6.1",
37 "gulp-htmlmin": "^5.0.1", 38 "gulp-htmlmin": "^5.0.1",
38 "gulp-jshint": "^2.1.0", 39 "gulp-jshint": "^2.1.0",
39 "gulp-rename": "^1.4.0", 40 "gulp-rename": "^1.4.0",
40 "gulp-replace": "^1.0.0", 41 "gulp-replace": "^1.0.0",
41 "gulp-sequence": "^1.0.0", 42 "gulp-sequence": "^1.0.0",
42 "gulp-uglify": "^3.0.1", 43 "gulp-uglify": "^3.0.1",
43 "gulp-uglify-es": "^1.0.4", 44 "gulp-uglify-es": "^1.0.4",
44 "jasmine-core": "^3.3.0", 45 "jasmine-core": "^3.3.0",
45 "jquery": "^3.3.1", 46 "jquery": "^3.3.1",
46 "jshint": "^2.9.6", 47 "jshint": "^2.9.6",
47 "ladda": "1.0.6", 48 "ladda": "1.0.6",
48 "pre-commit": "^1.2.2", 49 "pre-commit": "^1.2.2",
49 "pump": "^3.0.0", 50 "pump": "^3.0.0",
50 "ui-bootstrap4": "^3.0.5" 51 "ui-bootstrap4": "^3.0.5"
51 } 52 }
52 } 53 }
53 54
src/js/controller.js
1 angular.module('focaCrearCobranza') .controller('cobranzaController', 1 angular.module('focaCrearCobranza') .controller('cobranzaController',
2 [ 2 [
3 '$scope', 3 '$scope',
4 '$uibModal', 4 '$uibModal',
5 '$location', 5 '$location',
6 '$filter', 6 '$filter',
7 'focaCrearCobranzaService', 7 'focaCrearCobranzaService',
8 'focaModalService', 8 'focaModalService',
9 '$cookies', 9 '$cookies',
10 'focaSeguimientoService', 10 'focaSeguimientoService',
11 function($scope, $uibModal, $location, $filter, focaCrearCobranzaService, focaModalService, 11 function($scope, $uibModal, $location, $filter, focaCrearCobranzaService, focaModalService,
12 $cookies, focaSeguimientoService) 12 $cookies, focaSeguimientoService)
13 { 13 {
14 $scope.botonera = [ 14 $scope.botonera = focaCrearCobranzaService.getBotonera();
15 {texto: 'Cliente', imagen: '../img/abmPrecios.png',
16 accion: function() {$scope.seleccionarCliente();}},
17 {texto: 'Cobrador', imagen: '../img/abmPrecios.png',
18 accion: function() {$scope.seleccionarCobrador();}},
19 {texto: 'Comprobantes', imagen: '../img/abmPrecios.png',
20 accion: function() {$scope.swichDeuda();}},
21 {texto: 'Cobros', imagen: '../img/abmPrecios.png',
22 accion: function() {$scope.swichCobro();}},
23 {texto: 'Moneda', imagen: '../img/abmPrecios.png',
24 accion: function() {$scope.seleccionarMoneda();}},
25 {texto: '', accion: function() {}},
26 ];
27 $scope.datepickerAbierto = false; 15 $scope.datepickerAbierto = false;
28 $scope.cobroDeuda = true; 16 $scope.cobroDeuda = true;
29 $scope.show = false; 17 $scope.show = false;
30 $scope.cargando = true; 18 $scope.cargando = true;
31 $scope.dateOptions = { 19 $scope.dateOptions = {
32 maxDate: new Date(), 20 maxDate: new Date(),
33 minDate: new Date(2010, 0, 1) 21 minDate: new Date(2010, 0, 1)
34 }; 22 };
35 23
36 $scope.cabecera = []; 24 $scope.cabecera = [];
37 $scope.showCabecera = true; 25 $scope.showCabecera = true;
38 26
39 $scope.cobranza = {}; 27 $scope.cobranza = {};
40 28
41 $scope.fecha = new Date(); 29 $scope.fecha = new Date();
42 $scope.puntoVenta = '0000'; 30 $scope.puntoVenta = '0000';
43 $scope.comprobante = '00000000'; 31 $scope.comprobante = '00000000';
44 $scope.facturaTabla = []; 32 $scope.facturaTabla = [];
45 $scope.cobrosTabla = []; 33 $scope.cobrosTabla = [];
46 34
47 focaCrearCobranzaService.getUsuario($cookies.get('idUsuario')).then(function(data) { 35 focaCrearCobranzaService.getUsuario($cookies.get('idUsuario')).then(function(data) {
48 $scope.usuario = data.data; 36 $scope.usuario = data.data;
49 }); 37 });
50 38
51 $scope.crearCobranza = function() { 39 $scope.crearCobranza = function() {
52 if(!$scope.cobranza.cliente) { 40 if(!$scope.cobranza.cliente) {
53 focaModalService.alert('Ingrese Cliente'); 41 focaModalService.alert('Ingrese Cliente');
54 return; 42 return;
55 } 43 }
56 if(!$scope.cobranza.cobrador) { 44 if(!$scope.cobranza.cobrador) {
57 focaModalService.alert('Ingrese Cobrador'); 45 focaModalService.alert('Ingrese Cobrador');
58 return; 46 return;
59 } 47 }
60 if($scope.facturaTabla.length < 1) { 48 if($scope.facturaTabla.length < 1) {
61 focaModalService.alert('Ingrese al menos una factura'); 49 focaModalService.alert('Ingrese al menos una factura');
62 return; 50 return;
63 } 51 }
64 if($scope.getTotalCobrado() + $scope.getTotalDeuda() !== 0) { 52 if($scope.getTotalCobrado() + $scope.getTotalDeuda() !== 0) {
65 focaModalService.alert('La diferencia debe ser ' + 53 focaModalService.alert('La diferencia debe ser ' +
66 $scope.cobranza.moneda.SIMBOLO + '0,00'); 54 $scope.cobranza.moneda.SIMBOLO + '0,00');
67 return; 55 return;
68 } 56 }
69 var cobranza = {}; 57 var cobranza = {};
70 var cheques = []; 58 var cheques = [];
71 var cuerpos = []; 59 var cuerpos = [];
72 //TODO: habilitar edición 60 //TODO: habilitar edición
73 $scope.editando = false; 61 $scope.editando = false;
74 $scope.saveLoading = true; 62 $scope.saveLoading = true;
75 for (var i = 0; i < $scope.facturaTabla.length; i++) { 63 for (var i = 0; i < $scope.facturaTabla.length; i++) {
76 var cuerpoFactura = { 64 var cuerpoFactura = {
77 CYV: 'V', 65 CYV: 'V',
78 TIP: 'C', 66 TIP: 'C',
79 TCO: 'RC', 67 TCO: 'RC',
80 PVE: $scope.puntoVenta, 68 PVE: $scope.puntoVenta,
81 NCO: $scope.comprobante, 69 NCO: $scope.comprobante,
82 LOP: 'L', 70 LOP: 'L',
83 TIL: $scope.facturaTabla[i].TCO, 71 TIL: $scope.facturaTabla[i].TCO,
84 COM: $scope.facturaTabla[i].numeroFactura + '-' + 72 COM: $scope.facturaTabla[i].numeroFactura + '-' +
85 $scope.rellenar($scope.facturaTabla[i].NCU,2), 73 $scope.rellenar($scope.facturaTabla[i].NCU,2),
86 FEC: $scope.fecha.toISOString().slice(0, 19).replace('T', ' '), 74 FEC: $scope.fecha.toISOString().slice(0, 19).replace('T', ' '),
87 IMP: Math.abs($scope.facturaTabla[i].IPA), 75 IMP: Math.abs($scope.facturaTabla[i].IPA),
88 RES: 0,//caja de tesorería 76 RES: 0,//caja de tesorería
89 SUBM: 0 77 SUBM: 0
90 }; 78 };
91 cuerpos.push(cuerpoFactura); 79 cuerpos.push(cuerpoFactura);
92 } 80 }
93 81
94 for (var j = 0; j < $scope.cobrosTabla.length; j++) { 82 for (var j = 0; j < $scope.cobrosTabla.length; j++) {
95 83
96 var efectivo = $scope.cobrosTabla[j].tipo === 'Efectivo' ? true : false; 84 var efectivo = $scope.cobrosTabla[j].tipo === 'Efectivo' ? true : false;
97 85
98 var cuerpoCobros = { 86 var cuerpoCobros = {
99 CYV: 'V', 87 CYV: 'V',
100 TIP: 'C', 88 TIP: 'C',
101 TCO: 'RC', 89 TCO: 'RC',
102 PVE: $scope.puntoVenta, 90 PVE: $scope.puntoVenta,
103 NCO: $scope.comprobante, 91 NCO: $scope.comprobante,
104 LOP: 'P', 92 LOP: 'P',
105 TIL: 'EF', 93 TIL: 'EF',
106 COM: efectivo ? 'ef(COBRO EN EFECTIVO)' : 'ch(' + 94 COM: efectivo ? 'ef(COBRO EN EFECTIVO)' : 'ch(' +
107 $scope.cobrosTabla[j].numero + ')' + $scope.cobrosTabla[j].banco.desbco, 95 $scope.cobrosTabla[j].numero + ')' + $scope.cobrosTabla[j].banco.desbco,
108 FEC: efectivo ? 96 FEC: efectivo ?
109 $scope.cobrosTabla[j].fecha 97 $scope.cobrosTabla[j].fecha
110 .toISOString().slice(0, 19).replace('T', ' ') : 98 .toISOString().slice(0, 19).replace('T', ' ') :
111 $scope.cobrosTabla[j].fechaPresentacion 99 $scope.cobrosTabla[j].fechaPresentacion
112 .toISOString().slice(0, 19).replace('T', ' '), 100 .toISOString().slice(0, 19).replace('T', ' '),
113 IMP: Math.abs($scope.cobrosTabla[j].importe), 101 IMP: Math.abs($scope.cobrosTabla[j].importe),
114 RES: 0,//caja de tesorería 102 RES: 0,//caja de tesorería
115 SUBM: 0 103 SUBM: 0
116 }; 104 };
117 cuerpos.push(cuerpoCobros); 105 cuerpos.push(cuerpoCobros);
118 106
119 if(!efectivo) { 107 if(!efectivo) {
120 var cheque = { 108 var cheque = {
121 BCO: $scope.cobrosTabla[j].banco.ID, 109 BCO: $scope.cobrosTabla[j].banco.ID,
122 NUM: $scope.comprobante, 110 NUM: $scope.comprobante,
123 FEP: $scope.cobrosTabla[j].fechaPresentacion 111 FEP: $scope.cobrosTabla[j].fechaPresentacion
124 .toISOString().slice(0, 19).replace('T', ' '), 112 .toISOString().slice(0, 19).replace('T', ' '),
125 FEE: $scope.cobrosTabla[j].fechaEmision 113 FEE: $scope.cobrosTabla[j].fechaEmision
126 .toISOString().slice(0, 19).replace('T', ' '), 114 .toISOString().slice(0, 19).replace('T', ' '),
127 LUG: $scope.cobrosTabla[j].localidad.NOMBRE, 115 LUG: $scope.cobrosTabla[j].localidad.NOMBRE,
128 IMP: $scope.cobrosTabla[j].importe, 116 IMP: $scope.cobrosTabla[j].importe,
129 LIB: $scope.cobrosTabla[j].librador, 117 LIB: $scope.cobrosTabla[j].librador,
130 EST: 'C',//'D' depositado, 'E' entregado, 'C' en cartera 118 EST: 'C',//'D' depositado, 'E' entregado, 'C' en cartera
131 PCI: $scope.cobrosTabla[j].provincia.ID, 119 PCI: $scope.cobrosTabla[j].provincia.ID,
132 LPLA: 0, 120 LPLA: 0,
133 PLA: 0, 121 PLA: 0,
134 VEN: $scope.usuario.CodVen,//Id vendedor 122 VEN: $scope.usuario.CodVen,//Id vendedor
135 CCLIE: $scope.cobranza.cliente.COD,//Id cliente 123 CCLIE: $scope.cobranza.cliente.COD,//Id cliente
136 REN: 0, 124 REN: 0,
137 PVEC: $scope.puntoVenta, 125 PVEC: $scope.puntoVenta,
138 NCOC: $scope.comprobante, 126 NCOC: $scope.comprobante,
139 OBSE: $scope.cobrosTabla[j].observaciones, 127 OBSE: $scope.cobrosTabla[j].observaciones,
140 LUV: 0, 128 LUV: 0,
141 ORI: 've', 129 ORI: 've',
142 FER: '', 130 FER: '',
143 BIMP: 0, 131 BIMP: 0,
144 COMP: 'C ' +'RC ' + $scope.puntoVenta + '-' + $scope.comprobante, 132 COMP: 'C ' +'RC ' + $scope.puntoVenta + '-' + $scope.comprobante,
145 VAL_E: '',//Cuando egresa por ingresos y egresos en el numero de egreso 133 VAL_E: '',//Cuando egresa por ingresos y egresos en el numero de egreso
146 VAL_I: '',//Cuando Ingresa por ingresos y egresos en el numero ingreso 134 VAL_I: '',//Cuando Ingresa por ingresos y egresos en el numero ingreso
147 REC_CAJ: 'D', 135 REC_CAJ: 'D',
148 TIPO_C: 0,//?? 136 TIPO_C: 0,//??
149 SALDO_CAJ: 'S', 137 SALDO_CAJ: 'S',
150 FECHA_INGRESO: $scope.fecha 138 FECHA_INGRESO: $scope.fecha
151 .toISOString().slice(0, 19).replace('T', ' '), 139 .toISOString().slice(0, 19).replace('T', ' '),
152 Vendedor_valor: 0, 140 Vendedor_valor: 0,
153 FAMILIA: 0, 141 FAMILIA: 0,
154 CUIT_LIB: '', 142 CUIT_LIB: '',
155 COD_LUG: $scope.cobrosTabla[j].localidad.ID,//código lugar 143 COD_LUG: $scope.cobrosTabla[j].localidad.ID,//código lugar
156 SEN: '', 144 SEN: '',
157 NRC: 0, 145 NRC: 0,
158 COD_LARGO: '', 146 COD_LARGO: '',
159 VN: 0, 147 VN: 0,
160 ID_LECTOR: 0, 148 ID_LECTOR: 0,
161 NATHB: '' 149 NATHB: ''
162 }; 150 };
163 cheques.push(cheque); 151 cheques.push(cheque);
164 } 152 }
165 } 153 }
166 154
167 cobranza = { 155 cobranza = {
168 recibo: { 156 recibo: {
169 CYV: 'V', 157 CYV: 'V',
170 TIP: 'C', 158 TIP: 'C',
171 TCO: 'RC', 159 TCO: 'RC',
172 PVE: $scope.puntoVenta, //Sucursar, punto de venta 160 PVE: $scope.puntoVenta, //Sucursar, punto de venta
173 NCO: $scope.comprobante, //Numero de comprobante 161 NCO: $scope.comprobante, //Numero de comprobante
174 FEC: $scope.fecha.toISOString().slice(0, 19).replace('T', ' '), 162 FEC: $scope.fecha.toISOString().slice(0, 19).replace('T', ' '),
175 CLI: $scope.cobranza.cliente.COD, 163 CLI: $scope.cobranza.cliente.COD,
176 ATO: 0, //número de asiento 164 ATO: 0, //número de asiento
177 CFE: $scope.cobranza.cobrador.nombre, 165 CFE: $scope.cobranza.cobrador.nombre,
178 PLA: '',//Numero de planilla, sin uso 166 PLA: '',//Numero de planilla, sin uso
179 ID_MONEDA: $scope.cobranza.moneda.ID, 167 ID_MONEDA: $scope.cobranza.moneda.ID,
180 COTIZACION: $scope.cobranza.cotizacion.VENDEDOR, 168 COTIZACION: $scope.cobranza.cotizacion.VENDEDOR,
181 idCobrador: $scope.cobranza.cobrador.id 169 idCobrador: $scope.cobranza.cobrador.id
182 }, 170 },
183 cuerpo: cuerpos, 171 cuerpo: cuerpos,
184 cheques: cheques, 172 cheques: cheques,
185 acobypag: { 173 acobypag: {
186 CYV: 'V', 174 CYV: 'V',
187 COD: $scope.cobranza.cliente.COD, 175 COD: $scope.cobranza.cliente.COD,
188 FEP: $scope.fecha.toISOString().slice(0, 19).replace('T', ' '), 176 FEP: $scope.fecha.toISOString().slice(0, 19).replace('T', ' '),
189 TIP: 'C', 177 TIP: 'C',
190 TCO: 'RC', 178 TCO: 'RC',
191 SUC: $scope.puntoVenta, 179 SUC: $scope.puntoVenta,
192 NCO: $scope.comprobante, 180 NCO: $scope.comprobante,
193 IPA: $scope.getTotalCobrado(), 181 IPA: $scope.getTotalCobrado(),
194 SAL: '',//?? 182 SAL: '',//??
195 TCA: 1, 183 TCA: 1,
196 ZONA: 1, 184 ZONA: 1,
197 FPA: 2,//Forma de pago 185 FPA: 2,//Forma de pago
198 REC: 0, 186 REC: 0,
199 REP: 0, 187 REP: 0,
200 FER: null, 188 FER: null,
201 REM: 0, 189 REM: 0,
202 FRE: null,//?? 190 FRE: null,//??
203 PRO: 'N', 191 PRO: 'N',
204 FEV: $scope.fecha.toISOString().slice(0, 19).replace('T', ' ') 192 FEV: $scope.fecha.toISOString().slice(0, 19).replace('T', ' ')
205 }, 193 },
206 datosCobrador: { 194 datosCobrador: {
207 COD: $scope.cobranza.cobrador.id, 195 COD: $scope.cobranza.cobrador.id,
208 PVE: $scope.puntoVenta, 196 PVE: $scope.puntoVenta,
209 NUM: $scope.comprobante, 197 NUM: $scope.comprobante,
210 EST: 'C', 198 EST: 'C',
211 OBS: 'RC: ' + $scope.comprobante + '-' + $scope.fecha.toLocaleDateString(), 199 OBS: 'RC: ' + $scope.comprobante + '-' + $scope.fecha.toLocaleDateString(),
212 DAT1: 'C', 200 DAT1: 'C',
213 CLI: $scope.cobranza.cliente.COD 201 CLI: $scope.cobranza.cliente.COD
214 } 202 }
215 }; 203 };
216 focaCrearCobranzaService.guardarCobranza(cobranza).then( 204 focaCrearCobranzaService.guardarCobranza(cobranza).then(
217 function(result) { 205 function(result) {
218 $scope.saveLoading = false; 206 $scope.saveLoading = false;
219 focaModalService.alert('Cobranza guardada con éxito'); 207 focaModalService.alert('Cobranza guardada con éxito');
220 208
221 focaSeguimientoService.guardarPosicion( 209 focaSeguimientoService.guardarPosicion(
222 result.data.numero, 210 result.data.numero,
223 'Cobranza', 211 'Cobranza',
224 'Nº: ' + $filter('comprobante')([ 212 'Nº: ' + $filter('comprobante')([
225 result.data.sucursal, 213 result.data.sucursal,
226 result.data.numero 214 result.data.numero
227 ]) + '<br/>' + 215 ]) + '<br/>' +
228 'Vendedor: ' + $scope.cobranza.cobrador.nombre + '<br/>' + 216 'Vendedor: ' + $scope.cobranza.cobrador.nombre + '<br/>' +
229 'Total: ' + $filter('currency')($scope.getTotalCobrado()), 217 'Total: ' + $filter('currency')($scope.getTotalCobrado()),
230 result.data.sucursal 218 result.data.sucursal
231 ); 219 );
232 220
233 $scope.cobranza = { 221 $scope.cobranza = {
234 fecha: new Date() 222 fecha: new Date()
235 }; 223 };
236 setearMonedaPorDefecto(); 224 setearMonedaPorDefecto();
237 obtenerNumeroComprobante(); 225 obtenerNumeroComprobante();
238 226
239 $scope.cabecera = []; 227 $scope.cabecera = [];
240 $scope.fecha = new Date(); 228 $scope.fecha = new Date();
241 $scope.facturaTabla = []; 229 $scope.facturaTabla = [];
242 $scope.cobrosTabla = []; 230 $scope.cobrosTabla = [];
243 }, function(error) { 231 }, function(error) {
244 focaModalService.alert('Hubo un problema al cargar la cobranza'); 232 focaModalService.alert('Hubo un problema al cargar la cobranza');
245 $scope.saveLoading = false; 233 $scope.saveLoading = false;
246 console.info(error); 234 console.info(error);
247 } 235 }
248 ); 236 );
249 }; 237 };
250 238
251 $scope.swichCobro = function() { 239 $scope.seleccionarCobros = function() {
252 $scope.cobroDeuda = false; 240 $scope.cobroDeuda = false;
253 }; 241 };
254 242
255 $scope.swichDeuda = function() { 243 $scope.seleccionarComprobantes = function() {
256 $scope.cobroDeuda = true; 244 $scope.cobroDeuda = true;
257 }; 245 };
258 246
259 $scope.seleccionarCobranza = function() { 247 $scope.seleccionarCobranza = function() {
260 248
261 var modalInstance = $uibModal.open( 249 var modalInstance = $uibModal.open(
262 { 250 {
263 ariaLabelledBy: 'Busqueda de Cobranzas', 251 ariaLabelledBy: 'Busqueda de Cobranzas',
264 templateUrl: 'foca-modal-cobranza.html', 252 templateUrl: 'foca-modal-cobranza.html',
265 controller: 'focaModalCobranzaController', 253 controller: 'focaModalCobranzaController',
266 size: 'lg' 254 size: 'lg'
267 } 255 }
268 ); 256 );
269 modalInstance.result.then(function(cobranza) { 257 modalInstance.result.then(function(cobranza) {
270 $scope.editando = true; 258 $scope.editando = true;
271 $scope.cabecera = []; 259 $scope.cabecera = [];
272 $scope.facturaTabla = []; 260 $scope.facturaTabla = [];
273 $scope.cobrosTabla = []; 261 $scope.cobrosTabla = [];
274 262
275 $scope.fecha = new Date(cobranza.fecha); 263 $scope.fecha = new Date(cobranza.fecha);
276 264
277 addCabecera('Cliente:', cobranza.cliente.NOM); 265 addCabecera('Cliente:', cobranza.cliente.NOM);
278 addCabecera('Cobrador:', cobranza.cobrador); 266 addCabecera('Cobrador:', cobranza.cobrador);
279 267
280 $scope.facturaTabla = cobranza.facturas; 268 $scope.facturaTabla = cobranza.facturas;
281 $scope.cobrosTabla = cobranza.cobros; 269 $scope.cobrosTabla = cobranza.cobros;
282 270
283 }); 271 });
284 }; 272 };
285 273
286 $scope.seleccionarCliente = function() { 274 $scope.seleccionarCliente = function() {
287 275
288 var modalInstance = $uibModal.open( 276 var modalInstance = $uibModal.open(
289 { 277 {
290 ariaLabelledBy: 'Busqueda de Cliente', 278 ariaLabelledBy: 'Busqueda de Cliente',
291 templateUrl: 'foca-busqueda-cliente-modal.html', 279 templateUrl: 'foca-busqueda-cliente-modal.html',
292 controller: 'focaBusquedaClienteModalController', 280 controller: 'focaBusquedaClienteModalController',
293 size: 'lg' 281 size: 'lg'
294 } 282 }
295 ); 283 );
296 modalInstance.result.then( 284 modalInstance.result.then(
297 function(cliente) { 285 function(cliente) {
298 addCabecera('Cliente:', cliente.nom); 286 addCabecera('Cliente:', cliente.nom);
299 $scope.cobranza.cliente = { 287 $scope.cobranza.cliente = {
300 COD: cliente.cod, 288 COD: cliente.cod,
301 CUIT: cliente.cuit, 289 CUIT: cliente.cuit,
302 NOM: cliente.nom 290 NOM: cliente.nom
303 }; 291 };
304 }, function() { 292 }, function() {
305 293
306 } 294 }
307 ); 295 );
308 }; 296 };
309 297
310 $scope.seleccionarFactura = function() { 298 $scope.seleccionarFactura = function() {
311 if(!$scope.cobranza.cliente) { 299 if(!$scope.cobranza.cliente) {
312 focaModalService.alert('Seleccione primero un cliente'); 300 focaModalService.alert('Seleccione primero un cliente');
313 return; 301 return;
314 } 302 }
315 var modalInstance = $uibModal.open( 303 var modalInstance = $uibModal.open(
316 { 304 {
317 ariaLabelledBy: 'Busqueda de Facturas', 305 ariaLabelledBy: 'Busqueda de Facturas',
318 templateUrl: 'foca-modal-factura.html', 306 templateUrl: 'foca-modal-factura.html',
319 controller: 'focaModalFacturaController', 307 controller: 'focaModalFacturaController',
320 size: 'lg', 308 size: 'lg',
321 resolve: { 309 resolve: {
322 parametrosFactura: function() { 310 parametrosFactura: function() {
323 return { 311 return {
324 cliente: $scope.cobranza.cliente.COD, 312 cliente: $scope.cobranza.cliente.COD,
325 simbolo: $scope.cobranza.moneda.SIMBOLO, 313 simbolo: $scope.cobranza.moneda.SIMBOLO,
326 cotizacion: $scope.cobranza.cotizacion.VENDEDOR, 314 cotizacion: $scope.cobranza.cotizacion.VENDEDOR,
327 moneda: $scope.cobranza.moneda.ID 315 moneda: $scope.cobranza.moneda.ID
328 }; 316 };
329 } 317 }
330 } 318 }
331 } 319 }
332 ); 320 );
333 modalInstance.result.then( 321 modalInstance.result.then(
334 function(facturas) { 322 function(facturas) {
335 $scope.facturaTabla = $scope.facturaTabla.concat(facturas); 323 $scope.facturaTabla = $scope.facturaTabla.concat(facturas);
336 }, function() { 324 }, function() {
337 325
338 } 326 }
339 ); 327 );
340 }; 328 };
341 329
342 $scope.seleccionarCheque = function() { 330 $scope.seleccionarCheque = function() {
343 var modalInstance = $uibModal.open( 331 var modalInstance = $uibModal.open(
344 { 332 {
345 ariaLabelledBy: 'Carga de cheques', 333 ariaLabelledBy: 'Carga de cheques',
346 templateUrl: 'modal-cheque.html', 334 templateUrl: 'modal-cheque.html',
347 controller: 'focaModalChequeController', 335 controller: 'focaModalChequeController',
348 size: 'lg' 336 size: 'lg'
349 } 337 }
350 ); 338 );
351 modalInstance.result.then( 339 modalInstance.result.then(
352 function(cheque) { 340 function(cheque) {
353 var cobro = { 341 var cobro = {
354 tipo: 'Ch' + '(' + cheque.numero + ')' + ' ' + cheque.banco.desbco, 342 tipo: 'Ch' + '(' + cheque.numero + ')' + ' ' + cheque.banco.desbco,
355 numero: cheque.numero, 343 numero: cheque.numero,
356 banco: cheque.banco, 344 banco: cheque.banco,
357 fecha: cheque.fechaEmision.toLocaleDateString() + '-' + 345 fecha: cheque.fechaEmision.toLocaleDateString() + '-' +
358 cheque.fechaPresentacion.toLocaleDateString(), 346 cheque.fechaPresentacion.toLocaleDateString(),
359 fechaPresentacion: cheque.fechaPresentacion, 347 fechaPresentacion: cheque.fechaPresentacion,
360 fechaEmision: cheque.fechaEmision, 348 fechaEmision: cheque.fechaEmision,
361 importe: cheque.importe * $scope.cobranza.cotizacion.VENDEDOR, 349 importe: cheque.importe * $scope.cobranza.cotizacion.VENDEDOR,
362 localidad: cheque.localidad, 350 localidad: cheque.localidad,
363 librador: cheque.librador, 351 librador: cheque.librador,
364 provincia: cheque.provincia, 352 provincia: cheque.provincia,
365 observaciones: cheque.observaciones 353 observaciones: cheque.observaciones
366 }; 354 };
367 $scope.cobrosTabla.push(cobro); 355 $scope.cobrosTabla.push(cobro);
368 }, function() { 356 }, function() {
369 357
370 } 358 }
371 ); 359 );
372 }; 360 };
373 361
374 $scope.seleccionarEfectivo = function() { 362 $scope.seleccionarEfectivo = function() {
375 var modalInstance = $uibModal.open( 363 var modalInstance = $uibModal.open(
376 { 364 {
377 ariaLabelledBy: 'Carga de cheques', 365 ariaLabelledBy: 'Carga de cheques',
378 templateUrl: 'modal-efectivo.html', 366 templateUrl: 'modal-efectivo.html',
379 controller: 'focaModalEfectivoController', 367 controller: 'focaModalEfectivoController',
380 size: 'sm', 368 size: 'sm',
381 resolve: { 369 resolve: {
382 sugerido: function() { 370 sugerido: function() {
383 var sugerido = $scope.getTotalDeuda() + $scope.getTotalCobrado(); 371 var sugerido = $scope.getTotalDeuda() + $scope.getTotalCobrado();
384 return sugerido < 0 ? sugerido : null ; 372 return sugerido < 0 ? sugerido : null ;
385 } 373 }
386 } 374 }
387 } 375 }
388 ); 376 );
389 modalInstance.result.then( 377 modalInstance.result.then(
390 function(efectivo) { 378 function(efectivo) {
391 var cobro = { 379 var cobro = {
392 tipo: 'Efectivo', 380 tipo: 'Efectivo',
393 fecha: new Date(), 381 fecha: new Date(),
394 importe: efectivo * $scope.cobranza.cotizacion.VENDEDOR 382 importe: efectivo * $scope.cobranza.cotizacion.VENDEDOR
395 }; 383 };
396 $scope.cobrosTabla = $scope.cobrosTabla.filter(function(a) { 384 $scope.cobrosTabla = $scope.cobrosTabla.filter(function(a) {
397 return a.tipo !== 'Efectivo'; 385 return a.tipo !== 'Efectivo';
398 }); 386 });
399 $scope.cobrosTabla.push(cobro); 387 $scope.cobrosTabla.push(cobro);
400 }, function() { 388 }, function() {
401 389
402 } 390 }
403 ); 391 );
404 }; 392 };
405 393
406 $scope.seleccionarMoneda = function() { 394 $scope.seleccionarMoneda = function() {
407 var modalInstance = $uibModal.open( 395 var modalInstance = $uibModal.open(
408 { 396 {
409 ariaLabelledBy: 'Busqueda de Moneda', 397 ariaLabelledBy: 'Busqueda de Moneda',
410 templateUrl: 'modal-moneda.html', 398 templateUrl: 'modal-moneda.html',
411 controller: 'focaModalMonedaController', 399 controller: 'focaModalMonedaController',
412 size: 'lg' 400 size: 'lg'
413 } 401 }
414 ); 402 );
415 modalInstance.result.then( 403 modalInstance.result.then(
416 function(moneda) { 404 function(moneda) {
417 $scope.seleccionarCotizacion(moneda); 405 $scope.seleccionarCotizacion(moneda);
418 }, function() { 406 }, function() {
419 407
420 } 408 }
421 ); 409 );
422 }; 410 };
423 411
424 $scope.seleccionarCotizacion = function(moneda) { 412 $scope.seleccionarCotizacion = function(moneda) {
425 var modalInstance = $uibModal.open( 413 var modalInstance = $uibModal.open(
426 { 414 {
427 ariaLabelledBy: 'Busqueda de Cotización', 415 ariaLabelledBy: 'Busqueda de Cotización',
428 templateUrl: 'modal-cotizacion.html', 416 templateUrl: 'modal-cotizacion.html',
429 controller: 'focaModalCotizacionController', 417 controller: 'focaModalCotizacionController',
430 size: 'lg', 418 size: 'lg',
431 resolve: {idMoneda: function() {return moneda.ID;}} 419 resolve: {idMoneda: function() {return moneda.ID;}}
432 } 420 }
433 ); 421 );
434 modalInstance.result.then( 422 modalInstance.result.then(
435 function(cotizacion) { 423 function(cotizacion) {
436 $scope.cobranza.moneda = moneda; 424 $scope.cobranza.moneda = moneda;
437 $scope.cobranza.cotizacion = cotizacion; 425 $scope.cobranza.cotizacion = cotizacion;
438 addCabecera('Moneda:', moneda.DETALLE); 426 addCabecera('Moneda:', moneda.DETALLE);
439 addCabecera( 427 addCabecera(
440 'Fecha cotizacion:', 428 'Fecha cotizacion:',
441 $filter('date')(cotizacion.FECHA, 'dd/MM/yyyy') 429 $filter('date')(cotizacion.FECHA, 'dd/MM/yyyy')
442 ); 430 );
443 addCabecera('Cotizacion:', cotizacion.VENDEDOR); 431 addCabecera('Cotizacion:', cotizacion.VENDEDOR);
444 }, function() { 432 }, function() {
445 433
446 } 434 }
447 ); 435 );
448 }; 436 };
449 437
450 $scope.seleccionarCobrador = function() { 438 $scope.seleccionarCobrador = function() {
451 var modalInstance = $uibModal.open( 439 var modalInstance = $uibModal.open(
452 { 440 {
453 ariaLabelledBy: 'Busqueda de Cobradores', 441 ariaLabelledBy: 'Busqueda de Cobradores',
454 templateUrl: 'modal-cobradores.html', 442 templateUrl: 'modal-cobradores.html',
455 controller: 'focaModalCobradoresController', 443 controller: 'focaModalCobradoresController',
456 size: 'lg' 444 size: 'lg'
457 } 445 }
458 ); 446 );
459 modalInstance.result.then( 447 modalInstance.result.then(
460 function(cobrador) { 448 function(cobrador) {
461 addCabecera('Cobrador:', cobrador.nombre); 449 addCabecera('Cobrador:', cobrador.nombre);
462 $scope.cobranza.cobrador = cobrador; 450 $scope.cobranza.cobrador = cobrador;
463 }, function() { 451 }, function() {
464 452
465 } 453 }
466 ); 454 );
467 }; 455 };
468 456
469 $scope.getTotalDeuda = function() { 457 $scope.getTotalDeuda = function() {
470 var total = 0; 458 var total = 0;
471 for (var i = 0; i < $scope.facturaTabla.length; i++) { 459 for (var i = 0; i < $scope.facturaTabla.length; i++) {
472 total += $scope.facturaTabla[i].IPA; 460 total += $scope.facturaTabla[i].IPA;
473 } 461 }
474 return parseFloat(total.toFixed(2)); 462 return parseFloat(total.toFixed(2));
475 }; 463 };
476 464
477 $scope.getTotalCobrado = function() { 465 $scope.getTotalCobrado = function() {
478 var total = 0; 466 var total = 0;
479 for (var i = 0; i < $scope.cobrosTabla.length; i++) { 467 for (var i = 0; i < $scope.cobrosTabla.length; i++) {
480 total += $scope.cobrosTabla[i].importe; 468 total += $scope.cobrosTabla[i].importe;
481 } 469 }
482 return parseFloat(total.toFixed(2)); 470 return parseFloat(total.toFixed(2));
483 }; 471 };
484 472
485 $scope.getSubTotal = function() { 473 $scope.getSubTotal = function() {
486 if($scope.articuloACargar) { 474 if($scope.articuloACargar) {
487 return $scope.articuloACargar.precio * $scope.articuloACargar.cantidad; 475 return $scope.articuloACargar.precio * $scope.articuloACargar.cantidad;
488 } 476 }
489 }; 477 };
490 //Recibe aviso si el teclado está en uso 478 //Recibe aviso si el teclado está en uso
491 // $rootScope.$on('usarTeclado', function(event, data) { 479 // $rootScope.$on('usarTeclado', function(event, data) {
492 // if(data) { 480 // if(data) {
493 // $scope.mostrarTeclado = true; 481 // $scope.mostrarTeclado = true;
494 // return; 482 // return;
495 // } 483 // }
496 // $scope.mostrarTeclado = false; 484 // $scope.mostrarTeclado = false;
497 // }) 485 // })
498 $scope.selectFocus = function($event) { 486 $scope.selectFocus = function($event) {
499 //Si el teclado esta en uso no selecciona el valor 487 //Si el teclado esta en uso no selecciona el valor
500 // if($scope.mostrarTeclado) { 488 // if($scope.mostrarTeclado) {
501 // return; 489 // return;
502 // } 490 // }
503 $event.target.select(); 491 $event.target.select();
504 }; 492 };
505 493
506 $scope.salir = function() { 494 $scope.salir = function() {
507 $location.path('/'); 495 $location.path('/');
508 }; 496 };
509 497
510 $scope.parsearATexto = function(articulo) { 498 $scope.parsearATexto = function(articulo) {
511 articulo.cantidad = parseFloat(articulo.cantidad); 499 articulo.cantidad = parseFloat(articulo.cantidad);
512 articulo.precio = parseFloat(articulo.precio); 500 articulo.precio = parseFloat(articulo.precio);
513 }; 501 };
514 502
515 $scope.rellenar = function(relleno, longitud) { 503 $scope.rellenar = function(relleno, longitud) {
516 relleno = '' + relleno; 504 relleno = '' + relleno;
517 while (relleno.length < longitud) { 505 while (relleno.length < longitud) {
518 relleno = '0' + relleno; 506 relleno = '0' + relleno;
519 } 507 }
520 508
521 return relleno; 509 return relleno;
522 }; 510 };
523 511
524 $scope.quitarFactura = function(key) { 512 $scope.quitarFactura = function(key) {
525 $scope.facturaTabla.splice(key, 1); 513 $scope.facturaTabla.splice(key, 1);
526 }; 514 };
527 515
528 $scope.quitarCobro = function(key) { 516 $scope.quitarCobro = function(key) {
529 $scope.cobrosTabla.splice(key, 1); 517 $scope.cobrosTabla.splice(key, 1);
530 }; 518 };
531 519
532 function addCabecera(label, valor) { 520 function addCabecera(label, valor) {
533 var propiedad = $filter('filter')($scope.cabecera, {label: label}, true); 521 var propiedad = $filter('filter')($scope.cabecera, {label: label}, true);
534 if(propiedad.length === 1) { 522 if(propiedad.length === 1) {
535 propiedad[0].valor = valor; 523 propiedad[0].valor = valor;
536 } else { 524 } else {
537 $scope.cabecera.push({label: label, valor: valor}); 525 $scope.cabecera.push({label: label, valor: valor});
538 } 526 }
539 } 527 }
540 // TODO: descomentar cuando se use 528 // TODO: descomentar cuando se use
541 /*function removeCabecera(label) { 529 /*function removeCabecera(label) {
542 var propiedad = $filter('filter')($scope.cabecera, {label: label}, true); 530 var propiedad = $filter('filter')($scope.cabecera, {label: label}, true);
543 if(propiedad.length === 1){ 531 if(propiedad.length === 1){
544 $scope.cabecera.splice($scope.cabecera.indexOf(propiedad[0]), 1); 532 $scope.cabecera.splice($scope.cabecera.indexOf(propiedad[0]), 1);
545 } 533 }
546 }*/ 534 }*/
547 function setearMonedaPorDefecto() { 535 function setearMonedaPorDefecto() {
548 var monedaPorDefecto; 536 var monedaPorDefecto;
549 //Trabajo con la cotización más reciente, por eso uso siempre la primera '[0]' 537 //Trabajo con la cotización más reciente, por eso uso siempre la primera '[0]'
550 focaCrearCobranzaService.getCotizacionByIdMoneda(1).then(function(res) { 538 focaCrearCobranzaService.getCotizacionByIdMoneda(1).then(function(res) {
551 monedaPorDefecto = res.data[0]; 539 monedaPorDefecto = res.data[0];
552 $scope.cobranza.moneda = monedaPorDefecto; 540 $scope.cobranza.moneda = monedaPorDefecto;
553 $scope.cobranza.cotizacion = monedaPorDefecto.cotizaciones[0]; 541 $scope.cobranza.cotizacion = monedaPorDefecto.cotizaciones[0];
554 }); 542 });
555 } 543 }
556 544
557 function obtenerNumeroComprobante() { 545 function obtenerNumeroComprobante() {
558 focaCrearCobranzaService.getNumeroRecibo().then( 546 focaCrearCobranzaService.getNumeroRecibo().then(
559 function(res) { 547 function(res) {
560 $scope.puntoVenta = $scope.rellenar(res.data.sucursal, 4); 548 $scope.puntoVenta = $scope.rellenar(res.data.sucursal, 4);
561 $scope.comprobante = $scope.rellenar(res.data.numeroRecibo, 8); 549 $scope.comprobante = $scope.rellenar(res.data.numeroRecibo, 8);
562 }, 550 },
563 function(err) { 551 function(err) {
564 focaModalService.alert('La terminal no esta configurada correctamente'); 552 focaModalService.alert('La terminal no esta configurada correctamente');
565 console.info(err); 553 console.info(err);
566 } 554 }
567 ); 555 );
568 } 556 }
569 obtenerNumeroComprobante(); 557 obtenerNumeroComprobante();
570 setearMonedaPorDefecto(); 558 setearMonedaPorDefecto();
571 } 559 }
572 ]); 560 ]);
573 561
1 angular.module('focaCrearCobranza') 1 angular.module('focaCrearCobranza')
2 .service('focaCrearCobranzaService', ['$http', 'API_ENDPOINT', function($http, API_ENDPOINT) { 2 .service('focaCrearCobranzaService', ['$http', 'API_ENDPOINT', function($http, API_ENDPOINT) {
3 return { 3 return {
4 getNumeroRecibo: function() { 4 getNumeroRecibo: function() {
5 return $http.get(API_ENDPOINT.URL + '/recibo/numero-siguiente'); 5 return $http.get(API_ENDPOINT.URL + '/recibo/numero-siguiente');
6 }, 6 },
7 getCotizacionByIdMoneda: function(id) { 7 getCotizacionByIdMoneda: function(id) {
8 return $http.get(API_ENDPOINT.URL + '/moneda/' + id); 8 return $http.get(API_ENDPOINT.URL + '/moneda/' + id);
9 }, 9 },
10 getUsuario: function(idUsuario) { 10 getUsuario: function(idUsuario) {
11 return $http.get(API_ENDPOINT.URL + '/vendedores/obtener/' + idUsuario); 11 return $http.get(API_ENDPOINT.URL + '/vendedores/obtener/' + idUsuario);
12 }, 12 },
13 guardarCobranza: function(cobranza) { 13 guardarCobranza: function(cobranza) {
14 return $http.post(API_ENDPOINT.URL + '/recibo/guardar', cobranza); 14 return $http.post(API_ENDPOINT.URL + '/recibo/guardar', cobranza);
15 },
16 getBotonera: function() {
17 return ['Cliente', 'Cobrador', 'Comprobantes', 'Cobros', 'Moneda'];
15 } 18 }
16 }; 19 };
17 }]); 20 }]);
18 21
src/views/cobranza.html
1 <div class="crear-nota-pedido foca-crear one-row row"> 1 <div class="crear-nota-pedido foca-crear one-row row">
2 <form name="formCrearNota" ng-submit="crearNotaPedido()" class="mb-0 col-lg-12"> 2 <form name="formCrearNota" ng-submit="crearNotaPedido()" 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 nota-pedido border border-left-0 border-white align-middle"> 8 <div class="col-12 col-sm-3 nota-pedido border border-left-0 border-white align-middle">
9 <h5 class="mb-0">RECIBO DE COBRANZA</h5> 9 <h5 class="mb-0">RECIBO DE COBRANZA</h5>
10 </div> 10 </div>
11 <div class="col-12 col-sm-3 numero-pedido text-center text-md-left border border-white align-middle" 11 <div class="col-12 col-sm-3 numero-pedido text-center text-md-left border border-white align-middle"
12 >Nº {{puntoVenta}}-{{comprobante}} 12 >Nº {{puntoVenta}}-{{comprobante}}
13 <button 13 <button
14 class="btn btn-xs btn-outline-light float-right" 14 class="btn btn-xs btn-outline-light float-right"
15 type="button" 15 type="button"
16 ng-click="seleccionarCobranza()" 16 ng-click="seleccionarCobranza()"
17 > 17 >
18 <i class="fa fa-search"></i> 18 <i class="fa fa-search"></i>
19 </button> 19 </button>
20 </div> 20 </div>
21 <div class="col-7 col-sm-3 border border-white align-middle"> 21 <div class="col-7 col-sm-3 border border-white align-middle">
22 Fecha: 22 Fecha:
23 <span 23 <span
24 ng-show="!datepickerAbierto" 24 ng-show="!datepickerAbierto"
25 ng-bind="fecha | date:'dd/MM/yyyy'" 25 ng-bind="fecha | date:'dd/MM/yyyy'"
26 ng-click="datepickerAbierto = true" 26 ng-click="datepickerAbierto = true"
27 > 27 >
28 </span> 28 </span>
29 <input 29 <input
30 ng-show="datepickerAbierto" 30 ng-show="datepickerAbierto"
31 type="date" 31 type="date"
32 ng-model="fecha" 32 ng-model="fecha"
33 ng-change="datepickerAbierto = false" 33 ng-change="datepickerAbierto = false"
34 ng-blur="datepickerAbierto = false" 34 ng-blur="datepickerAbierto = false"
35 class="form-control form-control-sm col-8 float-right" 35 class="form-control form-control-sm col-8 float-right"
36 foca-focus="datepickerAbierto" 36 foca-focus="datepickerAbierto"
37 hasta-hoy 37 hasta-hoy
38 /> 38 />
39 </div> 39 </div>
40 <div class="col-5 col-sm-3 border border-white border-right-0 align-middle"> 40 <div class="col-5 col-sm-3 border border-white border-right-0 align-middle">
41 Hora: 41 Hora:
42 <span 42 <span
43 ng-show="!datepickerAbierto" 43 ng-show="!datepickerAbierto"
44 ng-bind="fecha | date:'HH:mm'" 44 ng-bind="fecha | date:'HH:mm'"
45 ng-click="datepickerAbierto = true" 45 ng-click="datepickerAbierto = true"
46 > 46 >
47 </span> 47 </span>
48 </div> 48 </div>
49 </div> 49 </div>
50 <div class="row py-2"> 50 <div class="row py-2">
51 <div class="col-auto" ng-repeat="cab in cabecera" ng-show="showCabecera"> 51 <div class="col-auto" ng-repeat="cab in cabecera" ng-show="showCabecera">
52 <span class="label" ng-bind="cab.label"></span> 52 <span class="label" ng-bind="cab.label"></span>
53 <span class="valor" ng-bind="cab.valor"></span> 53 <span class="valor" ng-bind="cab.valor"></span>
54 </div> 54 </div>
55 <a 55 <a
56 class="btn col-12 btn-secondary d-sm-none" 56 class="btn col-12 btn-secondary d-sm-none"
57 ng-show="cabecera.length > 0" 57 ng-show="cabecera.length > 0"
58 ng-click="showCabecera = !showCabecera" 58 ng-click="showCabecera = !showCabecera"
59 > 59 >
60 <i 60 <i
61 class="fa fa-chevron-down" 61 class="fa fa-chevron-down"
62 ng-hide="showCabecera" 62 ng-hide="showCabecera"
63 aria-hidden="true" 63 aria-hidden="true"
64 > 64 >
65 </i> 65 </i>
66 <i 66 <i
67 class="fa fa-chevron-up" 67 class="fa fa-chevron-up"
68 ng-show="showCabecera" 68 ng-show="showCabecera"
69 aria-hidden="true"> 69 aria-hidden="true">
70 </i> 70 </i>
71 </a> 71 </a>
72 </div> 72 </div>
73 </div> 73 </div>
74 </div> 74 </div>
75 </div> 75 </div>
76 </div> 76 </div>
77 </form> 77 </form>
78 <div class="col-lg-12"> 78 <div class="col-lg-12">
79 <div class="row mt-4"> 79 <div class="row mt-4">
80 <div class="col-12 col-md-10 border border-light rounded"> 80 <div class="col-12 col-md-10 border border-light rounded">
81 <div class="row px-5 py-2 botonera-secundaria"> 81 <div class="row px-5 py-2 botonera-secundaria">
82 <div class="col-12"> 82 <div class="col-12">
83 <div class="row"> 83 <foca-botonera-facturador botones="botonera" extra="1" class="row"></foca-botonera-facturador>
84 <div
85 class="col-6 col-sm-2 px-1 py-1 m-auto m-md-0"
86 ng-repeat="boton in botonera"
87 ng-class="{'d-none d-md-grid': boton.texto == ''}">
88 <button
89 type="button"
90 class="btn btn-default btn-block btn-xs text-center py-1 rounded border border-light"
91 ng-click="boton.accion()"
92 ng-class="{'d-sm-block h-100': boton.texto == ''}"
93 >
94 <img src="{{boton.imagen}}" alt="" ng-if="boton.imagen">
95 <span>{{boton.texto}}</span>
96 </button>
97 </div>
98 </div>
99 </div> 84 </div>
100 </div> 85 </div>
101 <!-- PC --> 86 <!-- PC -->
102 <div class="row grilla-articulo align-items-end d-none d-sm-flex" ng-show="cobroDeuda"> 87 <div class="row grilla-articulo align-items-end d-none d-sm-flex" ng-show="cobroDeuda">
103 <table class="table tabla-articulo table-striped table-sm mb-0 rounded-bottom"> 88 <table class="table tabla-articulo table-striped table-sm mb-0 rounded-bottom">
104 <thead> 89 <thead>
105 <tr class="d-flex"> 90 <tr class="d-flex">
106 <th class="col-auto">#</th> 91 <th class="col-auto">#</th>
107 <th class="col">Comprobante</th> 92 <th class="col">Comprobante</th>
108 <th class="col">Fecha</th> 93 <th class="col">Fecha</th>
109 <th class="col">Importe</th> 94 <th class="col">Importe</th>
110 <th class="col-auto"> 95 <th class="col-auto">
111 <button 96 <button
112 class="btn btn-outline-secondary selectable" 97 class="btn btn-outline-secondary selectable"
113 ng-click="show = !show; masMenos()" 98 ng-click="show = !show; masMenos()"
114 > 99 >
115 <i 100 <i
116 class="fa fa-chevron-down" 101 class="fa fa-chevron-down"
117 ng-show="show" 102 ng-show="show"
118 aria-hidden="true" 103 aria-hidden="true"
119 > 104 >
120 </i> 105 </i>
121 <i 106 <i
122 class="fa fa-chevron-up" 107 class="fa fa-chevron-up"
123 ng-hide="show" 108 ng-hide="show"
124 aria-hidden="true"> 109 aria-hidden="true">
125 </i> 110 </i>
126 </button> 111 </button>
127 </th> 112 </th>
128 </th> 113 </th>
129 </tr> 114 </tr>
130 </thead> 115 </thead>
131 <tbody class="tabla-articulo-body"> 116 <tbody class="tabla-articulo-body">
132 <tr 117 <tr
133 ng-repeat="(key, factura) in facturaTabla" 118 ng-repeat="(key, factura) in facturaTabla"
134 class="d-flex" 119 class="d-flex"
135 ng-show="show || key == facturaTabla.length - 1" 120 ng-show="show || key == facturaTabla.length - 1"
136 > 121 >
137 <td ng-bind="key + 1" class="col-auto"></td> 122 <td ng-bind="key + 1" class="col-auto"></td>
138 <td class="col" ng-bind="factura.numeroFactura" 123 <td class="col" ng-bind="factura.numeroFactura"
139 ></td> 124 ></td>
140 <td class="col" ng-bind="factura.FEP | date : 'dd/MM/yyyy'"></td> 125 <td class="col" ng-bind="factura.FEP | date : 'dd/MM/yyyy'"></td>
141 <td 126 <td
142 class="col" 127 class="col"
143 ng-bind="(factura.IPA / cobranza.cotizacion.VENDEDOR) | 128 ng-bind="(factura.IPA / cobranza.cotizacion.VENDEDOR) |
144 currency: cobranza.moneda.SIMBOLO : 4"></td> 129 currency: cobranza.moneda.SIMBOLO : 4"></td>
145 <td class="text-center col-auto"> 130 <td class="text-center col-auto">
146 <button 131 <button
147 class="btn btn-outline-secondary" 132 class="btn btn-outline-secondary"
148 ng-click="quitarFactura(key)" 133 ng-click="quitarFactura(key)"
149 > 134 >
150 <i class="fa fa-trash"></i> 135 <i class="fa fa-trash"></i>
151 </button> 136 </button>
152 </td> 137 </td>
153 </tr> 138 </tr>
154 </tbody> 139 </tbody>
155 <tfoot> 140 <tfoot>
156 <tr ng-show="cargando" class="d-flex"> 141 <tr ng-show="cargando" class="d-flex">
157 <td class="col-2 border-top-0"> 142 <td class="col-2 border-top-0">
158 <a 143 <a
159 class="form-control form-control-sm btn btn-secondary" 144 class="form-control form-control-sm btn btn-secondary"
160 ng-click="seleccionarFactura()" 145 ng-click="seleccionarFactura()"
161 >Pendientes</a> 146 >Pendientes</a>
162 </td> 147 </td>
163 </tr> 148 </tr>
164 <tr class="d-flex"> 149 <tr class="d-flex">
165 <td class="col-auto px-1 border-top-0"> 150 <td class="col-auto px-1 border-top-0">
166 <strong>Comprobantes:</strong> 151 <strong>Comprobantes:</strong>
167 <a ng-bind="facturaTabla.length"></a> 152 <a ng-bind="facturaTabla.length"></a>
168 </td> 153 </td>
169 <td class="text-right ml-auto table-celda-total no-border-top"> 154 <td class="text-right ml-auto table-celda-total no-border-top">
170 <strong>Cancela:</strong> 155 <strong>Cancela:</strong>
171 </td> 156 </td>
172 <td class="table-celda-total text-right no-border-top"> 157 <td class="table-celda-total text-right no-border-top">
173 <strong>{{(getTotalDeuda() / cobranza.cotizacion.VENDEDOR) | 158 <strong>{{(getTotalDeuda() / cobranza.cotizacion.VENDEDOR) |
174 currency: cobranza.moneda.SIMBOLO}}</strong> 159 currency: cobranza.moneda.SIMBOLO}}</strong>
175 </td> 160 </td>
176 <td class="text-right ml-auto table-celda-total no-border-top"> 161 <td class="text-right ml-auto table-celda-total no-border-top">
177 <strong>Total Cobrado:</strong> 162 <strong>Total Cobrado:</strong>
178 </td> 163 </td>
179 <td class="table-celda-total text-right no-border-top"> 164 <td class="table-celda-total text-right no-border-top">
180 <strong>{{(getTotalCobrado() / cobranza.cotizacion.VENDEDOR) | 165 <strong>{{(getTotalCobrado() / cobranza.cotizacion.VENDEDOR) |
181 currency: cobranza.moneda.SIMBOLO}}</strong> 166 currency: cobranza.moneda.SIMBOLO}}</strong>
182 </td> 167 </td>
183 <td class="text-right ml-auto table-celda-total no-border-top"> 168 <td class="text-right ml-auto table-celda-total no-border-top">
184 <strong>DF:</strong> 169 <strong>DF:</strong>
185 </td> 170 </td>
186 <td class="table-celda-total text-right no-border-top mr-1"> 171 <td class="table-celda-total text-right no-border-top mr-1">
187 <strong>{{((getTotalCobrado() + getTotalDeuda()) / 172 <strong>{{((getTotalCobrado() + getTotalDeuda()) /
188 cobranza.cotizacion.VENDEDOR) | currency: cobranza.moneda.SIMBOLO}} 173 cobranza.cotizacion.VENDEDOR) | currency: cobranza.moneda.SIMBOLO}}
189 </strong> 174 </strong>
190 </td> 175 </td>
191 </tr> 176 </tr>
192 </tfoot> 177 </tfoot>
193 </table> 178 </table>
194 </div> 179 </div>
195 <div class="row grilla-articulo align-items-end d-none d-sm-flex" ng-show="!cobroDeuda"> 180 <div class="row grilla-articulo align-items-end d-none d-sm-flex" ng-show="!cobroDeuda">
196 <table class="table tabla-articulo table-striped table-sm mb-0 rounded-bottom"> 181 <table class="table tabla-articulo table-striped table-sm mb-0 rounded-bottom">
197 <thead> 182 <thead>
198 <tr class="d-flex"> 183 <tr class="d-flex">
199 <th class="col-auto">#</th> 184 <th class="col-auto">#</th>
200 <th class="col">Cobro</th> 185 <th class="col">Cobro</th>
201 <th class="col">Fecha</th> 186 <th class="col">Fecha</th>
202 <th class="col">Importe</th> 187 <th class="col">Importe</th>
203 <th class="col-auto"> 188 <th class="col-auto">
204 <button 189 <button
205 class="btn btn-outline-secondary selectable" 190 class="btn btn-outline-secondary selectable"
206 ng-click="show = !show; masMenos()" 191 ng-click="show = !show; masMenos()"
207 > 192 >
208 <i 193 <i
209 class="fa fa-chevron-down" 194 class="fa fa-chevron-down"
210 ng-show="show" 195 ng-show="show"
211 aria-hidden="true" 196 aria-hidden="true"
212 > 197 >
213 </i> 198 </i>
214 <i 199 <i
215 class="fa fa-chevron-up" 200 class="fa fa-chevron-up"
216 ng-hide="show" 201 ng-hide="show"
217 aria-hidden="true"> 202 aria-hidden="true">
218 </i> 203 </i>
219 </button> 204 </button>
220 </th> 205 </th>
221 </th> 206 </th>
222 </tr> 207 </tr>
223 </thead> 208 </thead>
224 <tbody class="tabla-articulo-body"> 209 <tbody class="tabla-articulo-body">
225 <tr 210 <tr
226 ng-repeat="(key, cobro) in cobrosTabla" 211 ng-repeat="(key, cobro) in cobrosTabla"
227 class="d-flex" 212 class="d-flex"
228 ng-show="show || key == cobrosTabla.length - 1" 213 ng-show="show || key == cobrosTabla.length - 1"
229 > 214 >
230 <td ng-bind="key + 1" class="col-auto"></td> 215 <td ng-bind="key + 1" class="col-auto"></td>
231 <td class="col" ng-bind="cobro.tipo"></td> 216 <td class="col" ng-bind="cobro.tipo"></td>
232 <td class="col" ng-bind="cobro.fecha | date : 'dd/MM/yyyy'"></td> 217 <td class="col" ng-bind="cobro.fecha | date : 'dd/MM/yyyy'"></td>
233 <td 218 <td
234 class="col" 219 class="col"
235 ng-bind="(cobro.importe / cobranza.cotizacion.VENDEDOR) | 220 ng-bind="(cobro.importe / cobranza.cotizacion.VENDEDOR) |
236 currency: cobranza.moneda.SIMBOLO : 4"></td> 221 currency: cobranza.moneda.SIMBOLO : 4"></td>
237 <td class="text-center col-auto"> 222 <td class="text-center col-auto">
238 <button 223 <button
239 class="btn btn-outline-secondary" 224 class="btn btn-outline-secondary"
240 ng-click="quitarCobro(key)" 225 ng-click="quitarCobro(key)"
241 > 226 >
242 <i class="fa fa-trash"></i> 227 <i class="fa fa-trash"></i>
243 </button> 228 </button>
244 </td> 229 </td>
245 </tr> 230 </tr>
246 </tbody> 231 </tbody>
247 <tfoot> 232 <tfoot>
248 <tr ng-show="cargando" class="d-flex"> 233 <tr ng-show="cargando" class="d-flex">
249 <td class="col-2 border-top-0"> 234 <td class="col-2 border-top-0">
250 <a 235 <a
251 class="form-control form-control-sm btn btn-secondary" 236 class="form-control form-control-sm btn btn-secondary"
252 ng-click="seleccionarCheque()" 237 ng-click="seleccionarCheque()"
253 >Cheque</a> 238 >Cheque</a>
254 </td> 239 </td>
255 <td class="col-2 border-top-0"> 240 <td class="col-2 border-top-0">
256 <a 241 <a
257 class="form-control form-control-sm btn btn-secondary" 242 class="form-control form-control-sm btn btn-secondary"
258 ng-click="seleccionarEfectivo()" 243 ng-click="seleccionarEfectivo()"
259 >Efectivo</a> 244 >Efectivo</a>
260 </td> 245 </td>
261 </tr> 246 </tr>
262 <tr class="d-flex"> 247 <tr class="d-flex">
263 <td class="col-auto px-1 border-top-0"> 248 <td class="col-auto px-1 border-top-0">
264 <strong>Cobros:</strong> 249 <strong>Cobros:</strong>
265 <a ng-bind="cobrosTabla.length"></a> 250 <a ng-bind="cobrosTabla.length"></a>
266 </td> 251 </td>
267 <td class="text-right ml-auto table-celda-total no-border-top"> 252 <td class="text-right ml-auto table-celda-total no-border-top">
268 <strong>Cancela:</strong> 253 <strong>Cancela:</strong>
269 </td> 254 </td>
270 <td class="table-celda-total text-right no-border-top"> 255 <td class="table-celda-total text-right no-border-top">
271 <strong>{{(getTotalDeuda() / cobranza.cotizacion.VENDEDOR) | 256 <strong>{{(getTotalDeuda() / cobranza.cotizacion.VENDEDOR) |
272 currency: cobranza.moneda.SIMBOLO}}</strong> 257 currency: cobranza.moneda.SIMBOLO}}</strong>
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 <strong>Total Cobrado:</strong> 260 <strong>Total Cobrado:</strong>
276 </td> 261 </td>
277 <td class="table-celda-total text-right no-border-top"> 262 <td class="table-celda-total text-right no-border-top">
278 <strong>{{(getTotalCobrado() / cobranza.cotizacion.VENDEDOR) | 263 <strong>{{(getTotalCobrado() / cobranza.cotizacion.VENDEDOR) |
279 currency: cobranza.moneda.SIMBOLO}}</strong> 264 currency: cobranza.moneda.SIMBOLO}}</strong>
280 </td> 265 </td>
281 <td class="text-right ml-auto table-celda-total no-border-top"> 266 <td class="text-right ml-auto table-celda-total no-border-top">
282 <strong>DF:</strong> 267 <strong>DF:</strong>
283 </td> 268 </td>
284 <td class="table-celda-total text-right no-border-top mr-1"> 269 <td class="table-celda-total text-right no-border-top mr-1">
285 <strong>{{((getTotalCobrado() + getTotalDeuda()) / 270 <strong>{{((getTotalCobrado() + getTotalDeuda()) /
286 cobranza.cotizacion.VENDEDOR) | currency: cobranza.moneda.SIMBOLO}} 271 cobranza.cotizacion.VENDEDOR) | currency: cobranza.moneda.SIMBOLO}}
287 </strong> 272 </strong>
288 </td> 273 </td>
289 </tr> 274 </tr>
290 </tfoot> 275 </tfoot>
291 </table> 276 </table>
292 </div> 277 </div>
293 <!-- MOBILE --> 278 <!-- MOBILE -->
294 <div class="row d-sm-none mb-5"> 279 <div class="row d-sm-none mb-5">
295 <!-- FACTURAS --> 280 <!-- FACTURAS -->
296 <table class="table table-sm table-striped table-dark mb-5" ng-show="cobroDeuda"> 281 <table class="table table-sm table-striped table-dark mb-5" ng-show="cobroDeuda">
297 <thead> 282 <thead>
298 <tr class="d-flex"> 283 <tr class="d-flex">
299 <th class="">#</th> 284 <th class="">#</th>
300 <th class="col px-0"> 285 <th class="col px-0">
301 <div class="d-flex"> 286 <div class="d-flex">
302 <div class="col-4 px-1">Factura</div> 287 <div class="col-4 px-1">Factura</div>
303 <div class="col-4 px-1">Fecha</div> 288 <div class="col-4 px-1">Fecha</div>
304 <div class="col-4 px-1">Importe</div> 289 <div class="col-4 px-1">Importe</div>
305 </div> 290 </div>
306 </th> 291 </th>
307 <th class="text-center tamaño-boton"> 292 <th class="text-center tamaño-boton">
308 &nbsp; 293 &nbsp;
309 </th> 294 </th>
310 </tr> 295 </tr>
311 </thead> 296 </thead>
312 <tbody> 297 <tbody>
313 <tr 298 <tr
314 ng-repeat="(key, factura) in facturaTabla" 299 ng-repeat="(key, factura) in facturaTabla"
315 ng-show="show || key == facturaTabla.length - 1" 300 ng-show="show || key == facturaTabla.length - 1"
316 > 301 >
317 <td class="w-100 align-middle d-flex p-0"> 302 <td class="w-100 align-middle d-flex p-0">
318 <div class="align-middle p-1"> 303 <div class="align-middle p-1">
319 <span ng-bind="key+1" class="align-middle"></span> 304 <span ng-bind="key+1" class="align-middle"></span>
320 </div> 305 </div>
321 <div class="col px-0"> 306 <div class="col px-0">
322 <div class="d-flex"> 307 <div class="d-flex">
323 <div class="col-4 px-1"> 308 <div class="col-4 px-1">
324 <span ng-bind="factura.numeroFactura" 309 <span ng-bind="factura.numeroFactura"
325 ></span> 310 ></span>
326 </div> 311 </div>
327 <div class="col-4 px-1"> 312 <div class="col-4 px-1">
328 <span ng-bind="factura.FEP | date : 'dd/MM/yyyy'"></span> 313 <span ng-bind="factura.FEP | date : 'dd/MM/yyyy'"></span>
329 </div> 314 </div>
330 <div class="col-4 px-1"> 315 <div class="col-4 px-1">
331 <span 316 <span
332 ng-bind="(factura.IPA / cobranza.cotizacion.VENDEDOR) | 317 ng-bind="(factura.IPA / cobranza.cotizacion.VENDEDOR) |
333 currency:cobranza.moneda.SIMBOLO : 4"></span> 318 currency:cobranza.moneda.SIMBOLO : 4"></span>
334 </div> 319 </div>
335 </div> 320 </div>
336 </div> 321 </div>
337 <div class="align-middle p-1"> 322 <div class="align-middle p-1">
338 <button 323 <button
339 class="btn btn-outline-secondary" 324 class="btn btn-outline-secondary"
340 ng-click="quitarFactura(key)" 325 ng-click="quitarFactura(key)"
341 > 326 >
342 <i class="fa fa-trash"></i> 327 <i class="fa fa-trash"></i>
343 </button> 328 </button>
344 </div> 329 </div>
345 </td> 330 </td>
346 </tr> 331 </tr>
347 </tbody> 332 </tbody>
348 <tfoot> 333 <tfoot>
349 <!-- SELECCIONAR PRODUCTO --> 334 <!-- SELECCIONAR PRODUCTO -->
350 <tr ng-show="cargando" class="d-flex"> 335 <tr ng-show="cargando" class="d-flex">
351 <td class="col-12"> 336 <td class="col-12">
352 <input 337 <input
353 placeholder="Seleccione Factura" 338 placeholder="Seleccione Factura"
354 class="form-control form-control-sm" 339 class="form-control form-control-sm"
355 readonly 340 readonly
356 ng-click="seleccionarFactura()" 341 ng-click="seleccionarFactura()"
357 /> 342 />
358 </td> 343 </td>
359 </tr> 344 </tr>
360 <!-- TOOGLE EXPANDIR --> 345 <!-- TOOGLE EXPANDIR -->
361 <tr> 346 <tr>
362 <td class="col"> 347 <td class="col">
363 <button 348 <button
364 class="btn btn-outline-secondary selectable w-100" 349 class="btn btn-outline-secondary selectable w-100"
365 ng-click="show = !show; masMenos()" 350 ng-click="show = !show; masMenos()"
366 ng-show="facturaTabla.length > 0" 351 ng-show="facturaTabla.length > 0"
367 > 352 >
368 <i 353 <i
369 class="fa fa-chevron-down" 354 class="fa fa-chevron-down"
370 ng-hide="show" 355 ng-hide="show"
371 aria-hidden="true" 356 aria-hidden="true"
372 > 357 >
373 </i> 358 </i>
374 <i 359 <i
375 class="fa fa-chevron-up" 360 class="fa fa-chevron-up"
376 ng-show="show" 361 ng-show="show"
377 aria-hidden="true"> 362 aria-hidden="true">
378 </i> 363 </i>
379 </button> 364 </button>
380 </td> 365 </td>
381 </tr> 366 </tr>
382 <!-- FOOTER --> 367 <!-- FOOTER -->
383 <tr class="d-flex"> 368 <tr class="d-flex">
384 <td class="align-middle no-border-top" colspan="2"> 369 <td class="align-middle no-border-top" colspan="2">
385 <strong>Cantidad Items:</strong> 370 <strong>Cantidad Items:</strong>
386 <a ng-bind="facturaTabla.length"></a> 371 <a ng-bind="facturaTabla.length"></a>
387 </td> 372 </td>
388 </tr> 373 </tr>
389 </tfoot> 374 </tfoot>
390 </table> 375 </table>
391 <!-- COBROS --> 376 <!-- COBROS -->
392 <table class="table table-sm table-striped table-dark mb-5" ng-show="!cobroDeuda"> 377 <table class="table table-sm table-striped table-dark mb-5" ng-show="!cobroDeuda">
393 <thead> 378 <thead>
394 <tr class="d-flex"> 379 <tr class="d-flex">
395 <th class="">#</th> 380 <th class="">#</th>
396 <th class="col px-0"> 381 <th class="col px-0">
397 <div class="d-flex"> 382 <div class="d-flex">
398 <div class="col-4 px-1">Cobro</div> 383 <div class="col-4 px-1">Cobro</div>
399 <div class="col-4 px-1">Fecha</div> 384 <div class="col-4 px-1">Fecha</div>
400 <div class="col-4 px-1">Importe</div> 385 <div class="col-4 px-1">Importe</div>
401 </div> 386 </div>
402 </th> 387 </th>
403 <th class="text-center tamaño-boton"> 388 <th class="text-center tamaño-boton">
404 &nbsp; 389 &nbsp;
405 </th> 390 </th>
406 </tr> 391 </tr>
407 </thead> 392 </thead>
408 <tbody> 393 <tbody>
409 <tr 394 <tr
410 ng-repeat="(key, cobro) in cobrosTabla" 395 ng-repeat="(key, cobro) in cobrosTabla"
411 ng-show="show || key == cobrosTabla.length - 1" 396 ng-show="show || key == cobrosTabla.length - 1"
412 > 397 >
413 <td class="w-100 align-middle d-flex p-0"> 398 <td class="w-100 align-middle d-flex p-0">
414 <div class="align-middle p-1"> 399 <div class="align-middle p-1">
415 <span ng-bind="key+1" class="align-middle"></span> 400 <span ng-bind="key+1" class="align-middle"></span>
416 </div> 401 </div>
417 <div class="col px-0"> 402 <div class="col px-0">
418 <div class="d-flex"> 403 <div class="d-flex">
419 <div class="col-4 px-1"> 404 <div class="col-4 px-1">
420 <span ng-bind="cobro.tipo" 405 <span ng-bind="cobro.tipo"
421 ></span> 406 ></span>
422 </div> 407 </div>
423 <div class="col-4 px-1"> 408 <div class="col-4 px-1">
424 <span ng-bind="cobro.fecha | date : 'dd/MM/yyyy'"></span> 409 <span ng-bind="cobro.fecha | date : 'dd/MM/yyyy'"></span>
425 </div> 410 </div>
426 <div class="col-4 px-1"> 411 <div class="col-4 px-1">
427 <span 412 <span
428 ng-bind="(cobro.importe / cobranza.cotizacion.VENDEDOR) | 413 ng-bind="(cobro.importe / cobranza.cotizacion.VENDEDOR) |
429 currency: cobranza.moneda.SIMBOLO : 4"></span> 414 currency: cobranza.moneda.SIMBOLO : 4"></span>
430 </div> 415 </div>
431 </div> 416 </div>
432 </div> 417 </div>
433 <div class="align-middle p-1"> 418 <div class="align-middle p-1">
434 <button 419 <button
435 class="btn btn-outline-secondary" 420 class="btn btn-outline-secondary"
436 ng-click="quitarCobro(key)" 421 ng-click="quitarCobro(key)"
437 > 422 >
438 <i class="fa fa-trash"></i> 423 <i class="fa fa-trash"></i>
439 </button> 424 </button>
440 </div> 425 </div>
441 </td> 426 </td>
442 </tr> 427 </tr>
443 </tbody> 428 </tbody>
444 <tfoot> 429 <tfoot>
445 <!-- SELECCIONAR PRODUCTO --> 430 <!-- SELECCIONAR PRODUCTO -->
446 <tr ng-show="cargando" class="d-flex"> 431 <tr ng-show="cargando" class="d-flex">
447 <td class="col-6"> 432 <td class="col-6">
448 <input 433 <input
449 placeholder="Cheque" 434 placeholder="Cheque"
450 class="form-control form-control-sm" 435 class="form-control form-control-sm"
451 readonly 436 readonly
452 ng-click="seleccionarCheque()" 437 ng-click="seleccionarCheque()"
453 /> 438 />
454 </td> 439 </td>
455 <td class="col-6"> 440 <td class="col-6">
456 <input 441 <input
457 placeholder="Efectivo" 442 placeholder="Efectivo"
458 class="form-control form-control-sm" 443 class="form-control form-control-sm"
459 readonly 444 readonly
460 ng-click="seleccionarEfectivo()" 445 ng-click="seleccionarEfectivo()"
461 /> 446 />
462 </td> 447 </td>
463 </tr> 448 </tr>
464 <!-- TOOGLE EXPANDIR --> 449 <!-- TOOGLE EXPANDIR -->
465 <tr> 450 <tr>
466 <td class="col"> 451 <td class="col">
467 <button 452 <button
468 class="btn btn-outline-secondary selectable w-100" 453 class="btn btn-outline-secondary selectable w-100"
469 ng-click="show = !show; masMenos()" 454 ng-click="show = !show; masMenos()"
470 ng-show="cobrosTabla.length > 0" 455 ng-show="cobrosTabla.length > 0"
471 > 456 >
472 <i 457 <i
473 class="fa fa-chevron-down" 458 class="fa fa-chevron-down"
474 ng-hide="show" 459 ng-hide="show"
475 aria-hidden="true" 460 aria-hidden="true"
476 > 461 >
477 </i> 462 </i>
478 <i 463 <i
479 class="fa fa-chevron-up" 464 class="fa fa-chevron-up"
480 ng-show="show" 465 ng-show="show"
481 aria-hidden="true"> 466 aria-hidden="true">
482 </i> 467 </i>
483 </button> 468 </button>
484 </td> 469 </td>
485 </tr> 470 </tr>
486 <!-- FOOTER --> 471 <!-- FOOTER -->
487 <tr class="d-flex"> 472 <tr class="d-flex">
488 <td class="align-middle no-border-top col-6"> 473 <td class="align-middle no-border-top col-6">
489 <strong>Cantidad Items:</strong> 474 <strong>Cantidad Items:</strong>
490 <a ng-bind="cobrosTabla.length"></a> 475 <a ng-bind="cobrosTabla.length"></a>
491 </td> 476 </td>
492 </tfoot> 477 </tfoot>
493 </table> 478 </table>
494 </tr> 479 </tr>
495 <!-- DEUDA, COBRADO, DIFERENCIA --> 480 <!-- DEUDA, COBRADO, DIFERENCIA -->
496 <table class="table-responsive fixed-bottom mb-5"> 481 <table class="table-responsive fixed-bottom mb-5">
497 <tr class="d-flex row"> 482 <tr class="d-flex row">
498 <td class="text-center ml-auto table-celda-total no-border-top col-4"> 483 <td class="text-center ml-auto table-celda-total no-border-top col-4">
499 <strong>Cancela:</strong> 484 <strong>Cancela:</strong>
500 </td> 485 </td>
501 <td class="text-center ml-auto table-celda-total no-border-top col-4"> 486 <td class="text-center ml-auto table-celda-total no-border-top col-4">
502 <strong>Cobrado:</strong> 487 <strong>Cobrado:</strong>
503 </td> 488 </td>
504 <td class="text-center ml-auto table-celda-total no-border-top col-4"> 489 <td class="text-center ml-auto table-celda-total no-border-top col-4">
505 <strong>Diferencia:</strong> 490 <strong>Diferencia:</strong>
506 </td> 491 </td>
507 <td class="table-celda-total text-center no-border-top col-4"> 492 <td class="table-celda-total text-center no-border-top col-4">
508 <strong>{{(getTotalDeuda() / cobranza.cotizacion.VENDEDOR) | currency: cobranza.moneda.SIMBOLO}}</strong> 493 <strong>{{(getTotalDeuda() / cobranza.cotizacion.VENDEDOR) | currency: cobranza.moneda.SIMBOLO}}</strong>
509 </td> 494 </td>
510 <td class="table-celda-total text-center no-border-top col-4"> 495 <td class="table-celda-total text-center no-border-top col-4">
511 <strong>{{(getTotalCobrado() / cobranza.cotizacion.VENDEDOR) | currency: cobranza.moneda.SIMBOLO}}</strong> 496 <strong>{{(getTotalCobrado() / cobranza.cotizacion.VENDEDOR) | currency: cobranza.moneda.SIMBOLO}}</strong>
512 </td> 497 </td>
513 <td class="table-celda-total text-center no-border-top col-4"> 498 <td class="table-celda-total text-center no-border-top col-4">
514 <strong>{{((getTotalCobrado() + getTotalDeuda()) / cobranza.cotizacion.VENDEDOR) | currency: cobranza.moneda.SIMBOLO}}</strong> 499 <strong>{{((getTotalCobrado() + getTotalDeuda()) / cobranza.cotizacion.VENDEDOR) | currency: cobranza.moneda.SIMBOLO}}</strong>
515 </td> 500 </td>
516 </tr> 501 </tr>
517 </table> 502 </table>
518 </div> 503 </div>
519 </div> 504 </div>
520 <div class="col-auto my-2 col-lg-2 botonera-lateral d-none d-md-block"> 505 <div class="col-auto my-2 col-lg-2 botonera-lateral d-none d-md-block">
521 <div class="col-12 mt-auto"> 506 <div class="col-12 mt-auto">
522 <button 507 <button
523 ng-click="crearCobranza()" 508 ng-click="crearCobranza()"
524 title="Crear nota pedido" 509 title="Crear nota pedido"
525 class="btn btn-default btn-block mb-2 border border-dark" 510 class="btn btn-default btn-block mb-2 border border-dark"
526 ng-disabled="editando || saveLoading" 511 ng-disabled="editando || saveLoading"
527 > 512 >
528 <strong>GUARDAR</strong> 513 <strong>GUARDAR</strong>
529 </button> 514 </button>
530 <button 515 <button
531 type="button" 516 type="button"
532 title="Salir" 517 title="Salir"
533 class="btn btn-default btn-block border border-dark"> 518 class="btn btn-default btn-block border border-dark">
534 <strong>PAUSAR</strong> 519 <strong>PAUSAR</strong>
535 </button> 520 </button>
536 <button 521 <button
537 ng-click="salir()" 522 ng-click="salir()"
538 type="button" 523 type="button"
539 title="Salir" 524 title="Salir"
540 class="btn btn-default btn-block border border-dark"> 525 class="btn btn-default btn-block border border-dark">
541 <strong>SALIR</strong> 526 <strong>SALIR</strong>
542 </button> 527 </button>
543 </div> 528 </div>
544 </div> 529 </div>
545 </div> 530 </div>
546 </div> 531 </div>
547 <div class="row d-md-none fixed-bottom"> 532 <div class="row d-md-none fixed-bottom">
548 <div class="w-100 bg-dark d-flex px-3 acciones-mobile"> 533 <div class="w-100 bg-dark d-flex px-3 acciones-mobile">
549 <span class="ml-3 text-muted" ng-click="salir()">Salir</span> 534 <span class="ml-3 text-muted" ng-click="salir()">Salir</span>
550 <span 535 <span
551 class="mr-3 ml-auto" 536 class="mr-3 ml-auto"
552 ng-class="saveLoading ? 'text-muted' : ''" 537 ng-class="saveLoading ? 'text-muted' : ''"
553 ng-click="crearCobranza()" 538 ng-click="crearCobranza()"
554 ng-show="!editando" 539 ng-show="!editando"
555 ladda="saveLoading" 540 ladda="saveLoading"
556 data-style="expand-left" 541 data-style="expand-left"
557 >Guardar</span> 542 >Guardar</span>
558 </div> 543 </div>
559 </div> 544 </div>
560 </div> 545 </div>
561 546