Commit d1ab5a6941c8b80f12e6340689cf3a3a3deff78a

Authored by Luigi
1 parent f4e3fe7269
Exists in master

Actualizacion tipo de moneda en TOTAL

Showing 2 changed files with 10 additions and 10 deletions   Show diff stats
src/js/controller.js
1 angular.module('focaCrearCobranza') .controller('cobranzaController', 1 angular.module('focaCrearCobranza') .controller('cobranzaController',
2 [ 2 [
3 '$scope', '$timeout', '$uibModal', '$location', 3 '$scope', '$timeout', '$uibModal', '$location',
4 'focaCrearCobranzaService', 'focaModalService', '$filter', 'focaSeguimientoService', 4 'focaCrearCobranzaService', 'focaModalService', '$filter', 'focaSeguimientoService',
5 'focaBotoneraLateralService', 'APP', 'focaLoginService', '$localStorage', 5 'focaBotoneraLateralService', 'APP', 'focaLoginService', '$localStorage',
6 function($scope, $timeout, $uibModal, $location, focaCrearCobranzaService, 6 function($scope, $timeout, $uibModal, $location, focaCrearCobranzaService,
7 focaModalService, $filter, focaSeguimientoService, focaBotoneraLateralService, 7 focaModalService, $filter, focaSeguimientoService, focaBotoneraLateralService,
8 APP, loginService, $localStorage) 8 APP, loginService, $localStorage)
9 { 9 {
10 config(); 10 config();
11 11
12 function config() { 12 function config() {
13 $scope.datepickerAbierto = false; 13 $scope.datepickerAbierto = false;
14 $scope.cobroDeuda = true; 14 $scope.cobroDeuda = true;
15 $scope.show = false; 15 $scope.show = false;
16 $scope.cargando = true; 16 $scope.cargando = true;
17 $scope.puntoVenta = $filter('rellenarDigitos')(0, 4); 17 $scope.puntoVenta = $filter('rellenarDigitos')(0, 4);
18 $scope.comprobante = $filter('rellenarDigitos')(0, 8); 18 $scope.comprobante = $filter('rellenarDigitos')(0, 8);
19 $scope.botonera = focaCrearCobranzaService.getBotonera(); 19 $scope.botonera = focaCrearCobranzaService.getBotonera();
20 $scope.dateOptions = { 20 $scope.dateOptions = {
21 maxDate: new Date(), 21 maxDate: new Date(),
22 minDate: new Date(2010, 0, 1) 22 minDate: new Date(2010, 0, 1)
23 }; 23 };
24 24
25 var monedaPorDefecto; 25 var monedaPorDefecto;
26 //Trabajo con la cotización más reciente, por eso uso siempre la primera '[0]' 26 //Trabajo con la cotización más reciente, por eso uso siempre la primera '[0]'
27 focaCrearCobranzaService.getCotizacionByIdMoneda(1).then(function(res) { 27 focaCrearCobranzaService.getCotizacionByIdMoneda(1).then(function(res) {
28 monedaPorDefecto = res.data[0]; 28 monedaPorDefecto = res.data[0];
29 29
30 $scope.cobranza.cotizacion = Object.assign( 30 $scope.cobranza.cotizacion = Object.assign(
31 {moneda: monedaPorDefecto}, monedaPorDefecto.cotizaciones[0] 31 {moneda: monedaPorDefecto}, monedaPorDefecto.cotizaciones[0]
32 ); 32 );
33 $scope.inicial.cotizacion = $scope.cobranza.cotizacion; 33 $scope.inicial.cotizacion = $scope.cobranza.cotizacion;
34 34
35 }); 35 });
36 36
37 $timeout(function() { 37 $timeout(function() {
38 focaBotoneraLateralService.showSalir(false); 38 focaBotoneraLateralService.showSalir(false);
39 focaBotoneraLateralService.showPausar(true); 39 focaBotoneraLateralService.showPausar(true);
40 focaBotoneraLateralService.showGuardar(true, $scope.crearCobranza); 40 focaBotoneraLateralService.showGuardar(true, $scope.crearCobranza);
41 focaBotoneraLateralService.addCustomButton('Salir', salir); 41 focaBotoneraLateralService.addCustomButton('Salir', salir);
42 }); 42 });
43 43
44 if (APP === 'cobranza') { 44 if (APP === 'cobranza') {
45 $scope.idCobrador = loginService.getLoginData().vendedorCobrador; 45 $scope.idCobrador = loginService.getLoginData().vendedorCobrador;
46 } 46 }
47 47
48 init(); 48 init();
49 $timeout(function() {getLSCobranza();}); 49 $timeout(function() {getLSCobranza();});
50 } 50 }
51 51
52 function init() { 52 function init() {
53 $scope.$broadcast('cleanCabecera'); 53 $scope.$broadcast('cleanCabecera');
54 $scope.cobranza = { 54 $scope.cobranza = {
55 fecha: new Date(), 55 fecha: new Date(),
56 cotizacion: {}, 56 cotizacion: {},
57 facturas: [], 57 facturas: [],
58 cobros: [], 58 cobros: [],
59 cliente: {}, 59 cliente: {},
60 cobrador: {} 60 cobrador: {}
61 }; 61 };
62 if (APP === 'cobranza') { 62 if (APP === 'cobranza') {
63 focaCrearCobranzaService.getCobradorById($scope.idCobrador).then( 63 focaCrearCobranzaService.getCobradorById($scope.idCobrador).then(
64 function(res) { 64 function(res) {
65 var cobrador = res.data; 65 var cobrador = res.data;
66 66
67 $scope.$broadcast('addCabecera', { 67 $scope.$broadcast('addCabecera', {
68 label: 'Cobrador:', 68 label: 'Cobrador:',
69 valor: $filter('rellenarDigitos')(cobrador.NUM, 3) + ' - ' + 69 valor: $filter('rellenarDigitos')(cobrador.NUM, 3) + ' - ' +
70 cobrador.NOM 70 cobrador.NOM
71 }); 71 });
72 72
73 $scope.cobranza.cobrador = cobrador; 73 $scope.cobranza.cobrador = cobrador;
74 $scope.inicial.cobranza.cobrador = $scope.cobranza.cobrador; 74 $scope.inicial.cobranza.cobrador = $scope.cobranza.cobrador;
75 } 75 }
76 ); 76 );
77 } 77 }
78 78
79 $scope.inicial = angular.copy($scope.cobranza); 79 $scope.inicial = angular.copy($scope.cobranza);
80 80
81 focaCrearCobranzaService.getNumeroRecibo().then( 81 focaCrearCobranzaService.getNumeroRecibo().then(
82 function(res) { 82 function(res) {
83 $scope.puntoVenta = $filter('rellenarDigitos')( 83 $scope.puntoVenta = $filter('rellenarDigitos')(
84 res.data.sucursal, 4 84 res.data.sucursal, 4
85 ); 85 );
86 86
87 $scope.comprobante = $filter('rellenarDigitos')( 87 $scope.comprobante = $filter('rellenarDigitos')(
88 res.data.numeroRecibo, 8 88 res.data.numeroRecibo, 8
89 ); 89 );
90 }, 90 },
91 function(err) { 91 function(err) {
92 focaModalService.alert( 92 focaModalService.alert(
93 'La terminal no esta configurada correctamente' 93 'La terminal no esta configurada correctamente'
94 ); 94 );
95 console.info(err); 95 console.info(err);
96 } 96 }
97 ); 97 );
98 } 98 }
99 99
100 $scope.$watch('cobranza', function(newValue) { 100 $scope.$watch('cobranza', function(newValue) {
101 focaBotoneraLateralService.setPausarData({ 101 focaBotoneraLateralService.setPausarData({
102 label: 'cobranza', 102 label: 'cobranza',
103 val: newValue 103 val: newValue
104 }); 104 });
105 }, true); 105 }, true);
106 106
107 $scope.crearCobranza = function() { 107 $scope.crearCobranza = function() {
108 if (!$scope.cobranza.cliente.COD) { 108 if (!$scope.cobranza.cliente.COD) {
109 focaModalService.alert('Ingrese Cliente'); 109 focaModalService.alert('Ingrese Cliente');
110 return; 110 return;
111 } 111 }
112 if (!$scope.cobranza.cobrador.NUM) { 112 if (!$scope.cobranza.cobrador.NUM) {
113 focaModalService.alert('Ingrese Cobrador'); 113 focaModalService.alert('Ingrese Cobrador');
114 return; 114 return;
115 } 115 }
116 if ($scope.cobranza.facturas.length < 1) { 116 if ($scope.cobranza.facturas.length < 1) {
117 focaModalService.alert('Ingrese al menos una factura'); 117 focaModalService.alert('Ingrese al menos una factura');
118 return; 118 return;
119 } 119 }
120 if ($scope.getTotalCobrado() + $scope.getTotalDeuda() !== 0) { 120 if ($scope.getTotalCobrado() + $scope.getTotalDeuda() !== 0) {
121 focaModalService.alert('La diferencia debe ser ' + 121 focaModalService.alert('La diferencia debe ser ' +
122 $scope.cobranza.cotizacion.moneda.SIMBOLO + '0,00'); 122 $scope.cobranza.cotizacion.moneda.SIMBOLO + '0,00');
123 return; 123 return;
124 } 124 }
125 125
126 var cobranza = {}; 126 var cobranza = {};
127 var cheques = []; 127 var cheques = [];
128 var cuerpos = []; 128 var cuerpos = [];
129 var imgs = []; 129 var imgs = [];
130 var observacion; 130 var observacion;
131 //TODO: habilitar edición 131 //TODO: habilitar edición
132 $scope.editando = false; 132 $scope.editando = false;
133 focaBotoneraLateralService.startGuardar(); 133 focaBotoneraLateralService.startGuardar();
134 $scope.saveLoading = true; 134 $scope.saveLoading = true;
135 for(var i = 0; i < $scope.cobranza.facturas.length; i++) { 135 for(var i = 0; i < $scope.cobranza.facturas.length; i++) {
136 var cuerpoFactura = { 136 var cuerpoFactura = {
137 CYV: 'V', 137 CYV: 'V',
138 TIP: 'C', 138 TIP: 'C',
139 TCO: 'RC', 139 TCO: 'RC',
140 PVE: $scope.puntoVenta, 140 PVE: $scope.puntoVenta,
141 NCO: $scope.comprobante, 141 NCO: $scope.comprobante,
142 LOP: 'L', 142 LOP: 'L',
143 TIL: $scope.cobranza.facturas[i].TCO, 143 TIL: $scope.cobranza.facturas[i].TCO,
144 COM: $scope.cobranza.facturas[i].numeroFactura + '-' + 144 COM: $scope.cobranza.facturas[i].numeroFactura + '-' +
145 $filter('rellenarDigitos')($scope.cobranza.facturas[i].NCU,2), 145 $filter('rellenarDigitos')($scope.cobranza.facturas[i].NCU,2),
146 FEC: new Date($scope.cobranza.fecha) 146 FEC: new Date($scope.cobranza.fecha)
147 .toISOString().slice(0, 19).replace('T', ' '), 147 .toISOString().slice(0, 19).replace('T', ' '),
148 IMP: Math.abs($scope.cobranza.facturas[i].IPA), 148 IMP: Math.abs($scope.cobranza.facturas[i].IPA),
149 RES: 0,//caja de tesorería 149 RES: 0,//caja de tesorería
150 SUBM: 0, 150 SUBM: 0,
151 NCU: $scope.cobranza.facturas[i].NCU 151 NCU: $scope.cobranza.facturas[i].NCU
152 }; 152 };
153 cuerpos.push(cuerpoFactura); 153 cuerpos.push(cuerpoFactura);
154 154
155 } 155 }
156 156
157 for (var j = 0; j < $scope.cobranza.cobros.length; j++) { 157 for (var j = 0; j < $scope.cobranza.cobros.length; j++) {
158 158
159 var efectivo = $scope.cobranza.cobros[j].tipo === 'Efectivo'; 159 var efectivo = $scope.cobranza.cobros[j].tipo === 'Efectivo';
160 var cuerpoCobros = { 160 var cuerpoCobros = {
161 CYV: 'V', 161 CYV: 'V',
162 TIP: 'C', 162 TIP: 'C',
163 TCO: 'RC', 163 TCO: 'RC',
164 PVE: $scope.puntoVenta, 164 PVE: $scope.puntoVenta,
165 NCO: $scope.comprobante, 165 NCO: $scope.comprobante,
166 LOP: 'P', 166 LOP: 'P',
167 TIL: $scope.cobranza.cobros[j].til, 167 TIL: $scope.cobranza.cobros[j].til,
168 COM: efectivo ? 'ef(COBRO EN EFECTIVO)' : $scope.cobranza.cobros[j].tipo, 168 COM: efectivo ? 'ef(COBRO EN EFECTIVO)' : $scope.cobranza.cobros[j].tipo,
169 FEC: !$scope.cobranza.cobros[j].fechaPresentacion ? 169 FEC: !$scope.cobranza.cobros[j].fechaPresentacion ?
170 new Date($scope.cobranza.cobros[j].fecha) 170 new Date($scope.cobranza.cobros[j].fecha)
171 .toISOString().slice(0, 19).replace('T', ' ') : 171 .toISOString().slice(0, 19).replace('T', ' ') :
172 new Date($scope.cobranza.cobros[j].fechaPresentacion) 172 new Date($scope.cobranza.cobros[j].fechaPresentacion)
173 .toISOString().slice(0, 19).replace('T', ' '), 173 .toISOString().slice(0, 19).replace('T', ' '),
174 IMP: Math.abs($scope.cobranza.cobros[j].importe), 174 IMP: Math.abs($scope.cobranza.cobros[j].importe),
175 RES: 0,//caja de tesorería 175 RES: 0,//caja de tesorería
176 SUBM: 0 176 SUBM: 0
177 }; 177 };
178 cuerpos.push(cuerpoCobros); 178 cuerpos.push(cuerpoCobros);
179 179
180 if ($scope.cobranza.cobros[j].observacion) 180 if ($scope.cobranza.cobros[j].observacion)
181 observacion = $scope.cobranza.cobros[j].observacion; 181 observacion = $scope.cobranza.cobros[j].observacion;
182 182
183 if ($scope.cobranza.cobros[j].banco) { 183 if ($scope.cobranza.cobros[j].banco) {
184 var cheque = { 184 var cheque = {
185 BCO: $scope.cobranza.cobros[j].banco.ID, 185 BCO: $scope.cobranza.cobros[j].banco.ID,
186 NUM: $scope.comprobante, 186 NUM: $scope.comprobante,
187 FEP: new Date($scope.cobranza.cobros[j].fechaPresentacion) 187 FEP: new Date($scope.cobranza.cobros[j].fechaPresentacion)
188 .toISOString().slice(0, 19).replace('T', ' '), 188 .toISOString().slice(0, 19).replace('T', ' '),
189 FEE: new Date($scope.cobranza.cobros[j].fechaEmision) 189 FEE: new Date($scope.cobranza.cobros[j].fechaEmision)
190 .toISOString().slice(0, 19).replace('T', ' '), 190 .toISOString().slice(0, 19).replace('T', ' '),
191 LUG: $scope.cobranza.cobros[j].localidad.NOMBRE, 191 LUG: $scope.cobranza.cobros[j].localidad.NOMBRE,
192 IMP: $scope.cobranza.cobros[j].importe, 192 IMP: $scope.cobranza.cobros[j].importe,
193 LIB: $scope.cobranza.cobros[j].librador, 193 LIB: $scope.cobranza.cobros[j].librador,
194 EST: 'C',//'D' depositado, 'E' entregado, 'C' en cartera 194 EST: 'C',//'D' depositado, 'E' entregado, 'C' en cartera
195 PCI: $scope.cobranza.cobros[j].provincia.ID, 195 PCI: $scope.cobranza.cobros[j].provincia.ID,
196 LPLA: 0, 196 LPLA: 0,
197 PLA: 0, 197 PLA: 0,
198 VEN: $scope.cobranza.cobrador.id,//Id vendedor 198 VEN: $scope.cobranza.cobrador.id,//Id vendedor
199 CCLIE: $scope.cobranza.cliente.COD,//Id cliente 199 CCLIE: $scope.cobranza.cliente.COD,//Id cliente
200 REN: 0, 200 REN: 0,
201 PVEC: $scope.puntoVenta, 201 PVEC: $scope.puntoVenta,
202 NCOC: $scope.comprobante, 202 NCOC: $scope.comprobante,
203 OBSE: $scope.cobranza.cobros[j].observaciones, 203 OBSE: $scope.cobranza.cobros[j].observaciones,
204 LUV: 0, 204 LUV: 0,
205 ORI: 've', 205 ORI: 've',
206 FER: '', 206 FER: '',
207 BIMP: 0, 207 BIMP: 0,
208 COMP: 'C ' +'RC ' + $scope.puntoVenta + '-' + $scope.comprobante, 208 COMP: 'C ' +'RC ' + $scope.puntoVenta + '-' + $scope.comprobante,
209 VAL_E: '',//Cuando egresa por ingresos y egresos en el numero de egreso 209 VAL_E: '',//Cuando egresa por ingresos y egresos en el numero de egreso
210 VAL_I: '',//Cuando Ingresa por ingresos y egresos en el numero ingreso 210 VAL_I: '',//Cuando Ingresa por ingresos y egresos en el numero ingreso
211 REC_CAJ: 'D', 211 REC_CAJ: 'D',
212 TIPO_C: 0,//?? 212 TIPO_C: 0,//??
213 SALDO_CAJ: 'S', 213 SALDO_CAJ: 'S',
214 FECHA_INGRESO: new Date($scope.cobranza.fecha) 214 FECHA_INGRESO: new Date($scope.cobranza.fecha)
215 .toISOString().slice(0, 19).replace('T', ' '), 215 .toISOString().slice(0, 19).replace('T', ' '),
216 Vendedor_valor: 0, 216 Vendedor_valor: 0,
217 FAMILIA: 0, 217 FAMILIA: 0,
218 CUIT_LIB: '', 218 CUIT_LIB: '',
219 COD_LUG: $scope.cobranza.cobros[j].localidad.ID,//código lugar 219 COD_LUG: $scope.cobranza.cobros[j].localidad.ID,//código lugar
220 SEN: '', 220 SEN: '',
221 NRC: 0, 221 NRC: 0,
222 COD_LARGO: '', 222 COD_LARGO: '',
223 VN: 0, 223 VN: 0,
224 ID_LECTOR: 0, 224 ID_LECTOR: 0,
225 NATHB: '' 225 NATHB: ''
226 }; 226 };
227 cheques.push(cheque); 227 cheques.push(cheque);
228 } 228 }
229 if ($scope.cobranza.cobros[j].imgs) imgs = $scope.cobranza.cobros[j].imgs; 229 if ($scope.cobranza.cobros[j].imgs) imgs = $scope.cobranza.cobros[j].imgs;
230 230
231 } 231 }
232 232
233 cobranza = { 233 cobranza = {
234 recibo: { 234 recibo: {
235 CYV: 'V', 235 CYV: 'V',
236 TIP: 'C', 236 TIP: 'C',
237 TCO: 'RC', 237 TCO: 'RC',
238 PVE: $scope.puntoVenta, //Sucursar, punto de venta 238 PVE: $scope.puntoVenta, //Sucursar, punto de venta
239 NCO: $scope.comprobante, //Numero de comprobante 239 NCO: $scope.comprobante, //Numero de comprobante
240 FEC: new Date($scope.cobranza.fecha) 240 FEC: new Date($scope.cobranza.fecha)
241 .toISOString().slice(0, 19).replace('T', ' '), 241 .toISOString().slice(0, 19).replace('T', ' '),
242 CLI: $scope.cobranza.cliente.COD, 242 CLI: $scope.cobranza.cliente.COD,
243 ATO: 0, //número de asiento 243 ATO: 0, //número de asiento
244 CFE: $scope.cobranza.cobrador.NOM, 244 CFE: $scope.cobranza.cobrador.NOM,
245 PLA: '',//Numero de planilla, sin uso 245 PLA: '',//Numero de planilla, sin uso
246 ID_MONEDA: $scope.cobranza.cotizacion.moneda.ID, 246 ID_MONEDA: $scope.cobranza.cotizacion.moneda.ID,
247 COTIZACION: $scope.cobranza.cotizacion.VENDEDOR, 247 COTIZACION: $scope.cobranza.cotizacion.VENDEDOR,
248 idCobrador: $scope.cobranza.cobrador.id 248 idCobrador: $scope.cobranza.cobrador.id
249 }, 249 },
250 cuerpo: cuerpos, 250 cuerpo: cuerpos,
251 cheques: cheques, 251 cheques: cheques,
252 acobypag: { 252 acobypag: {
253 CYV: 'V', 253 CYV: 'V',
254 COD: $scope.cobranza.cliente.COD, 254 COD: $scope.cobranza.cliente.COD,
255 FEP: new Date($scope.cobranza.fecha) 255 FEP: new Date($scope.cobranza.fecha)
256 .toISOString().slice(0, 19).replace('T', ' '), 256 .toISOString().slice(0, 19).replace('T', ' '),
257 TIP: 'C', 257 TIP: 'C',
258 TCO: 'RC', 258 TCO: 'RC',
259 SUC: $scope.puntoVenta, 259 SUC: $scope.puntoVenta,
260 NCO: $scope.comprobante, 260 NCO: $scope.comprobante,
261 IPA: $scope.getTotalCobrado(), 261 IPA: $scope.getTotalCobrado(),
262 SAL: '',//?? 262 SAL: '',//??
263 TCA: 1, 263 TCA: 1,
264 ZONA: 1, 264 ZONA: 1,
265 FPA: 2,//Forma de pago 265 FPA: 2,//Forma de pago
266 REC: 0, 266 REC: 0,
267 REP: 0, 267 REP: 0,
268 FER: null, 268 FER: null,
269 REM: 0, 269 REM: 0,
270 FRE: null,//?? 270 FRE: null,//??
271 PRO: 'N', 271 PRO: 'N',
272 FEV: new Date($scope.cobranza.fecha) 272 FEV: new Date($scope.cobranza.fecha)
273 .toISOString().slice(0, 19).replace('T', ' ') 273 .toISOString().slice(0, 19).replace('T', ' ')
274 }, 274 },
275 datosCobrador: { 275 datosCobrador: {
276 COD: $scope.cobranza.cobrador.NUM, 276 COD: $scope.cobranza.cobrador.NUM,
277 PVE: $scope.puntoVenta, 277 PVE: $scope.puntoVenta,
278 NUM: $scope.comprobante, 278 NUM: $scope.comprobante,
279 EST: 'C', 279 EST: 'C',
280 OBS: 'RC: ' + $scope.comprobante + '-' + 280 OBS: 'RC: ' + $scope.comprobante + '-' +
281 new Date($scope.cobranza.fecha).toLocaleDateString(), 281 new Date($scope.cobranza.fecha).toLocaleDateString(),
282 DAT1: 'C', 282 DAT1: 'C',
283 CLI: $scope.cobranza.cliente.COD 283 CLI: $scope.cobranza.cliente.COD
284 }, 284 },
285 cliente: $scope.cobranza.cliente, 285 cliente: $scope.cobranza.cliente,
286 imgs: imgs, 286 imgs: imgs,
287 observacion: observacion 287 observacion: observacion
288 }; 288 };
289 //COPIO cobranzaMail Y A cobranza LE ELIMINO EL VALOR NCU DE LOS CUERPOS 289 //COPIO cobranzaMail Y A cobranza LE ELIMINO EL VALOR NCU DE LOS CUERPOS
290 var cobranzaMail = angular.copy(cobranza); 290 var cobranzaMail = angular.copy(cobranza);
291 cobranza.cuerpo = cobranza.cuerpo.map(function(c) { 291 cobranza.cuerpo = cobranza.cuerpo.map(function(c) {
292 if (c.NCU) delete c.NCU; 292 if (c.NCU) delete c.NCU;
293 return c; 293 return c;
294 }); 294 });
295 295
296 focaCrearCobranzaService 296 focaCrearCobranzaService
297 .guardarCobranza(cobranza) 297 .guardarCobranza(cobranza)
298 .then( 298 .then(
299 function(result) { 299 function(result) {
300 focaBotoneraLateralService.endGuardar(true); 300 focaBotoneraLateralService.endGuardar(true);
301 $scope.saveLoading = false; 301 $scope.saveLoading = false;
302 302
303 enviarMail(cobranzaMail); 303 enviarMail(cobranzaMail);
304 304
305 focaSeguimientoService.guardarPosicion( 305 focaSeguimientoService.guardarPosicion(
306 'Cobranza', 306 'Cobranza',
307 result.data, 307 result.data,
308 '' 308 ''
309 ); 309 );
310 310
311 init(); 311 init();
312 }, function(error) { 312 }, function(error) {
313 focaModalService.alert('Hubo un problema al cargar la cobranza'); 313 focaModalService.alert('Hubo un problema al cargar la cobranza');
314 focaBotoneraLateralService.endGuardar(); 314 focaBotoneraLateralService.endGuardar();
315 $scope.saveLoading = false; 315 $scope.saveLoading = false;
316 console.info(error); 316 console.info(error);
317 } 317 }
318 ); 318 );
319 }; 319 };
320 320
321 $scope.seleccionarCobros = function() { 321 $scope.seleccionarCobros = function() {
322 $scope.cobroDeuda = false; 322 $scope.cobroDeuda = false;
323 }; 323 };
324 324
325 $scope.seleccionarComprobantes = function() { 325 $scope.seleccionarComprobantes = function() {
326 $scope.cobroDeuda = true; 326 $scope.cobroDeuda = true;
327 }; 327 };
328 328
329 $scope.seleccionarCobranza = function() { 329 $scope.seleccionarCobranza = function() {
330 330
331 var modalInstance = $uibModal.open( 331 var modalInstance = $uibModal.open(
332 { 332 {
333 ariaLabelledBy: 'Busqueda de Cobranzas', 333 ariaLabelledBy: 'Busqueda de Cobranzas',
334 templateUrl: 'foca-modal-cobranza.html', 334 templateUrl: 'foca-modal-cobranza.html',
335 controller: 'focaModalCobranzaController', 335 controller: 'focaModalCobranzaController',
336 size: 'lg' 336 size: 'lg'
337 } 337 }
338 ); 338 );
339 modalInstance.result.then(setearCobranza); 339 modalInstance.result.then(setearCobranza);
340 }; 340 };
341 341
342 $scope.seleccionarResumenDeCuenta = function() { 342 $scope.seleccionarResumenDeCuenta = function() {
343 if (!$scope.cobranza.cliente.COD) { 343 if (!$scope.cobranza.cliente.COD) {
344 focaModalService.alert('Seleccione primero un cliente'); 344 focaModalService.alert('Seleccione primero un cliente');
345 return; 345 return;
346 } 346 }
347 var modalInstance = $uibModal.open( 347 var modalInstance = $uibModal.open(
348 { 348 {
349 ariaLabelledBy: 'Resumen de cuentas', 349 ariaLabelledBy: 'Resumen de cuentas',
350 templateUrl: 'modal-resumen-cuenta.html', 350 templateUrl: 'modal-resumen-cuenta.html',
351 controller: 'focaModalResumenCuentaController', 351 controller: 'focaModalResumenCuentaController',
352 resolve: { 352 resolve: {
353 cliente: function() { return $scope.cobranza.cliente; } 353 cliente: function() { return $scope.cobranza.cliente; }
354 }, 354 },
355 size: 'lg' 355 size: 'lg'
356 } 356 }
357 ); 357 );
358 modalInstance.result.then( 358 modalInstance.result.then(
359 function(cliente) { 359 function(cliente) {
360 $scope.abrirModalDomicilios(cliente); 360 $scope.abrirModalDomicilios(cliente);
361 $scope.cliente = cliente; 361 $scope.cliente = cliente;
362 }, function() {} 362 }, function() {}
363 ); 363 );
364 }; 364 };
365 365
366 $scope.seleccionarCliente = function() { 366 $scope.seleccionarCliente = function() {
367 $scope.seleccionarCobrador(function() { 367 $scope.seleccionarCobrador(function() {
368 var modalInstance = $uibModal.open( 368 var modalInstance = $uibModal.open(
369 { 369 {
370 ariaLabelledBy: 'Busqueda de Cliente', 370 ariaLabelledBy: 'Busqueda de Cliente',
371 templateUrl: 'foca-busqueda-cliente-modal.html', 371 templateUrl: 'foca-busqueda-cliente-modal.html',
372 controller: 'focaBusquedaClienteModalController', 372 controller: 'focaBusquedaClienteModalController',
373 resolve: { 373 resolve: {
374 vendedor: function() { return null; }, 374 vendedor: function() { return null; },
375 cobrador: function() { return $scope.cobranza.cobrador; } 375 cobrador: function() { return $scope.cobranza.cobrador; }
376 }, 376 },
377 size: 'lg' 377 size: 'lg'
378 } 378 }
379 ); 379 );
380 modalInstance.result.then( 380 modalInstance.result.then(
381 function(cliente) { 381 function(cliente) {
382 var clienteMayus = { 382 var clienteMayus = {
383 COD: cliente.cod, 383 COD: cliente.cod,
384 NOM: cliente.nom, 384 NOM: cliente.nom,
385 CUIT: cliente.cuit, 385 CUIT: cliente.cuit,
386 MAIL: cliente.mail 386 MAIL: cliente.mail
387 }; 387 };
388 388
389 $scope.$broadcast('addCabecera', { 389 $scope.$broadcast('addCabecera', {
390 label: 'Cliente:', 390 label: 'Cliente:',
391 valor: $filter('rellenarDigitos')(clienteMayus.COD, 5) + ' - ' + 391 valor: $filter('rellenarDigitos')(clienteMayus.COD, 5) + ' - ' +
392 clienteMayus.NOM 392 clienteMayus.NOM
393 }); 393 });
394 $scope.cobranza.cliente = clienteMayus; 394 $scope.cobranza.cliente = clienteMayus;
395 $scope.cobranza.facturas = []; 395 $scope.cobranza.facturas = [];
396 }, function() { 396 }, function() {
397 if (APP !== 'cobranza') $scope.seleccionarCliente(); 397 if (APP !== 'cobranza') $scope.seleccionarCliente();
398 } 398 }
399 ); 399 );
400 }); 400 });
401 }; 401 };
402 402
403 $scope.seleccionarCobrador = function(callback) { 403 $scope.seleccionarCobrador = function(callback) {
404 404
405 if (APP === 'cobranza') { 405 if (APP === 'cobranza') {
406 callback(); 406 callback();
407 return; 407 return;
408 } 408 }
409 409
410 var parametrosModal = { 410 var parametrosModal = {
411 query: '/cobrador', 411 query: '/cobrador',
412 columnas: [ 412 columnas: [
413 { 413 {
414 propiedad: 'NUM', 414 propiedad: 'NUM',
415 nombre: 'Codigo', 415 nombre: 'Codigo',
416 filtro: { 416 filtro: {
417 nombre: 'rellenarDigitos', 417 nombre: 'rellenarDigitos',
418 parametro: 3 418 parametro: 3
419 } 419 }
420 }, 420 },
421 { 421 {
422 propiedad: 'NOM', 422 propiedad: 'NOM',
423 nombre: 'Nombre' 423 nombre: 'Nombre'
424 } 424 }
425 ], 425 ],
426 titulo:'Búsqueda de cobradores' 426 titulo:'Búsqueda de cobradores'
427 }; 427 };
428 focaModalService.modal(parametrosModal).then( 428 focaModalService.modal(parametrosModal).then(
429 function(cobrador) { 429 function(cobrador) {
430 $scope.$broadcast('addCabecera', { 430 $scope.$broadcast('addCabecera', {
431 label: 'Cobrador:', 431 label: 'Cobrador:',
432 valor: $filter('rellenarDigitos')(cobrador.NUM, 3) + ' - ' + 432 valor: $filter('rellenarDigitos')(cobrador.NUM, 3) + ' - ' +
433 cobrador.NOM 433 cobrador.NOM
434 }); 434 });
435 $scope.cobranza.cobrador = cobrador; 435 $scope.cobranza.cobrador = cobrador;
436 436
437 //ELIMINO CLIENTE 437 //ELIMINO CLIENTE
438 $scope.$broadcast('removeCabecera', 'Cliente:'); 438 $scope.$broadcast('removeCabecera', 'Cliente:');
439 $scope.cobranza.cliente = {}; 439 $scope.cobranza.cliente = {};
440 440
441 callback(); 441 callback();
442 }, function() {} 442 }, function() {}
443 ); 443 );
444 }; 444 };
445 445
446 $scope.seleccionarFactura = function() { 446 $scope.seleccionarFactura = function() {
447 if (!$scope.cobranza.cliente.COD) { 447 if (!$scope.cobranza.cliente.COD) {
448 focaModalService.alert('Seleccione primero un cliente'); 448 focaModalService.alert('Seleccione primero un cliente');
449 return; 449 return;
450 } 450 }
451 var modalInstance = $uibModal.open( 451 var modalInstance = $uibModal.open(
452 { 452 {
453 ariaLabelledBy: 'Busqueda de Facturas', 453 ariaLabelledBy: 'Busqueda de Facturas',
454 templateUrl: 'foca-modal-factura.html', 454 templateUrl: 'foca-modal-factura.html',
455 controller: 'focaModalFacturaController', 455 controller: 'focaModalFacturaController',
456 size: 'lg', 456 size: 'lg',
457 resolve: { 457 resolve: {
458 parametrosFactura: function() { 458 parametrosFactura: function() {
459 return { 459 return {
460 cliente: $scope.cobranza.cliente, 460 cliente: $scope.cobranza.cliente,
461 simbolo: $scope.cobranza.cotizacion.moneda.SIMBOLO, 461 simbolo: $scope.cobranza.cotizacion.moneda.SIMBOLO,
462 cotizacion: $scope.cobranza.cotizacion.VENDEDOR, 462 cotizacion: $scope.cobranza.cotizacion.VENDEDOR,
463 moneda: $scope.cobranza.cotizacion.moneda.ID 463 moneda: $scope.cobranza.cotizacion.moneda.ID
464 }; 464 };
465 } 465 }
466 } 466 }
467 } 467 }
468 ); 468 );
469 modalInstance.result.then( 469 modalInstance.result.then(
470 function(facturas) { 470 function(facturas) {
471 var facturasResult = []; 471 var facturasResult = [];
472 //AGREGO A FACTURASRESULT LAS FACTURAS QUE NO HAN SIDO SELECCIONADAS 472 //AGREGO A FACTURASRESULT LAS FACTURAS QUE NO HAN SIDO SELECCIONADAS
473 facturas.forEach(function(factura) { 473 facturas.forEach(function(factura) {
474 var existe = $scope.cobranza.facturas.filter(function(e) { 474 var existe = $scope.cobranza.facturas.filter(function(e) {
475 return angular.equals(factura, e); 475 return angular.equals(factura, e);
476 }); 476 });
477 477
478 if (!existe.length) facturasResult.push(factura); 478 if (!existe.length) facturasResult.push(factura);
479 }); 479 });
480 480
481 $scope.cobranza.facturas = $scope.cobranza.facturas.concat(facturasResult); 481 $scope.cobranza.facturas = $scope.cobranza.facturas.concat(facturasResult);
482 }, function() { } 482 }, function() { }
483 ); 483 );
484 }; 484 };
485 485
486 $scope.seleccionarCheque = function() { 486 $scope.seleccionarCheque = function() {
487 var modalInstance = $uibModal.open( 487 var modalInstance = $uibModal.open(
488 { 488 {
489 ariaLabelledBy: 'Carga de cheques', 489 ariaLabelledBy: 'Carga de cheques',
490 templateUrl: 'modal-cheque.html', 490 templateUrl: 'modal-cheque.html',
491 controller: 'focaModalChequeController', 491 controller: 'focaModalChequeController',
492 size: 'lg', 492 size: 'lg',
493 resolve: { 493 resolve: {
494 sugerido: function() { 494 sugerido: function() {
495 var sugerido = $scope.getTotalDeuda() + $scope.getTotalCobrado(); 495 var sugerido = $scope.getTotalDeuda() + $scope.getTotalCobrado();
496 return sugerido < 0 ? sugerido : null; 496 return sugerido < 0 ? sugerido : null;
497 } 497 }
498 } 498 }
499 } 499 }
500 ); 500 );
501 modalInstance.result.then( 501 modalInstance.result.then(
502 function(cheque) { 502 function(cheque) {
503 var cobro = { 503 var cobro = {
504 tipo: 'ch' + '(' + cheque.numero + ')' + ' ' + cheque.banco.desbco, 504 tipo: 'ch' + '(' + cheque.numero + ')' + ' ' + cheque.banco.desbco,
505 numero: cheque.numero, 505 numero: cheque.numero,
506 banco: cheque.banco, 506 banco: cheque.banco,
507 fecha: cheque.fechaEmision.toLocaleDateString() + '-' + 507 fecha: cheque.fechaEmision.toLocaleDateString() + '-' +
508 cheque.fechaPresentacion.toLocaleDateString(), 508 cheque.fechaPresentacion.toLocaleDateString(),
509 fechaPresentacion: cheque.fechaPresentacion, 509 fechaPresentacion: cheque.fechaPresentacion,
510 fechaEmision: cheque.fechaEmision, 510 fechaEmision: cheque.fechaEmision,
511 importe: cheque.importe * $scope.cobranza.cotizacion.VENDEDOR, 511 importe: cheque.importe * $scope.cobranza.cotizacion.VENDEDOR,
512 localidad: cheque.localidad, 512 localidad: cheque.localidad,
513 librador: cheque.librador, 513 librador: cheque.librador,
514 provincia: cheque.provincia, 514 provincia: cheque.provincia,
515 observaciones: cheque.observaciones, 515 observaciones: cheque.observaciones,
516 til: 'EF' 516 til: 'EF'
517 }; 517 };
518 $scope.cobranza.cobros.push(cobro); 518 $scope.cobranza.cobros.push(cobro);
519 }, function() { 519 }, function() {
520 520
521 } 521 }
522 ); 522 );
523 }; 523 };
524 524
525 $scope.seleccionarEfectivo = function() { 525 $scope.seleccionarEfectivo = function() {
526 var modalInstance = $uibModal.open( 526 var modalInstance = $uibModal.open(
527 { 527 {
528 ariaLabelledBy: 'Carga de cheques', 528 ariaLabelledBy: 'Carga de cheques',
529 templateUrl: 'modal-efectivo.html', 529 templateUrl: 'modal-efectivo.html',
530 controller: 'focaModalEfectivoController', 530 controller: 'focaModalEfectivoController',
531 size: 'sm', 531 size: 'sm',
532 resolve: { 532 resolve: {
533 sugerido: function() { 533 sugerido: function() {
534 var sugerido = $scope.getTotalDeuda() + $scope.getTotalCobrado(); 534 var sugerido = $scope.getTotalDeuda() + $scope.getTotalCobrado();
535 return sugerido < 0 ? sugerido : null; 535 return sugerido < 0 ? sugerido : null;
536 } 536 }
537 } 537 }
538 } 538 }
539 ); 539 );
540 modalInstance.result.then( 540 modalInstance.result.then(
541 function(efectivo) { 541 function(efectivo) {
542 var cobro = { 542 var cobro = {
543 tipo: 'Efectivo', 543 tipo: 'Efectivo',
544 fecha: new Date(), 544 fecha: new Date(),
545 importe: efectivo * $scope.cobranza.cotizacion.VENDEDOR, 545 importe: efectivo * $scope.cobranza.cotizacion.VENDEDOR,
546 til: 'EF' 546 til: 'EF'
547 }; 547 };
548 $scope.cobranza.cobros = $scope.cobranza.cobros.filter(function(a) { 548 $scope.cobranza.cobros = $scope.cobranza.cobros.filter(function(a) {
549 return a.tipo !== 'Efectivo'; 549 return a.tipo !== 'Efectivo';
550 }); 550 });
551 $scope.cobranza.cobros.push(cobro); 551 $scope.cobranza.cobros.push(cobro);
552 }, function() { 552 }, function() {
553 553
554 } 554 }
555 ); 555 );
556 }; 556 };
557 557
558 $scope.seleccionarDetalles = function() { 558 $scope.seleccionarDetalles = function() {
559 var modalInstance = $uibModal.open( 559 var modalInstance = $uibModal.open(
560 { 560 {
561 ariaLabelledBy: 'Carga de detalles', 561 ariaLabelledBy: 'Carga de detalles',
562 templateUrl: 'modal-detalles.html', 562 templateUrl: 'modal-detalles.html',
563 controller: 'focaModalDetallesController', 563 controller: 'focaModalDetallesController',
564 size: 'lg', 564 size: 'lg',
565 resolve: { 565 resolve: {
566 sugerido: function() { 566 sugerido: function() {
567 var sugerido = $scope.getTotalDeuda() + $scope.getTotalCobrado(); 567 var sugerido = $scope.getTotalDeuda() + $scope.getTotalCobrado();
568 return sugerido < 0 ? sugerido : null; 568 return sugerido < 0 ? sugerido : null;
569 } 569 }
570 } 570 }
571 } 571 }
572 ); 572 );
573 modalInstance.result.then( 573 modalInstance.result.then(
574 function(detalles) { 574 function(detalles) {
575 var cobro = { 575 var cobro = {
576 tipo: 'de(COBRO POR DETALLES)', 576 tipo: 'de(COBRO POR DETALLES)',
577 fecha: new Date(), 577 fecha: new Date(),
578 importe: detalles.monto * $scope.cobranza.cotizacion.VENDEDOR, 578 importe: detalles.monto * $scope.cobranza.cotizacion.VENDEDOR,
579 imgs: detalles.imgs, 579 imgs: detalles.imgs,
580 til: 'DE', 580 til: 'DE',
581 observacion: detalles.observacion 581 observacion: detalles.observacion
582 }; 582 };
583 var existe = false; 583 var existe = false;
584 584
585 $scope.cobranza.cobros.forEach(function(c, idx) { 585 $scope.cobranza.cobros.forEach(function(c, idx) {
586 if (c.til === 'DE') { 586 if (c.til === 'DE') {
587 $scope.cobranza.cobros[idx] = cobro; 587 $scope.cobranza.cobros[idx] = cobro;
588 existe = true; 588 existe = true;
589 } 589 }
590 }); 590 });
591 if (!existe) { 591 if (!existe) {
592 $scope.cobranza.cobros.push(cobro); 592 $scope.cobranza.cobros.push(cobro);
593 } 593 }
594 }, function() {} 594 }, function() {}
595 ); 595 );
596 }; 596 };
597 597
598 $scope.seleccionarMoneda = function() { 598 $scope.seleccionarMoneda = function() {
599 var parametrosModal = { 599 var parametrosModal = {
600 titulo: 'Búsqueda de monedas', 600 titulo: 'Búsqueda de monedas',
601 query: '/moneda', 601 query: '/moneda',
602 columnas: [ 602 columnas: [
603 { 603 {
604 propiedad: 'DETALLE', 604 propiedad: 'DETALLE',
605 nombre: 'Nombre' 605 nombre: 'Nombre'
606 }, 606 },
607 { 607 {
608 propiedad: 'SIMBOLO', 608 propiedad: 'SIMBOLO',
609 nombre: 'Símbolo' 609 nombre: 'Símbolo'
610 } 610 }
611 ], 611 ],
612 size: 'md' 612 size: 'md'
613 }; 613 };
614 focaModalService.modal(parametrosModal).then( 614 focaModalService.modal(parametrosModal).then(
615 function(moneda) { 615 function(moneda) {
616 $scope.seleccionarCotizacion(moneda); 616 $scope.seleccionarCotizacion(moneda);
617 }, function() { 617 }, function() {
618 618
619 } 619 }
620 ); 620 );
621 }; 621 };
622 622
623 $scope.seleccionarCotizacion = function(moneda) { 623 $scope.seleccionarCotizacion = function(moneda) {
624 var modalInstance = $uibModal.open( 624 var modalInstance = $uibModal.open(
625 { 625 {
626 ariaLabelledBy: 'Busqueda de Cotización', 626 ariaLabelledBy: 'Busqueda de Cotización',
627 templateUrl: 'modal-cotizacion.html', 627 templateUrl: 'modal-cotizacion.html',
628 controller: 'focaModalCotizacionController', 628 controller: 'focaModalCotizacionController',
629 size: 'lg', 629 size: 'lg',
630 resolve: {idMoneda: function() {return moneda.ID;}} 630 resolve: {idMoneda: function() {return moneda.ID;}}
631 } 631 }
632 ); 632 );
633 modalInstance.result.then( 633 modalInstance.result.then(
634 function(cotizacion) { 634 function(cotizacion) {
635 $scope.cobranza.cotizacion.moneda = moneda;
636 $scope.cobranza.cotizacion = cotizacion; 635 $scope.cobranza.cotizacion = cotizacion;
636 $scope.cobranza.cotizacion.moneda = moneda;
637 if (moneda.DETALLE === 'PESOS ARGENTINOS') { 637 if (moneda.DETALLE === 'PESOS ARGENTINOS') {
638 $scope.$broadcast('removeCabecera', 'Moneda:'); 638 $scope.$broadcast('removeCabecera', 'Moneda:');
639 $scope.$broadcast('removeCabecera', 'Fecha cotizacion:'); 639 $scope.$broadcast('removeCabecera', 'Fecha cotizacion:');
640 $scope.$broadcast('removeCabecera', 'Cotizacion:'); 640 $scope.$broadcast('removeCabecera', 'Cotizacion:');
641 } else { 641 } else {
642 $scope.$broadcast('addCabecera', { 642 $scope.$broadcast('addCabecera', {
643 label: 'Moneda:', 643 label: 'Moneda:',
644 valor: moneda.DETALLE 644 valor: moneda.DETALLE
645 }); 645 });
646 $scope.$broadcast('addCabecera', { 646 $scope.$broadcast('addCabecera', {
647 label: 'Fecha cotizacion:', 647 label: 'Fecha cotizacion:',
648 valor: $filter('date')(cotizacion.FECHA, 'dd/MM/yyyy') 648 valor: $filter('date')(cotizacion.FECHA, 'dd/MM/yyyy')
649 }); 649 });
650 $scope.$broadcast('addCabecera', { 650 $scope.$broadcast('addCabecera', {
651 label: 'Cotizacion:', 651 label: 'Cotizacion:',
652 valor: $filter('number')(cotizacion.VENDEDOR, '2') 652 valor: $filter('number')(cotizacion.VENDEDOR, '2')
653 }); 653 });
654 } 654 }
655 }, function() { 655 }, function() {
656 656
657 } 657 }
658 ); 658 );
659 }; 659 };
660 660
661 $scope.getTotalDeuda = function() { 661 $scope.getTotalDeuda = function() {
662 var total = 0; 662 var total = 0;
663 for (var i = 0; i < $scope.cobranza.facturas.length; i++) { 663 for (var i = 0; i < $scope.cobranza.facturas.length; i++) {
664 total += $scope.cobranza.facturas[i].IPA; 664 total += $scope.cobranza.facturas[i].IPA;
665 } 665 }
666 return parseFloat(total.toFixed(2)); 666 return parseFloat(total.toFixed(2));
667 }; 667 };
668 668
669 $scope.getTotalCobrado = function() { 669 $scope.getTotalCobrado = function() {
670 var total = 0; 670 var total = 0;
671 for (var i = 0; i < $scope.cobranza.cobros.length; i++) { 671 for (var i = 0; i < $scope.cobranza.cobros.length; i++) {
672 total += $scope.cobranza.cobros[i].importe; 672 total += $scope.cobranza.cobros[i].importe;
673 } 673 }
674 return parseFloat(total.toFixed(2)); 674 return parseFloat(total.toFixed(2));
675 }; 675 };
676 676
677 $scope.getSubTotal = function() { 677 $scope.getSubTotal = function() {
678 if ($scope.articuloACargar) { 678 if ($scope.articuloACargar) {
679 return $scope.articuloACargar.precio * $scope.articuloACargar.cantidad; 679 return $scope.articuloACargar.precio * $scope.articuloACargar.cantidad;
680 } 680 }
681 }; 681 };
682 //Recibe aviso si el teclado está en uso 682 //Recibe aviso si el teclado está en uso
683 // $rootScope.$on('usarTeclado', function(event, data) { 683 // $rootScope.$on('usarTeclado', function(event, data) {
684 // if(data) { 684 // if(data) {
685 // $scope.mostrarTeclado = true; 685 // $scope.mostrarTeclado = true;
686 // return; 686 // return;
687 // } 687 // }
688 // $scope.mostrarTeclado = false; 688 // $scope.mostrarTeclado = false;
689 // }) 689 // })
690 $scope.selectFocus = function($event) { 690 $scope.selectFocus = function($event) {
691 //Si el teclado esta en uso no selecciona el valor 691 //Si el teclado esta en uso no selecciona el valor
692 // if($scope.mostrarTeclado) { 692 // if($scope.mostrarTeclado) {
693 // return; 693 // return;
694 // } 694 // }
695 $event.target.select(); 695 $event.target.select();
696 }; 696 };
697 697
698 $scope.salir = function() { 698 $scope.salir = function() {
699 $location.path('/'); 699 $location.path('/');
700 }; 700 };
701 701
702 $scope.parsearATexto = function(articulo) { 702 $scope.parsearATexto = function(articulo) {
703 articulo.cantidad = parseFloat(articulo.cantidad); 703 articulo.cantidad = parseFloat(articulo.cantidad);
704 articulo.precio = parseFloat(articulo.precio); 704 articulo.precio = parseFloat(articulo.precio);
705 }; 705 };
706 706
707 $scope.quitarFactura = function(key) { 707 $scope.quitarFactura = function(key) {
708 $scope.cobranza.facturas.splice(key, 1); 708 $scope.cobranza.facturas.splice(key, 1);
709 }; 709 };
710 710
711 $scope.quitarCobro = function(key) { 711 $scope.quitarCobro = function(key) {
712 $scope.cobranza.cobros.splice(key, 1); 712 $scope.cobranza.cobros.splice(key, 1);
713 }; 713 };
714 714
715 function salir() { 715 function salir() {
716 var confirmacion = false; 716 var confirmacion = false;
717 717
718 if (!angular.equals($scope.cobranza, $scope.inicial)) { 718 if (!angular.equals($scope.cobranza, $scope.inicial)) {
719 confirmacion = true; 719 confirmacion = true;
720 } 720 }
721 721
722 if (confirmacion) { 722 if (confirmacion) {
723 focaModalService.confirm( 723 focaModalService.confirm(
724 '¿Está seguro de que desea salir? Se perderán todos los datos cargados.' 724 '¿Está seguro de que desea salir? Se perderán todos los datos cargados.'
725 ).then(function(data) { 725 ).then(function(data) {
726 if (data) { 726 if (data) {
727 $location.path('/'); 727 $location.path('/');
728 } 728 }
729 }); 729 });
730 } else { 730 } else {
731 $location.path('/'); 731 $location.path('/');
732 } 732 }
733 } 733 }
734 734
735 function setearCobranza(cobranza) { 735 function setearCobranza(cobranza) {
736 $scope.editando = true; 736 $scope.editando = true;
737 $scope.$broadcast('cleanCabecera'); 737 $scope.$broadcast('cleanCabecera');
738 738
739 if (cobranza.cliente) { 739 if (cobranza.cliente) {
740 $scope.$broadcast('addCabecera', { 740 $scope.$broadcast('addCabecera', {
741 label: 'Cliente:', 741 label: 'Cliente:',
742 valor: $filter('rellenarDigitos')(cobranza.cliente.COD, 5) + ' - ' + 742 valor: $filter('rellenarDigitos')(cobranza.cliente.COD, 5) + ' - ' +
743 cobranza.cliente.NOM 743 cobranza.cliente.NOM
744 }); 744 });
745 } 745 }
746 if (cobranza.cobrador && cobranza.cobrador.NUM) { 746 if (cobranza.cobrador && cobranza.cobrador.NUM) {
747 $scope.$broadcast('addCabecera', { 747 $scope.$broadcast('addCabecera', {
748 label: 'Cobrador:', 748 label: 'Cobrador:',
749 valor: (cobranza.cobrador.NUM) ? 749 valor: (cobranza.cobrador.NUM) ?
750 $filter('rellenarDigitos')(cobranza.cobrador.NUM, 5) + ' - ' + 750 $filter('rellenarDigitos')(cobranza.cobrador.NUM, 5) + ' - ' +
751 cobranza.cobrador.NOM : cobranza.cobrador 751 cobranza.cobrador.NOM : cobranza.cobrador
752 752
753 }); 753 });
754 } 754 }
755 755
756 $scope.cobranza = cobranza; 756 $scope.cobranza = cobranza;
757 } 757 }
758 758
759 function getLSCobranza() { 759 function getLSCobranza() {
760 var cobranza = JSON.parse($localStorage.cobranza || null); 760 var cobranza = JSON.parse($localStorage.cobranza || null);
761 if (cobranza) { 761 if (cobranza) {
762 setearCobranza(cobranza); 762 setearCobranza(cobranza);
763 delete $localStorage.cobranza; 763 delete $localStorage.cobranza;
764 } 764 }
765 } 765 }
766 766
767 function enviarMail(recibo) { 767 function enviarMail(recibo) {
768 focaModalService.mail( 768 focaModalService.mail(
769 { 769 {
770 titulo: 'Enviar recibo', 770 titulo: 'Enviar recibo',
771 descarga: { 771 descarga: {
772 nombre: recibo.recibo.PVE + '-' + recibo.recibo.NCO + '.pdf', 772 nombre: recibo.recibo.PVE + '-' + recibo.recibo.NCO + '.pdf',
773 url: '/mail/recibo/descargar', 773 url: '/mail/recibo/descargar',
774 }, 774 },
775 envio: { 775 envio: {
776 mailCliente: recibo.cliente.MAIL, 776 mailCliente: recibo.cliente.MAIL,
777 url: '/mail/recibo', 777 url: '/mail/recibo',
778 }, 778 },
779 options: { 779 options: {
780 recibo: recibo 780 recibo: recibo
781 } 781 }
782 } 782 }
783 ); 783 );
784 } 784 }
785 } 785 }
786 ]); 786 ]);
src/views/cobranza.html
1 <div class="crear-nota-pedido foca-crear row"> 1 <div class="crear-nota-pedido foca-crear row">
2 <foca-cabecera-facturador 2 <foca-cabecera-facturador
3 titulo="'Recibo de cobranza'" 3 titulo="'Recibo de cobranza'"
4 numero="puntoVenta + '-' + comprobante" 4 numero="puntoVenta + '-' + comprobante"
5 fecha="cobranza.fecha" 5 fecha="cobranza.fecha"
6 class="mb-0 col-lg-12" 6 class="mb-0 col-lg-12"
7 busqueda="seleccionarCobranza" 7 busqueda="seleccionarCobranza"
8 ></foca-cabecera-facturador> 8 ></foca-cabecera-facturador>
9 <div class="col-lg-12"> 9 <div class="col-lg-12">
10 <div class="row mt-4"> 10 <div class="row mt-4">
11 <div class="col-12 col-md-10 border border-light rounded"> 11 <div class="col-12 col-md-10 border border-light rounded">
12 <div class="row px-5 py-2 botonera-secundaria"> 12 <div class="row px-5 py-2 botonera-secundaria">
13 <div class="col-12"> 13 <div class="col-12">
14 <foca-botonera-facturador botones="botonera" extra="7" class="row"></foca-botonera-facturador> 14 <foca-botonera-facturador botones="botonera" extra="7" class="row"></foca-botonera-facturador>
15 </div> 15 </div>
16 </div> 16 </div>
17 <!-- PC --> 17 <!-- PC -->
18 <div class="row grilla-articulo align-items-end d-none d-sm-flex" ng-show="cobroDeuda"> 18 <div class="row grilla-articulo align-items-end d-none d-sm-flex" ng-show="cobroDeuda">
19 <table class="table tabla-articulo table-striped table-sm mb-0 rounded-bottom"> 19 <table class="table tabla-articulo table-striped table-sm mb-0 rounded-bottom">
20 <thead> 20 <thead>
21 <tr class="d-flex"> 21 <tr class="d-flex">
22 <th class="col-auto">#</th> 22 <th class="col-auto">#</th>
23 <th class="col">Comprobante</th> 23 <th class="col">Comprobante</th>
24 <th class="col">Fecha</th> 24 <th class="col">Fecha</th>
25 <th class="col">Importe</th> 25 <th class="col">Importe</th>
26 <th class="col-auto"> 26 <th class="col-auto">
27 <button 27 <button
28 class="btn btn-outline-light selectable" 28 class="btn btn-outline-light selectable"
29 ng-click="show = !show; masMenos()" 29 ng-click="show = !show; masMenos()"
30 > 30 >
31 <i 31 <i
32 class="fa fa-chevron-down" 32 class="fa fa-chevron-down"
33 ng-show="show" 33 ng-show="show"
34 aria-hidden="true" 34 aria-hidden="true"
35 > 35 >
36 </i> 36 </i>
37 <i 37 <i
38 class="fa fa-chevron-up" 38 class="fa fa-chevron-up"
39 ng-hide="show" 39 ng-hide="show"
40 aria-hidden="true"> 40 aria-hidden="true">
41 </i> 41 </i>
42 </button> 42 </button>
43 </th> 43 </th>
44 </th> 44 </th>
45 </tr> 45 </tr>
46 </thead> 46 </thead>
47 <tbody class="tabla-articulo-body"> 47 <tbody class="tabla-articulo-body">
48 <tr 48 <tr
49 ng-repeat="(key, factura) in cobranza.facturas" 49 ng-repeat="(key, factura) in cobranza.facturas"
50 class="d-flex" 50 class="d-flex"
51 ng-show="show || key == cobranza.facturas.length - 1" 51 ng-show="show || key == cobranza.facturas.length - 1"
52 > 52 >
53 <td ng-bind="key + 1" class="col-auto"></td> 53 <td ng-bind="key + 1" class="col-auto"></td>
54 <td class="col" ng-bind="factura.numeroFactura" 54 <td class="col" ng-bind="factura.numeroFactura"
55 ></td> 55 ></td>
56 <td class="col" ng-bind="factura.FEP | date : 'dd/MM/yyyy'"></td> 56 <td class="col" ng-bind="factura.FEP | date : 'dd/MM/yyyy'"></td>
57 <td 57 <td
58 class="col" 58 class="col"
59 ng-bind="(factura.IPA / cobranza.cotizacion.VENDEDOR) | 59 ng-bind="(factura.IPA / cobranza.cotizacion.VENDEDOR) |
60 number: 4"></td> 60 number: 4"></td>
61 <td class="text-center col-auto"> 61 <td class="text-center col-auto">
62 <button 62 <button
63 class="btn btn-outline-light" 63 class="btn btn-outline-light"
64 ng-click="quitarFactura(key)" 64 ng-click="quitarFactura(key)"
65 > 65 >
66 <i class="fa fa-trash"></i> 66 <i class="fa fa-trash"></i>
67 </button> 67 </button>
68 </td> 68 </td>
69 </tr> 69 </tr>
70 </tbody> 70 </tbody>
71 <tfoot> 71 <tfoot>
72 <tr ng-show="cargando" class="d-flex"> 72 <tr ng-show="cargando" class="d-flex">
73 <td class="col-2 border-top-0"> 73 <td class="col-2 border-top-0">
74 <a 74 <a
75 class="form-control form-control-sm btn btn-secondary" 75 class="form-control form-control-sm btn btn-secondary"
76 ng-click="seleccionarFactura()" 76 ng-click="seleccionarFactura()"
77 >Pendientes</a> 77 >Pendientes</a>
78 </td> 78 </td>
79 </tr> 79 </tr>
80 <tr class="d-flex"> 80 <tr class="d-flex">
81 <td class="col-auto px-1 border-top-0"> 81 <td class="col-auto px-1 border-top-0">
82 <strong>Comprobantes:</strong> 82 <strong>Comprobantes:</strong>
83 <a ng-bind="cobranza.facturas.length"></a> 83 <a ng-bind="cobranza.facturas.length"></a>
84 </td> 84 </td>
85 <td class="text-right ml-auto table-celda-total no-border-top"> 85 <td class="text-right ml-auto table-celda-total no-border-top">
86 <strong>Cancela:</strong> 86 <strong>Cancela:</strong>
87 </td> 87 </td>
88 <td class="table-celda-total text-right no-border-top"> 88 <td class="table-celda-total text-right no-border-top">
89 <strong>{{(getTotalDeuda() / cobranza.cotizacion.VENDEDOR) | 89 <strong>{{(getTotalDeuda() / cobranza.cotizacion.VENDEDOR) |
90 currency: cobranza.moneda.SIMBOLO}}</strong> 90 currency: cobranza.cotizacion.moneda.SIMBOLO}}</strong>
91 </td> 91 </td>
92 <td class="text-right ml-auto table-celda-total no-border-top"> 92 <td class="text-right ml-auto table-celda-total no-border-top">
93 <strong>Total Cobrado:</strong> 93 <strong>Total Cobrado:</strong>
94 </td> 94 </td>
95 <td class="table-celda-total text-right no-border-top"> 95 <td class="table-celda-total text-right no-border-top">
96 <strong>{{(getTotalCobrado() / cobranza.cotizacion.VENDEDOR) | 96 <strong>{{(getTotalCobrado() / cobranza.cotizacion.VENDEDOR) |
97 currency: cobranza.moneda.SIMBOLO}}</strong> 97 currency: cobranza.cotizacion.moneda.SIMBOLO}}</strong>
98 </td> 98 </td>
99 <td class="text-right ml-auto table-celda-total no-border-top"> 99 <td class="text-right ml-auto table-celda-total no-border-top">
100 <strong>DF:</strong> 100 <strong>DF:</strong>
101 </td> 101 </td>
102 <td class="table-celda-total text-right no-border-top mr-1"> 102 <td class="table-celda-total text-right no-border-top mr-1">
103 <strong>{{((getTotalCobrado() + getTotalDeuda()) / 103 <strong>{{((getTotalCobrado() + getTotalDeuda()) /
104 cobranza.cotizacion.VENDEDOR) | currency: cobranza.moneda.SIMBOLO}} 104 cobranza.cotizacion.VENDEDOR) | currency: cobranza.cotizacion.moneda.SIMBOLO}}
105 </strong> 105 </strong>
106 </td> 106 </td>
107 </tr> 107 </tr>
108 </tfoot> 108 </tfoot>
109 </table> 109 </table>
110 </div> 110 </div>
111 <div class="row grilla-articulo align-items-end d-none d-sm-flex" ng-show="!cobroDeuda"> 111 <div class="row grilla-articulo align-items-end d-none d-sm-flex" ng-show="!cobroDeuda">
112 <table class="table tabla-articulo table-striped table-sm mb-0 rounded-bottom"> 112 <table class="table tabla-articulo table-striped table-sm mb-0 rounded-bottom">
113 <thead> 113 <thead>
114 <tr class="d-flex"> 114 <tr class="d-flex">
115 <th class="col-auto">#</th> 115 <th class="col-auto">#</th>
116 <th class="col">Cobro</th> 116 <th class="col">Cobro</th>
117 <th class="col">Fecha</th> 117 <th class="col">Fecha</th>
118 <th class="col">Importe</th> 118 <th class="col">Importe</th>
119 <th class="col-auto"> 119 <th class="col-auto">
120 <button 120 <button
121 class="btn btn-outline-light selectable" 121 class="btn btn-outline-light selectable"
122 ng-click="show = !show; masMenos()" 122 ng-click="show = !show; masMenos()"
123 > 123 >
124 <i 124 <i
125 class="fa fa-chevron-down" 125 class="fa fa-chevron-down"
126 ng-show="show" 126 ng-show="show"
127 aria-hidden="true" 127 aria-hidden="true"
128 > 128 >
129 </i> 129 </i>
130 <i 130 <i
131 class="fa fa-chevron-up" 131 class="fa fa-chevron-up"
132 ng-hide="show" 132 ng-hide="show"
133 aria-hidden="true"> 133 aria-hidden="true">
134 </i> 134 </i>
135 </button> 135 </button>
136 </th> 136 </th>
137 </th> 137 </th>
138 </tr> 138 </tr>
139 </thead> 139 </thead>
140 <tbody class="tabla-articulo-body"> 140 <tbody class="tabla-articulo-body">
141 <tr 141 <tr
142 ng-repeat="(key, cobro) in cobranza.cobros" 142 ng-repeat="(key, cobro) in cobranza.cobros"
143 class="d-flex" 143 class="d-flex"
144 ng-show="show || key == cobranza.cobros.length - 1" 144 ng-show="show || key == cobranza.cobros.length - 1"
145 > 145 >
146 <td ng-bind="key + 1" class="col-auto"></td> 146 <td ng-bind="key + 1" class="col-auto"></td>
147 <td class="col" ng-bind="cobro.tipo"></td> 147 <td class="col" ng-bind="cobro.tipo"></td>
148 <td class="col" ng-bind="cobro.fecha | date : 'dd/MM/yyyy'"></td> 148 <td class="col" ng-bind="cobro.fecha | date : 'dd/MM/yyyy'"></td>
149 <td 149 <td
150 class="col" 150 class="col"
151 ng-bind="(cobro.importe / cobranza.cotizacion.VENDEDOR) | 151 ng-bind="(cobro.importe / cobranza.cotizacion.VENDEDOR) |
152 currency: cobranza.moneda.SIMBOLO : 4"></td> 152 currency: cobranza.moneda.SIMBOLO : 4"></td>
153 <td class="text-center col-auto"> 153 <td class="text-center col-auto">
154 <button 154 <button
155 class="btn btn-outline-light" 155 class="btn btn-outline-light"
156 ng-click="quitarCobro(key)" 156 ng-click="quitarCobro(key)"
157 > 157 >
158 <i class="fa fa-trash"></i> 158 <i class="fa fa-trash"></i>
159 </button> 159 </button>
160 </td> 160 </td>
161 </tr> 161 </tr>
162 </tbody> 162 </tbody>
163 <tfoot> 163 <tfoot>
164 <tr ng-show="cargando" class="d-flex"> 164 <tr ng-show="cargando" class="d-flex">
165 <td class="col-2 border-top-0"> 165 <td class="col-2 border-top-0">
166 <a 166 <a
167 class="form-control form-control-sm btn btn-secondary" 167 class="form-control form-control-sm btn btn-secondary"
168 ng-click="seleccionarCheque()" 168 ng-click="seleccionarCheque()"
169 >Cheque</a> 169 >Cheque</a>
170 </td> 170 </td>
171 <td class="col-2 border-top-0"> 171 <td class="col-2 border-top-0">
172 <a 172 <a
173 class="form-control form-control-sm btn btn-secondary" 173 class="form-control form-control-sm btn btn-secondary"
174 ng-click="seleccionarEfectivo()" 174 ng-click="seleccionarEfectivo()"
175 >Efectivo</a> 175 >Efectivo</a>
176 </td> 176 </td>
177 <td class="col-2 border-top-0"> 177 <td class="col-2 border-top-0">
178 <a 178 <a
179 class="form-control form-control-sm btn btn-secondary" 179 class="form-control form-control-sm btn btn-secondary"
180 ng-click="seleccionarDetalles()" 180 ng-click="seleccionarDetalles()"
181 >Detalle</a> 181 >Detalle</a>
182 </td> 182 </td>
183 </tr> 183 </tr>
184 <tr class="d-flex"> 184 <tr class="d-flex">
185 <td class="col-auto px-1 border-top-0"> 185 <td class="col-auto px-1 border-top-0">
186 <strong>Cobros:</strong> 186 <strong>Cobros:</strong>
187 <a ng-bind="cobranza.cobros.length"></a> 187 <a ng-bind="cobranza.cobros.length"></a>
188 </td> 188 </td>
189 <td class="text-right ml-auto table-celda-total no-border-top"> 189 <td class="text-right ml-auto table-celda-total no-border-top">
190 <strong>Cancela:</strong> 190 <strong>Cancela:</strong>
191 </td> 191 </td>
192 <td class="table-celda-total text-right no-border-top"> 192 <td class="table-celda-total text-right no-border-top">
193 <strong>{{(getTotalDeuda() / cobranza.cotizacion.VENDEDOR) | 193 <strong>{{(getTotalDeuda() / cobranza.cotizacion.VENDEDOR) |
194 currency: cobranza.moneda.SIMBOLO}}</strong> 194 currency: cobranza.cotizacion.moneda.SIMBOLO}}</strong>
195 </td> 195 </td>
196 <td class="text-right ml-auto table-celda-total no-border-top"> 196 <td class="text-right ml-auto table-celda-total no-border-top">
197 <strong>Total Cobrado:</strong> 197 <strong>Total Cobrado:</strong>
198 </td> 198 </td>
199 <td class="table-celda-total text-right no-border-top"> 199 <td class="table-celda-total text-right no-border-top">
200 <strong>{{(getTotalCobrado() / cobranza.cotizacion.VENDEDOR) | 200 <strong>{{(getTotalCobrado() / cobranza.cotizacion.VENDEDOR) |
201 currency: cobranza.moneda.SIMBOLO}}</strong> 201 currency: cobranza.cotizacion.moneda.SIMBOLO}}</strong>
202 </td> 202 </td>
203 <td class="text-right ml-auto table-celda-total no-border-top"> 203 <td class="text-right ml-auto table-celda-total no-border-top">
204 <strong>DF:</strong> 204 <strong>DF:</strong>
205 </td> 205 </td>
206 <td class="table-celda-total text-right no-border-top mr-1"> 206 <td class="table-celda-total text-right no-border-top mr-1">
207 <strong>{{((getTotalCobrado() + getTotalDeuda()) / 207 <strong>{{((getTotalCobrado() + getTotalDeuda()) /
208 cobranza.cotizacion.VENDEDOR) | currency: cobranza.moneda.SIMBOLO}} 208 cobranza.cotizacion.VENDEDOR) | currency: cobranza.cotizacion.moneda.SIMBOLO}}
209 </strong> 209 </strong>
210 </td> 210 </td>
211 </tr> 211 </tr>
212 </tfoot> 212 </tfoot>
213 </table> 213 </table>
214 </div> 214 </div>
215 <!-- MOBILE --> 215 <!-- MOBILE -->
216 <div class="row d-sm-none mb-5"> 216 <div class="row d-sm-none mb-5">
217 <!-- FACTURAS --> 217 <!-- FACTURAS -->
218 <table class="table table-sm table-striped tabla-articulo mb-5" ng-show="cobroDeuda"> 218 <table class="table table-sm table-striped tabla-articulo mb-5" ng-show="cobroDeuda">
219 <thead> 219 <thead>
220 <tr class="d-flex"> 220 <tr class="d-flex">
221 <th class="">#</th> 221 <th class="">#</th>
222 <th class="col px-0"> 222 <th class="col px-0">
223 <div class="d-flex"> 223 <div class="d-flex">
224 <div class="col-4 px-1">Factura</div> 224 <div class="col-4 px-1">Factura</div>
225 <div class="col-4 px-1">Fecha</div> 225 <div class="col-4 px-1">Fecha</div>
226 <div class="col-4 px-1">Importe</div> 226 <div class="col-4 px-1">Importe</div>
227 </div> 227 </div>
228 </th> 228 </th>
229 <th class="text-center tamaño-boton"> 229 <th class="text-center tamaño-boton">
230 &nbsp; 230 &nbsp;
231 </th> 231 </th>
232 </tr> 232 </tr>
233 </thead> 233 </thead>
234 <tbody> 234 <tbody>
235 <tr 235 <tr
236 ng-repeat="(key, factura) in cobranza.facturas" 236 ng-repeat="(key, factura) in cobranza.facturas"
237 ng-show="show || key == cobranza.facturas.length - 1" 237 ng-show="show || key == cobranza.facturas.length - 1"
238 > 238 >
239 <td class="w-100 align-middle d-flex p-0"> 239 <td class="w-100 align-middle d-flex p-0">
240 <div class="align-middle p-1"> 240 <div class="align-middle p-1">
241 <span ng-bind="key+1" class="align-middle"></span> 241 <span ng-bind="key+1" class="align-middle"></span>
242 </div> 242 </div>
243 <div class="col px-0"> 243 <div class="col px-0">
244 <div class="d-flex"> 244 <div class="d-flex">
245 <div class="col-4 p-1"> 245 <div class="col-4 p-1">
246 <span ng-bind="factura.numeroFactura" 246 <span ng-bind="factura.numeroFactura"
247 ></span> 247 ></span>
248 </div> 248 </div>
249 <div class="col-4 p-1"> 249 <div class="col-4 p-1">
250 <span ng-bind="factura.FEP | date : 'dd/MM/yyyy'"></span> 250 <span ng-bind="factura.FEP | date : 'dd/MM/yyyy'"></span>
251 </div> 251 </div>
252 <div class="col-4 p-1"> 252 <div class="col-4 p-1">
253 <span 253 <span
254 ng-bind="(factura.IPA / cobranza.cotizacion.VENDEDOR) | 254 ng-bind="(factura.IPA / cobranza.cotizacion.VENDEDOR) |
255 currency:cobranza.moneda.SIMBOLO : 4"></span> 255 currency:cobranza.moneda.SIMBOLO : 4"></span>
256 </div> 256 </div>
257 </div> 257 </div>
258 </div> 258 </div>
259 <div class="align-middle p-1"> 259 <div class="align-middle p-1">
260 <button 260 <button
261 class="btn btn-outline-light" 261 class="btn btn-outline-light"
262 ng-click="quitarFactura(key)" 262 ng-click="quitarFactura(key)"
263 > 263 >
264 <i class="fa fa-trash"></i> 264 <i class="fa fa-trash"></i>
265 </button> 265 </button>
266 </div> 266 </div>
267 </td> 267 </td>
268 </tr> 268 </tr>
269 </tbody> 269 </tbody>
270 <tfoot> 270 <tfoot>
271 <!-- SELECCIONAR PRODUCTO --> 271 <!-- SELECCIONAR PRODUCTO -->
272 <tr ng-show="cargando" class="d-flex"> 272 <tr ng-show="cargando" class="d-flex">
273 <td class="col-12"> 273 <td class="col-12">
274 <input 274 <input
275 placeholder="Seleccione Factura" 275 placeholder="Seleccione Factura"
276 class="form-control form-control-sm" 276 class="form-control form-control-sm"
277 readonly 277 readonly
278 ng-click="seleccionarFactura()" 278 ng-click="seleccionarFactura()"
279 /> 279 />
280 </td> 280 </td>
281 </tr> 281 </tr>
282 <!-- TOOGLE EXPANDIR --> 282 <!-- TOOGLE EXPANDIR -->
283 <tr> 283 <tr>
284 <td class="col"> 284 <td class="col">
285 <button 285 <button
286 class="btn btn-outline-light selectable w-100" 286 class="btn btn-outline-light selectable w-100"
287 ng-click="show = !show; masMenos()" 287 ng-click="show = !show; masMenos()"
288 ng-show="cobranza.facturas.length > 0" 288 ng-show="cobranza.facturas.length > 0"
289 > 289 >
290 <i 290 <i
291 class="fa fa-chevron-down" 291 class="fa fa-chevron-down"
292 ng-hide="show" 292 ng-hide="show"
293 aria-hidden="true" 293 aria-hidden="true"
294 > 294 >
295 </i> 295 </i>
296 <i 296 <i
297 class="fa fa-chevron-up" 297 class="fa fa-chevron-up"
298 ng-show="show" 298 ng-show="show"
299 aria-hidden="true"> 299 aria-hidden="true">
300 </i> 300 </i>
301 </button> 301 </button>
302 </td> 302 </td>
303 </tr> 303 </tr>
304 <!-- FOOTER --> 304 <!-- FOOTER -->
305 <tr class="d-flex"> 305 <tr class="d-flex">
306 <td class="align-middle no-border-top" colspan="2"> 306 <td class="align-middle no-border-top" colspan="2">
307 <strong>Cantidad Items:</strong> 307 <strong>Cantidad Items:</strong>
308 <a ng-bind="cobranza.facturas.length"></a> 308 <a ng-bind="cobranza.facturas.length"></a>
309 </td> 309 </td>
310 </tr> 310 </tr>
311 </tfoot> 311 </tfoot>
312 </table> 312 </table>
313 <!-- COBROS --> 313 <!-- COBROS -->
314 <table class="table table-sm table-striped tabla-articulo mb-5" ng-show="!cobroDeuda"> 314 <table class="table table-sm table-striped tabla-articulo mb-5" ng-show="!cobroDeuda">
315 <thead> 315 <thead>
316 <tr class="d-flex"> 316 <tr class="d-flex">
317 <th class="">#</th> 317 <th class="">#</th>
318 <th class="col px-0"> 318 <th class="col px-0">
319 <div class="d-flex"> 319 <div class="d-flex">
320 <div class="col-4 px-1">Cobro</div> 320 <div class="col-4 px-1">Cobro</div>
321 <div class="col-4 px-1">Fecha</div> 321 <div class="col-4 px-1">Fecha</div>
322 <div class="col-4 px-1">Importe</div> 322 <div class="col-4 px-1">Importe</div>
323 </div> 323 </div>
324 </th> 324 </th>
325 <th class="text-center tamaño-boton"> 325 <th class="text-center tamaño-boton">
326 &nbsp; 326 &nbsp;
327 </th> 327 </th>
328 </tr> 328 </tr>
329 </thead> 329 </thead>
330 <tbody> 330 <tbody>
331 <tr 331 <tr
332 ng-repeat="(key, cobro) in cobranza.cobros" 332 ng-repeat="(key, cobro) in cobranza.cobros"
333 ng-show="show || key == cobranza.cobros.length - 1" 333 ng-show="show || key == cobranza.cobros.length - 1"
334 > 334 >
335 <td class="w-100 align-middle d-flex p-0"> 335 <td class="w-100 align-middle d-flex p-0">
336 <div class="align-middle p-1"> 336 <div class="align-middle p-1">
337 <span ng-bind="key+1" class="align-middle"></span> 337 <span ng-bind="key+1" class="align-middle"></span>
338 </div> 338 </div>
339 <div class="col px-0"> 339 <div class="col px-0">
340 <div class="d-flex"> 340 <div class="d-flex">
341 <div class="col-4 p-1"> 341 <div class="col-4 p-1">
342 <span ng-bind="cobro.tipo" 342 <span ng-bind="cobro.tipo"
343 ></span> 343 ></span>
344 </div> 344 </div>
345 <div class="col-4 p-1"> 345 <div class="col-4 p-1">
346 <span ng-bind="cobro.fecha | date : 'dd/MM/yyyy'"></span> 346 <span ng-bind="cobro.fecha | date : 'dd/MM/yyyy'"></span>
347 </div> 347 </div>
348 <div class="col-4 p-1"> 348 <div class="col-4 p-1">
349 <span 349 <span
350 ng-bind="(cobro.importe / cobranza.cotizacion.VENDEDOR) | 350 ng-bind="(cobro.importe / cobranza.cotizacion.VENDEDOR) |
351 currency: cobranza.moneda.SIMBOLO : 4"></span> 351 currency: cobranza.moneda.SIMBOLO : 4"></span>
352 </div> 352 </div>
353 </div> 353 </div>
354 </div> 354 </div>
355 <div class="align-middle p-1"> 355 <div class="align-middle p-1">
356 <button 356 <button
357 class="btn btn-outline-light" 357 class="btn btn-outline-light"
358 ng-click="quitarCobro(key)" 358 ng-click="quitarCobro(key)"
359 > 359 >
360 <i class="fa fa-trash"></i> 360 <i class="fa fa-trash"></i>
361 </button> 361 </button>
362 </div> 362 </div>
363 </td> 363 </td>
364 </tr> 364 </tr>
365 </tbody> 365 </tbody>
366 <tfoot> 366 <tfoot>
367 <!-- SELECCIONAR PRODUCTO --> 367 <!-- SELECCIONAR PRODUCTO -->
368 <tr ng-show="cargando" class="d-flex"> 368 <tr ng-show="cargando" class="d-flex">
369 <td class="col-4"> 369 <td class="col-4">
370 <input 370 <input
371 placeholder="Cheque" 371 placeholder="Cheque"
372 class="form-control form-control-sm" 372 class="form-control form-control-sm"
373 readonly 373 readonly
374 ng-click="seleccionarCheque()" 374 ng-click="seleccionarCheque()"
375 /> 375 />
376 </td> 376 </td>
377 <td class="col-4"> 377 <td class="col-4">
378 <input 378 <input
379 placeholder="Efectivo" 379 placeholder="Efectivo"
380 class="form-control form-control-sm" 380 class="form-control form-control-sm"
381 readonly 381 readonly
382 ng-click="seleccionarEfectivo()" 382 ng-click="seleccionarEfectivo()"
383 /> 383 />
384 </td> 384 </td>
385 <td class="col-4"> 385 <td class="col-4">
386 <input 386 <input
387 placeholder="Detalles" 387 placeholder="Detalles"
388 class="form-control form-control-sm" 388 class="form-control form-control-sm"
389 readonly 389 readonly
390 ng-click="seleccionarDetalles()" 390 ng-click="seleccionarDetalles()"
391 /> 391 />
392 </td> 392 </td>
393 </tr> 393 </tr>
394 <!-- TOOGLE EXPANDIR --> 394 <!-- TOOGLE EXPANDIR -->
395 <tr> 395 <tr>
396 <td class="col"> 396 <td class="col">
397 <button 397 <button
398 class="btn btn-outline-light selectable w-100" 398 class="btn btn-outline-light selectable w-100"
399 ng-click="show = !show; masMenos()" 399 ng-click="show = !show; masMenos()"
400 ng-show="cobranza.cobros.length > 0" 400 ng-show="cobranza.cobros.length > 0"
401 > 401 >
402 <i 402 <i
403 class="fa fa-chevron-down" 403 class="fa fa-chevron-down"
404 ng-hide="show" 404 ng-hide="show"
405 aria-hidden="true" 405 aria-hidden="true"
406 > 406 >
407 </i> 407 </i>
408 <i 408 <i
409 class="fa fa-chevron-up" 409 class="fa fa-chevron-up"
410 ng-show="show" 410 ng-show="show"
411 aria-hidden="true"> 411 aria-hidden="true">
412 </i> 412 </i>
413 </button> 413 </button>
414 </td> 414 </td>
415 </tr> 415 </tr>
416 <!-- FOOTER --> 416 <!-- FOOTER -->
417 <tr class="d-flex"> 417 <tr class="d-flex">
418 <td class="align-middle no-border-top col-6"> 418 <td class="align-middle no-border-top col-6">
419 <strong>Cantidad Items:</strong> 419 <strong>Cantidad Items:</strong>
420 <a ng-bind="cobranza.cobros.length"></a> 420 <a ng-bind="cobranza.cobros.length"></a>
421 </td> 421 </td>
422 </tfoot> 422 </tfoot>
423 </table> 423 </table>
424 </tr> 424 </tr>
425 <!-- DEUDA, COBRADO, DIFERENCIA --> 425 <!-- DEUDA, COBRADO, DIFERENCIA -->
426 <table class="table-responsive fixed-bottom mb-5"> 426 <table class="table-responsive fixed-bottom mb-5">
427 <tr class="d-flex row"> 427 <tr class="d-flex row">
428 <td class="text-center ml-auto table-celda-total no-border-top col-4"> 428 <td class="text-center ml-auto table-celda-total no-border-top col-4">
429 <strong>Cancela:</strong> 429 <strong>Cancela:</strong>
430 </td> 430 </td>
431 <td class="text-center ml-auto table-celda-total no-border-top col-4"> 431 <td class="text-center ml-auto table-celda-total no-border-top col-4">
432 <strong>Cobrado:</strong> 432 <strong>Cobrado:</strong>
433 </td> 433 </td>
434 <td class="text-center ml-auto table-celda-total no-border-top col-4"> 434 <td class="text-center ml-auto table-celda-total no-border-top col-4">
435 <strong>Diferencia:</strong> 435 <strong>Diferencia:</strong>
436 </td> 436 </td>
437 <td class="table-celda-total text-center no-border-top col-4"> 437 <td class="table-celda-total text-center no-border-top col-4">
438 <strong>{{(getTotalDeuda() / cobranza.cotizacion.VENDEDOR) | currency: cobranza.moneda.SIMBOLO}}</strong> 438 <strong>{{(getTotalDeuda() / cobranza.cotizacion.VENDEDOR) | currency: cobranza.cotizacion.moneda.SIMBOLO}}</strong>
439 </td> 439 </td>
440 <td class="table-celda-total text-center no-border-top col-4"> 440 <td class="table-celda-total text-center no-border-top col-4">
441 <strong>{{(getTotalCobrado() / cobranza.cotizacion.VENDEDOR) | currency: cobranza.moneda.SIMBOLO}}</strong> 441 <strong>{{(getTotalCobrado() / cobranza.cotizacion.VENDEDOR) | currency: cobranza.cotizacion.moneda.SIMBOLO}}</strong>
442 </td> 442 </td>
443 <td class="table-celda-total text-center no-border-top col-4"> 443 <td class="table-celda-total text-center no-border-top col-4">
444 <strong>{{((getTotalCobrado() + getTotalDeuda()) / cobranza.cotizacion.VENDEDOR) | currency: cobranza.moneda.SIMBOLO}}</strong> 444 <strong>{{((getTotalCobrado() + getTotalDeuda()) / cobranza.cotizacion.VENDEDOR) | currency: cobranza.cotizacion.moneda.SIMBOLO}}</strong>
445 </td> 445 </td>
446 </tr> 446 </tr>
447 </table> 447 </table>
448 </div> 448 </div>
449 </div> 449 </div>
450 </div> 450 </div>
451 </div> 451 </div>
452 <div class="row d-md-none fixed-bottom"> 452 <div class="row d-md-none fixed-bottom">
453 <div class="w-100 bg-dark d-flex px-3 acciones-mobile"> 453 <div class="w-100 bg-dark d-flex px-3 acciones-mobile">
454 <span class="ml-3 text-muted" ng-click="salir()">Salir</span> 454 <span class="ml-3 text-muted" ng-click="salir()">Salir</span>
455 <span 455 <span
456 class="mr-3 ml-auto" 456 class="mr-3 ml-auto"
457 ng-class="saveLoading ? 'text-muted' : ''" 457 ng-class="saveLoading ? 'text-muted' : ''"
458 ng-click="crearCobranza()" 458 ng-click="crearCobranza()"
459 ng-show="!editando" 459 ng-show="!editando"
460 ladda="saveLoading" 460 ladda="saveLoading"
461 data-style="expand-left" 461 data-style="expand-left"
462 >Guardar</span> 462 >Guardar</span>
463 </div> 463 </div>
464 </div> 464 </div>
465 </div> 465 </div>
466 466