Commit b09cc649725462e20674580d321bc4809e06d6ca

Authored by Eric Fernandez
1 parent 0d01c9d6c8
Exists in master

guardar cobranza

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