Commit da53adbda8b5f74459b6eb2aafa09bda09b255f8
1 parent
a75d80f78f
Exists in
master
Codigo identado.
Showing
1 changed file
with
121 additions
and
122 deletions
Show diff stats
src/js/controller.js
1 | -angular.module('focaCrearCobranza') .controller('cobranzaController', | |
1 | +angular.module('focaCrearCobranza').controller('cobranzaController', | |
2 | 2 | [ |
3 | 3 | '$scope', '$timeout', '$uibModal', '$location', |
4 | 4 | 'focaCrearCobranzaService', 'focaModalService', '$filter', 'focaSeguimientoService', |
5 | 5 | 'focaBotoneraLateralService', 'APP', 'focaLoginService', '$localStorage', |
6 | - function($scope, $timeout, $uibModal, $location, focaCrearCobranzaService, | |
6 | + function ($scope, $timeout, $uibModal, $location, focaCrearCobranzaService, | |
7 | 7 | focaModalService, $filter, focaSeguimientoService, focaBotoneraLateralService, |
8 | - APP, loginService, $localStorage) | |
9 | - { | |
8 | + APP, loginService, $localStorage) { | |
10 | 9 | config(); |
11 | 10 | |
12 | 11 | function config() { |
... | ... | @@ -23,17 +22,17 @@ angular.module('focaCrearCobranza') .controller('cobranzaController', |
23 | 22 | }; |
24 | 23 | |
25 | 24 | //Trabajo con la cotización más reciente, por eso uso siempre la primera '[0]' |
26 | - focaCrearCobranzaService.getCotizacionByIdMoneda(1).then(function(res) { | |
25 | + focaCrearCobranzaService.getCotizacionByIdMoneda(1).then(function (res) { | |
27 | 26 | var moneda = res.data[0]; |
28 | 27 | moneda.cotizacion = moneda.cotizaciones[0]; |
29 | 28 | $scope.cobranza.moneda = $scope.inicial.moneda = moneda; |
30 | - $filter('filter')( $scope.botonera, { | |
29 | + $filter('filter')($scope.botonera, { | |
31 | 30 | label: 'Moneda' |
32 | 31 | })[0].checked = true; |
33 | - $timeout(function() { getLSCobranza();} ); | |
32 | + $timeout(function () { getLSCobranza(); }); | |
34 | 33 | }); |
35 | 34 | |
36 | - $timeout(function() { | |
35 | + $timeout(function () { | |
37 | 36 | focaBotoneraLateralService.showSalir(false); |
38 | 37 | focaBotoneraLateralService.showPausar(true); |
39 | 38 | focaBotoneraLateralService.showGuardar(true, $scope.crearCobranza); |
... | ... | @@ -60,7 +59,7 @@ angular.module('focaCrearCobranza') .controller('cobranzaController', |
60 | 59 | |
61 | 60 | if (APP === 'cobranza') { |
62 | 61 | focaCrearCobranzaService.getCobradorById($scope.idCobrador).then( |
63 | - function(res) { | |
62 | + function (res) { | |
64 | 63 | var cobrador = res.data; |
65 | 64 | |
66 | 65 | $scope.$broadcast('addCabecera', { |
... | ... | @@ -78,7 +77,7 @@ angular.module('focaCrearCobranza') .controller('cobranzaController', |
78 | 77 | $scope.inicial = angular.copy($scope.cobranza); |
79 | 78 | |
80 | 79 | focaCrearCobranzaService.getNumeroRecibo().then( |
81 | - function(res) { | |
80 | + function (res) { | |
82 | 81 | $scope.puntoVenta = $filter('rellenarDigitos')( |
83 | 82 | res.data.sucursal, 4 |
84 | 83 | ); |
... | ... | @@ -87,7 +86,7 @@ angular.module('focaCrearCobranza') .controller('cobranzaController', |
87 | 86 | res.data.numeroRecibo, 8 |
88 | 87 | ); |
89 | 88 | }, |
90 | - function(err) { | |
89 | + function (err) { | |
91 | 90 | focaModalService.alert( |
92 | 91 | 'La terminal no esta configurada correctamente' |
93 | 92 | ); |
... | ... | @@ -96,14 +95,14 @@ angular.module('focaCrearCobranza') .controller('cobranzaController', |
96 | 95 | ); |
97 | 96 | } |
98 | 97 | |
99 | - $scope.$watch('cobranza', function(newValue) { | |
98 | + $scope.$watch('cobranza', function (newValue) { | |
100 | 99 | focaBotoneraLateralService.setPausarData({ |
101 | 100 | label: 'cobranza', |
102 | 101 | val: newValue |
103 | 102 | }); |
104 | 103 | }, true); |
105 | 104 | |
106 | - $scope.crearCobranza = function() { | |
105 | + $scope.crearCobranza = function () { | |
107 | 106 | if (!$scope.cobranza.cliente.COD) { |
108 | 107 | focaModalService.alert('Ingrese Cliente'); |
109 | 108 | return; |
... | ... | @@ -130,7 +129,7 @@ angular.module('focaCrearCobranza') .controller('cobranzaController', |
130 | 129 | $scope.editando = false; |
131 | 130 | focaBotoneraLateralService.startGuardar(); |
132 | 131 | $scope.saveLoading = true; |
133 | - for(var i = 0; i < $scope.cobranza.facturas.length; i++) { | |
132 | + for (var i = 0; i < $scope.cobranza.facturas.length; i++) { | |
134 | 133 | var cuerpoFactura = { |
135 | 134 | CYV: 'V', |
136 | 135 | TIP: 'C', |
... | ... | @@ -144,7 +143,7 @@ angular.module('focaCrearCobranza') .controller('cobranzaController', |
144 | 143 | FEC: new Date($scope.cobranza.FEC) |
145 | 144 | .toISOString().slice(0, 19).replace('T', ' '), |
146 | 145 | IMP: Math.abs($scope.cobranza.facturas[i].IMP || |
147 | - $scope.cobranza.facturas[i].IPA), | |
146 | + $scope.cobranza.facturas[i].IPA), | |
148 | 147 | RES: 0,//caja de tesorería |
149 | 148 | SUBM: 0, |
150 | 149 | NCU: $scope.cobranza.facturas[i].NCU |
... | ... | @@ -162,7 +161,7 @@ angular.module('focaCrearCobranza') .controller('cobranzaController', |
162 | 161 | LOP: 'P', |
163 | 162 | TIL: $scope.cobranza.cobros[j].TIL, |
164 | 163 | COM: efectivo ? 'ef(COBRO EN EFECTIVO)' : $scope.cobranza.cobros[j].COM, |
165 | - FEC: !$scope.cobranza.cobros[j].fechaPresentacion ? | |
164 | + FEC: !$scope.cobranza.cobros[j].fechaPresentacion ? | |
166 | 165 | new Date($scope.cobranza.cobros[j].FEC) |
167 | 166 | .toISOString().slice(0, 19).replace('T', ' ') : |
168 | 167 | new Date($scope.cobranza.cobros[j].fechaPresentacion) |
... | ... | @@ -201,7 +200,7 @@ angular.module('focaCrearCobranza') .controller('cobranzaController', |
201 | 200 | ORI: 've', |
202 | 201 | FER: '', |
203 | 202 | BIMP: 0, |
204 | - COMP: 'C ' +'RC ' + $scope.puntoVenta + '-' + $scope.comprobante, | |
203 | + COMP: 'C ' + 'RC ' + $scope.puntoVenta + '-' + $scope.comprobante, | |
205 | 204 | VAL_E: '',//Cuando egresa por ingresos y egresos en el numero de egreso |
206 | 205 | VAL_I: '',//Cuando Ingresa por ingresos y egresos en el numero ingreso |
207 | 206 | REC_CAJ: 'D', |
... | ... | @@ -222,7 +221,7 @@ angular.module('focaCrearCobranza') .controller('cobranzaController', |
222 | 221 | }; |
223 | 222 | cheques.push(cheque); |
224 | 223 | } |
225 | - if ($scope.cobranza.cobros[j].imgs) imgs = $scope.cobranza.cobros[j].imgs; | |
224 | + if ($scope.cobranza.cobros[j].imgs) imgs = $scope.cobranza.cobros[j].imgs; | |
226 | 225 | |
227 | 226 | } |
228 | 227 | |
... | ... | @@ -286,44 +285,44 @@ angular.module('focaCrearCobranza') .controller('cobranzaController', |
286 | 285 | //COPIO cobranzaMail Y A cobranza LE ELIMINO EL VALOR NCU DE LOS CUERPOS |
287 | 286 | var cobranzaMail = angular.copy(cobranza); |
288 | 287 | |
289 | - cobranza.cuerpo = cobranza.cuerpo.map(function(c) { | |
288 | + cobranza.cuerpo = cobranza.cuerpo.map(function (c) { | |
290 | 289 | if (c.NCU) delete c.NCU; |
291 | 290 | return c; |
292 | 291 | }); |
293 | 292 | focaCrearCobranzaService |
294 | 293 | .guardarCobranza(cobranza) |
295 | 294 | .then( |
296 | - function(result) { | |
297 | - focaBotoneraLateralService.endGuardar(true); | |
298 | - $scope.saveLoading = false; | |
299 | - | |
300 | - enviarMail(cobranzaMail); | |
301 | - | |
302 | - focaSeguimientoService.guardarPosicion( | |
303 | - 'Cobranza', | |
304 | - result.data, | |
305 | - '' | |
306 | - ); | |
307 | - | |
308 | - config(); | |
309 | - }, function(error) { | |
310 | - focaModalService.alert('Hubo un problema al cargar la cobranza'); | |
311 | - focaBotoneraLateralService.endGuardar(); | |
312 | - $scope.saveLoading = false; | |
313 | - console.info(error); | |
314 | - } | |
315 | - ); | |
295 | + function (result) { | |
296 | + focaBotoneraLateralService.endGuardar(true); | |
297 | + $scope.saveLoading = false; | |
298 | + | |
299 | + enviarMail(cobranzaMail); | |
300 | + | |
301 | + focaSeguimientoService.guardarPosicion( | |
302 | + 'Cobranza', | |
303 | + result.data, | |
304 | + '' | |
305 | + ); | |
306 | + | |
307 | + config(); | |
308 | + }, function (error) { | |
309 | + focaModalService.alert('Hubo un problema al cargar la cobranza'); | |
310 | + focaBotoneraLateralService.endGuardar(); | |
311 | + $scope.saveLoading = false; | |
312 | + console.info(error); | |
313 | + } | |
314 | + ); | |
316 | 315 | }; |
317 | 316 | |
318 | - $scope.seleccionarCobros = function() { | |
317 | + $scope.seleccionarCobros = function () { | |
319 | 318 | $scope.cobroDeuda = false; |
320 | 319 | }; |
321 | 320 | |
322 | - $scope.seleccionarComprobantes = function() { | |
321 | + $scope.seleccionarComprobantes = function () { | |
323 | 322 | $scope.cobroDeuda = true; |
324 | 323 | }; |
325 | 324 | |
326 | - $scope.seleccionarCobranza = function() { | |
325 | + $scope.seleccionarCobranza = function () { | |
327 | 326 | var modalInstance = $uibModal.open( |
328 | 327 | { |
329 | 328 | ariaLabelledBy: 'Busqueda de Cobranzas', |
... | ... | @@ -332,13 +331,13 @@ angular.module('focaCrearCobranza') .controller('cobranzaController', |
332 | 331 | size: 'lg' |
333 | 332 | } |
334 | 333 | ); |
335 | - modalInstance.result.then(function(cobranza) { | |
334 | + modalInstance.result.then(function (cobranza) { | |
336 | 335 | cobranza.moneda.cotizacion = cobranza.moneda.cotizaciones[0]; |
337 | 336 | setearCobranza(cobranza); |
338 | 337 | }); |
339 | 338 | }; |
340 | 339 | |
341 | - $scope.seleccionarResumenDeCuenta = function() { | |
340 | + $scope.seleccionarResumenDeCuenta = function () { | |
342 | 341 | if (!$scope.cobranza.cliente.COD) { |
343 | 342 | focaModalService.alert('Seleccione primero un cliente'); |
344 | 343 | return; |
... | ... | @@ -349,21 +348,21 @@ angular.module('focaCrearCobranza') .controller('cobranzaController', |
349 | 348 | templateUrl: 'modal-resumen-cuenta.html', |
350 | 349 | controller: 'focaModalResumenCuentaController', |
351 | 350 | resolve: { |
352 | - cliente: function() { return $scope.cobranza.cliente; }, | |
353 | - idMoneda: function() { return $scope.cobranza.moneda.ID; } | |
351 | + cliente: function () { return $scope.cobranza.cliente; }, | |
352 | + idMoneda: function () { return $scope.cobranza.moneda.ID; } | |
354 | 353 | }, |
355 | 354 | size: 'lg' |
356 | 355 | } |
357 | 356 | ); |
358 | 357 | modalInstance.result.then( |
359 | - function(cliente) { | |
358 | + function (cliente) { | |
360 | 359 | $scope.abrirModalDomicilios(cliente); |
361 | 360 | $scope.cliente = cliente; |
362 | - }, function() {} | |
361 | + }, function () { } | |
363 | 362 | ); |
364 | 363 | }; |
365 | 364 | |
366 | - $scope.seleccionarCliente = function() { | |
365 | + $scope.seleccionarCliente = function () { | |
367 | 366 | if ($scope.cobranza.id === undefined) { |
368 | 367 | var modalInstance = $uibModal.open( |
369 | 368 | { |
... | ... | @@ -371,14 +370,14 @@ angular.module('focaCrearCobranza') .controller('cobranzaController', |
371 | 370 | templateUrl: 'foca-busqueda-cliente-modal.html', |
372 | 371 | controller: 'focaBusquedaClienteModalController', |
373 | 372 | resolve: { |
374 | - vendedor: function() { return null; }, | |
375 | - cobrador: function() { return null; } | |
373 | + vendedor: function () { return null; }, | |
374 | + cobrador: function () { return null; } | |
376 | 375 | }, |
377 | 376 | size: 'lg' |
378 | 377 | } |
379 | 378 | ); |
380 | 379 | modalInstance.result.then( |
381 | - function(cliente) { | |
380 | + function (cliente) { | |
382 | 381 | //ELIMINO CLIENTE |
383 | 382 | $scope.$broadcast('removeCabecera', 'Cliente:'); |
384 | 383 | $scope.cobranza.cliente = {}; |
... | ... | @@ -408,13 +407,13 @@ angular.module('focaCrearCobranza') .controller('cobranzaController', |
408 | 407 | }); |
409 | 408 | |
410 | 409 | $filter('filter')($scope.botonera, |
411 | - { label: 'Cliente'})[0].checked = true; | |
410 | + { label: 'Cliente' })[0].checked = true; | |
412 | 411 | |
413 | 412 | $scope.cobranza.cliente = clienteMayus; |
414 | 413 | $scope.cobranza.facturas = []; |
415 | 414 | focaCrearCobranzaService |
416 | 415 | .getCobradorById($scope.cobranza.cliente.idCobrador); |
417 | - }, function() { | |
416 | + }, function () { | |
418 | 417 | } |
419 | 418 | ); |
420 | 419 | } else { |
... | ... | @@ -423,7 +422,7 @@ angular.module('focaCrearCobranza') .controller('cobranzaController', |
423 | 422 | } |
424 | 423 | }; |
425 | 424 | |
426 | - $scope.seleccionarFactura = function() { | |
425 | + $scope.seleccionarFactura = function () { | |
427 | 426 | if ($scope.cobranza.id === undefined) { |
428 | 427 | if (!$scope.cobranza.cliente.COD) { |
429 | 428 | focaModalService.alert('Seleccione primero un cliente'); |
... | ... | @@ -436,7 +435,7 @@ angular.module('focaCrearCobranza') .controller('cobranzaController', |
436 | 435 | controller: 'focaModalFacturaController', |
437 | 436 | size: 'lg', |
438 | 437 | resolve: { |
439 | - parametrosFactura: function() { | |
438 | + parametrosFactura: function () { | |
440 | 439 | return { |
441 | 440 | cliente: $scope.cobranza.cliente, |
442 | 441 | simbolo: $scope.cobranza.moneda.SIMBOLO, |
... | ... | @@ -448,20 +447,20 @@ angular.module('focaCrearCobranza') .controller('cobranzaController', |
448 | 447 | } |
449 | 448 | ); |
450 | 449 | modalInstance.result.then( |
451 | - function(facturas) { | |
450 | + function (facturas) { | |
452 | 451 | var facturasResult = []; |
453 | 452 | //AGREGO A FACTURASRESULT LAS FACTURAS QUE NO HAN SIDO SELECCIONADAS |
454 | - facturas.forEach(function(factura) { | |
455 | - var existe = $scope.cobranza.facturas.filter(function(e) { | |
453 | + facturas.forEach(function (factura) { | |
454 | + var existe = $scope.cobranza.facturas.filter(function (e) { | |
456 | 455 | return angular.equals(factura, e); |
457 | 456 | }); |
458 | 457 | |
459 | 458 | if (!existe.length) facturasResult.push(factura); |
460 | 459 | }); |
461 | 460 | |
462 | - $scope.cobranza.facturas = | |
461 | + $scope.cobranza.facturas = | |
463 | 462 | $scope.cobranza.facturas.concat(facturasResult); |
464 | - }, function() { } | |
463 | + }, function () { } | |
465 | 464 | ); |
466 | 465 | } else { |
467 | 466 | focaModalService.alert('Esta cobranza no se puede editar'); |
... | ... | @@ -470,14 +469,14 @@ angular.module('focaCrearCobranza') .controller('cobranzaController', |
470 | 469 | |
471 | 470 | }; |
472 | 471 | |
473 | - $scope.seleccionarCheque = function(cheque) { | |
472 | + $scope.seleccionarCheque = function (cheque) { | |
474 | 473 | if ($scope.cobranza.id === undefined) { |
475 | 474 | var parametros; |
476 | 475 | |
477 | 476 | if (!cheque) { |
478 | 477 | parametros = { |
479 | 478 | importe: getSugerido(), |
480 | - esNuevo : true | |
479 | + esNuevo: true | |
481 | 480 | }; |
482 | 481 | } else { |
483 | 482 | parametros = cheque; |
... | ... | @@ -491,14 +490,14 @@ angular.module('focaCrearCobranza') .controller('cobranzaController', |
491 | 490 | controller: 'focaModalChequeController', |
492 | 491 | size: 'lg', |
493 | 492 | resolve: { |
494 | - cheque: function() { | |
493 | + cheque: function () { | |
495 | 494 | return parametros; |
496 | 495 | } |
497 | 496 | } |
498 | 497 | } |
499 | 498 | ); |
500 | 499 | modalInstance.result.then( |
501 | - function(cheque) { | |
500 | + function (cheque) { | |
502 | 501 | var cobro = { |
503 | 502 | COM: 'ch' + '(' + cheque.numero + ')' + ' ' + cheque.banco.desbco, |
504 | 503 | numero: cheque.numero, |
... | ... | @@ -515,7 +514,7 @@ angular.module('focaCrearCobranza') .controller('cobranzaController', |
515 | 514 | TIL: 'EF' |
516 | 515 | }; |
517 | 516 | pushearCobro(cobro, cheque.$$hashKey); |
518 | - }, function() { | |
517 | + }, function () { | |
519 | 518 | |
520 | 519 | } |
521 | 520 | ); |
... | ... | @@ -526,15 +525,15 @@ angular.module('focaCrearCobranza') .controller('cobranzaController', |
526 | 525 | |
527 | 526 | }; |
528 | 527 | |
529 | - $scope.seleccionarEfectivo = function() { | |
528 | + $scope.seleccionarEfectivo = function () { | |
530 | 529 | if ($scope.cobranza.id === undefined) { |
531 | 530 | var importe = 0; |
532 | - $scope.cobranza.cobros.filter(function(a) { | |
531 | + $scope.cobranza.cobros.filter(function (a) { | |
533 | 532 | if (a.COM === 'Efectivo') { |
534 | 533 | importe = a.IMP; |
535 | 534 | } |
536 | 535 | }); |
537 | - | |
536 | + | |
538 | 537 | var modalInstance = $uibModal.open( |
539 | 538 | { |
540 | 539 | ariaLabelledBy: 'Carga de cheques', |
... | ... | @@ -542,29 +541,29 @@ angular.module('focaCrearCobranza') .controller('cobranzaController', |
542 | 541 | controller: 'focaModalEfectivoController', |
543 | 542 | size: 'sm', |
544 | 543 | resolve: { |
545 | - sugerido: function() { | |
544 | + sugerido: function () { | |
546 | 545 | return parseFloat(getSugerido()) + parseFloat(importe); |
547 | 546 | } |
548 | 547 | } |
549 | 548 | } |
550 | 549 | ); |
551 | 550 | modalInstance.result.then( |
552 | - function(efectivo) { | |
553 | - | |
551 | + function (efectivo) { | |
552 | + | |
554 | 553 | var cobro = { |
555 | 554 | COM: 'Efectivo', |
556 | 555 | FEC: new Date(), |
557 | 556 | IMP: efectivo, |
558 | 557 | TIL: 'EF' |
559 | 558 | }; |
560 | - | |
561 | - $scope.cobranza.cobros = $scope.cobranza.cobros.filter(function(a) { | |
559 | + | |
560 | + $scope.cobranza.cobros = $scope.cobranza.cobros.filter(function (a) { | |
562 | 561 | return a.COM !== 'Efectivo'; |
563 | 562 | }); |
564 | - | |
563 | + | |
565 | 564 | $scope.cobranza.cobros.push(cobro); |
566 | - }, function() { | |
567 | - | |
565 | + }, function () { | |
566 | + | |
568 | 567 | } |
569 | 568 | ); |
570 | 569 | } else { |
... | ... | @@ -573,10 +572,10 @@ angular.module('focaCrearCobranza') .controller('cobranzaController', |
573 | 572 | } |
574 | 573 | }; |
575 | 574 | |
576 | - $scope.seleccionarDetalles = function(detalle) { | |
575 | + $scope.seleccionarDetalles = function (detalle) { | |
577 | 576 | if ($scope.cobranza.id === undefined) { |
578 | 577 | var parametro = {}; |
579 | - | |
578 | + | |
580 | 579 | if (!detalle) { |
581 | 580 | parametro = { |
582 | 581 | importe: getSugerido(), |
... | ... | @@ -585,9 +584,9 @@ angular.module('focaCrearCobranza') .controller('cobranzaController', |
585 | 584 | } else { |
586 | 585 | parametro = detalle; |
587 | 586 | parametro.importe = detalle.IMP; |
588 | - parametro.files= detalle.imgs; | |
587 | + parametro.files = detalle.imgs; | |
589 | 588 | } |
590 | - | |
589 | + | |
591 | 590 | var modalInstance = $uibModal.open( |
592 | 591 | { |
593 | 592 | ariaLabelledBy: 'Carga de detalles', |
... | ... | @@ -595,15 +594,15 @@ angular.module('focaCrearCobranza') .controller('cobranzaController', |
595 | 594 | controller: 'focaModalDetallesController', |
596 | 595 | size: 'lg', |
597 | 596 | resolve: { |
598 | - parametros: function() { | |
597 | + parametros: function () { | |
599 | 598 | return parametro; |
600 | 599 | } |
601 | 600 | } |
602 | 601 | } |
603 | 602 | ); |
604 | 603 | modalInstance.result.then( |
605 | - function(detalles) { | |
606 | - | |
604 | + function (detalles) { | |
605 | + | |
607 | 606 | var cobro = { |
608 | 607 | COM: 'de(COBRO POR DETALLES)', |
609 | 608 | FEC: new Date(), |
... | ... | @@ -613,7 +612,7 @@ angular.module('focaCrearCobranza') .controller('cobranzaController', |
613 | 612 | observacion: detalles.observacion |
614 | 613 | }; |
615 | 614 | pushearCobro(cobro, detalles.$$hashKey); |
616 | - }, function() {} | |
615 | + }, function () { } | |
617 | 616 | ); |
618 | 617 | } else { |
619 | 618 | focaModalService.alert('Esta cobranza no se puede editar'); |
... | ... | @@ -621,7 +620,7 @@ angular.module('focaCrearCobranza') .controller('cobranzaController', |
621 | 620 | } |
622 | 621 | }; |
623 | 622 | |
624 | - $scope.seleccionarMoneda = function() { | |
623 | + $scope.seleccionarMoneda = function () { | |
625 | 624 | if ($scope.cobranza.id === undefined) { |
626 | 625 | var parametrosModal = { |
627 | 626 | titulo: 'Búsqueda de monedas', |
... | ... | @@ -639,9 +638,9 @@ angular.module('focaCrearCobranza') .controller('cobranzaController', |
639 | 638 | size: 'md' |
640 | 639 | }; |
641 | 640 | focaModalService.modal(parametrosModal).then( |
642 | - function(moneda) { | |
641 | + function (moneda) { | |
643 | 642 | $scope.seleccionarCotizacion(moneda); |
644 | - }, function() { | |
643 | + }, function () { | |
645 | 644 | |
646 | 645 | } |
647 | 646 | ); |
... | ... | @@ -652,18 +651,18 @@ angular.module('focaCrearCobranza') .controller('cobranzaController', |
652 | 651 | |
653 | 652 | }; |
654 | 653 | |
655 | - $scope.seleccionarCotizacion = function(moneda) { | |
654 | + $scope.seleccionarCotizacion = function (moneda) { | |
656 | 655 | var modalInstance = $uibModal.open( |
657 | 656 | { |
658 | 657 | ariaLabelledBy: 'Busqueda de Cotización', |
659 | 658 | templateUrl: 'modal-cotizacion.html', |
660 | 659 | controller: 'focaModalCotizacionController', |
661 | 660 | size: 'lg', |
662 | - resolve: {idMoneda: function() {return moneda.ID;}} | |
661 | + resolve: { idMoneda: function () { return moneda.ID; } } | |
663 | 662 | } |
664 | 663 | ); |
665 | 664 | modalInstance.result.then( |
666 | - function(cotizacion) { | |
665 | + function (cotizacion) { | |
667 | 666 | $scope.cobranza.moneda = moneda; |
668 | 667 | $scope.cobranza.moneda.cotizacion = cotizacion; |
669 | 668 | if (moneda.DETALLE === 'PESOS ARGENTINOS') { |
... | ... | @@ -685,17 +684,17 @@ angular.module('focaCrearCobranza') .controller('cobranzaController', |
685 | 684 | }); |
686 | 685 | } |
687 | 686 | |
688 | - $filter('filter')( $scope.botonera, { | |
687 | + $filter('filter')($scope.botonera, { | |
689 | 688 | label: 'Moneda' |
690 | 689 | })[0].checked = true; |
691 | 690 | |
692 | - }, function() { | |
691 | + }, function () { | |
693 | 692 | |
694 | 693 | } |
695 | 694 | ); |
696 | 695 | }; |
697 | 696 | |
698 | - $scope.getTotalDeuda = function() { | |
697 | + $scope.getTotalDeuda = function () { | |
699 | 698 | var total = 0; |
700 | 699 | for (var i = 0; i < $scope.cobranza.facturas.length; i++) { |
701 | 700 | total += $scope.cobranza.facturas[i].IMP || $scope.cobranza.facturas[i].IPA; |
... | ... | @@ -703,7 +702,7 @@ angular.module('focaCrearCobranza') .controller('cobranzaController', |
703 | 702 | return parseFloat(total.toFixed(2)); |
704 | 703 | }; |
705 | 704 | |
706 | - $scope.getTotalCobrado = function() { | |
705 | + $scope.getTotalCobrado = function () { | |
707 | 706 | var total = 0; |
708 | 707 | for (var i = 0; i < $scope.cobranza.cobros.length; i++) { |
709 | 708 | total += $scope.cobranza.cobros[i].IMP; |
... | ... | @@ -711,37 +710,37 @@ angular.module('focaCrearCobranza') .controller('cobranzaController', |
711 | 710 | return parseFloat(total.toFixed(2)); |
712 | 711 | }; |
713 | 712 | |
714 | - $scope.getSubTotal = function() { | |
713 | + $scope.getSubTotal = function () { | |
715 | 714 | if ($scope.articuloACargar) { |
716 | 715 | return $scope.articuloACargar.precio * $scope.articuloACargar.cantidad; |
717 | 716 | } |
718 | 717 | }; |
719 | 718 | //Recibe aviso si el teclado está en uso |
720 | 719 | // $rootScope.$on('usarTeclado', function(event, data) { |
721 | - // if(data) { | |
722 | - // $scope.mostrarTeclado = true; | |
723 | - // return; | |
724 | - // } | |
725 | - // $scope.mostrarTeclado = false; | |
720 | + // if(data) { | |
721 | + // $scope.mostrarTeclado = true; | |
722 | + // return; | |
723 | + // } | |
724 | + // $scope.mostrarTeclado = false; | |
726 | 725 | // }) |
727 | - $scope.selectFocus = function($event) { | |
726 | + $scope.selectFocus = function ($event) { | |
728 | 727 | //Si el teclado esta en uso no selecciona el valor |
729 | 728 | // if($scope.mostrarTeclado) { |
730 | - // return; | |
729 | + // return; | |
731 | 730 | // } |
732 | 731 | $event.target.select(); |
733 | 732 | }; |
734 | 733 | |
735 | - $scope.salir = function() { | |
734 | + $scope.salir = function () { | |
736 | 735 | $location.path('/'); |
737 | 736 | }; |
738 | 737 | |
739 | - $scope.parsearATexto = function(articulo) { | |
738 | + $scope.parsearATexto = function (articulo) { | |
740 | 739 | articulo.cantidad = parseFloat(articulo.cantidad); |
741 | 740 | articulo.precio = parseFloat(articulo.precio); |
742 | 741 | }; |
743 | 742 | |
744 | - $scope.quitarFactura = function(key) { | |
743 | + $scope.quitarFactura = function (key) { | |
745 | 744 | if ($scope.cobranza.id === undefined) { |
746 | 745 | $scope.cobranza.facturas.splice(key, 1); |
747 | 746 | } else { |
... | ... | @@ -750,7 +749,7 @@ angular.module('focaCrearCobranza') .controller('cobranzaController', |
750 | 749 | } |
751 | 750 | }; |
752 | 751 | |
753 | - $scope.quitarCobro = function(key) { | |
752 | + $scope.quitarCobro = function (key) { | |
754 | 753 | if ($scope.cobranza.id === undefined) { |
755 | 754 | $scope.cobranza.cobros.splice(key, 1); |
756 | 755 | } else { |
... | ... | @@ -759,35 +758,35 @@ angular.module('focaCrearCobranza') .controller('cobranzaController', |
759 | 758 | } |
760 | 759 | }; |
761 | 760 | |
762 | - $scope.editarCobro = function(cobro) { | |
763 | - if(cobro.COM === 'Efectivo') { | |
761 | + $scope.editarCobro = function (cobro) { | |
762 | + if (cobro.COM === 'Efectivo') { | |
764 | 763 | $scope.seleccionarEfectivo(); |
765 | - } else if(cobro.COM.substring(0, 2) === 'de') { | |
764 | + } else if (cobro.COM.substring(0, 2) === 'de') { | |
766 | 765 | $scope.seleccionarDetalles(cobro); |
767 | - } else if(cobro.COM.substring(0, 2) === 'ch') { | |
766 | + } else if (cobro.COM.substring(0, 2) === 'ch') { | |
768 | 767 | $scope.seleccionarCheque(cobro); |
769 | 768 | } |
770 | 769 | }; |
771 | 770 | |
772 | - $scope.$watch('cobranza.facturas', function() { | |
771 | + $scope.$watch('cobranza.facturas', function () { | |
773 | 772 | if ($scope.cobranza.facturas.length) { |
774 | - $filter('filter')( $scope.botonera, { | |
773 | + $filter('filter')($scope.botonera, { | |
775 | 774 | label: 'Comprobantes' |
776 | 775 | })[0].checked = true; |
777 | 776 | } else { |
778 | - $filter('filter')( $scope.botonera, { | |
777 | + $filter('filter')($scope.botonera, { | |
779 | 778 | label: 'Comprobantes' |
780 | 779 | })[0].checked = false; |
781 | 780 | } |
782 | 781 | }, true); |
783 | 782 | |
784 | - $scope.$watch('cobranza.cobros', function() { | |
783 | + $scope.$watch('cobranza.cobros', function () { | |
785 | 784 | if ($scope.cobranza.cobros.length) { |
786 | - $filter('filter')( $scope.botonera, { | |
785 | + $filter('filter')($scope.botonera, { | |
787 | 786 | label: 'Cobros' |
788 | 787 | })[0].checked = true; |
789 | 788 | } else { |
790 | - $filter('filter')( $scope.botonera, { | |
789 | + $filter('filter')($scope.botonera, { | |
791 | 790 | label: 'Cobros' |
792 | 791 | })[0].checked = false; |
793 | 792 | } |
... | ... | @@ -796,8 +795,8 @@ angular.module('focaCrearCobranza') .controller('cobranzaController', |
796 | 795 | function pushearCobro(cobro, hashKey) { |
797 | 796 | var existe; |
798 | 797 | |
799 | - $scope.cobranza.cobros.forEach(function(c, idx) { | |
800 | - if(c.$$hashKey === hashKey) { | |
798 | + $scope.cobranza.cobros.forEach(function (c, idx) { | |
799 | + if (c.$$hashKey === hashKey) { | |
801 | 800 | $scope.cobranza.cobros[idx] = cobro; |
802 | 801 | existe = true; |
803 | 802 | } |
... | ... | @@ -817,7 +816,7 @@ angular.module('focaCrearCobranza') .controller('cobranzaController', |
817 | 816 | if (confirmacion) { |
818 | 817 | focaModalService.confirm( |
819 | 818 | '¿Está seguro de que desea salir? Se perderán todos los datos cargados.' |
820 | - ).then(function(data) { | |
819 | + ).then(function (data) { | |
821 | 820 | if (data) { |
822 | 821 | $location.path('/'); |
823 | 822 | } |
... | ... | @@ -838,7 +837,7 @@ angular.module('focaCrearCobranza') .controller('cobranzaController', |
838 | 837 | cobranza.cliente.NOM |
839 | 838 | }); |
840 | 839 | |
841 | - $filter('filter')( $scope.botonera, { | |
840 | + $filter('filter')($scope.botonera, { | |
842 | 841 | label: 'Cliente' |
843 | 842 | })[0].checked = true; |
844 | 843 | } |
... | ... | @@ -854,7 +853,7 @@ angular.module('focaCrearCobranza') .controller('cobranzaController', |
854 | 853 | |
855 | 854 | // TODO: Setear moneda |
856 | 855 | if (cobranza.moneda) { |
857 | - $filter('filter')( $scope.botonera, { | |
856 | + $filter('filter')($scope.botonera, { | |
858 | 857 | label: 'Moneda' |
859 | 858 | })[0].checked = true; |
860 | 859 | } |