Commit 180d9b86093de2232c54d1aca4cd5d02f3cd2035

Authored by Jose Pinto
1 parent e728e2db08
Exists in master

Nuevo diseño

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