diff --git a/src/js/controller.js b/src/js/controller.js index 3d51946..c8e1149 100644 --- a/src/js/controller.js +++ b/src/js/controller.js @@ -58,7 +58,7 @@ angular.module('focaCrearCobranza') .controller('cobranzaController', focaModalService.alert('Ingrese al menos una factura'); return; } - if($scope.getTotalCobrado() - $scope.getTotalDeuda() !== 0) { + if($scope.getTotalCobrado() + $scope.getTotalDeuda() !== 0) { focaModalService.alert('La diferencia debe ser ' + $scope.cobranza.moneda.SIMBOLO + '0,00'); return; @@ -66,6 +66,8 @@ angular.module('focaCrearCobranza') .controller('cobranzaController', var cobranza = {}; var cheques = []; var cuerpos = []; + //TODO: habilitar edición + $scope.editando = false; for (var i = 0; i < $scope.facturaTabla.length; i++) { var cuerpoFactura = { @@ -168,7 +170,7 @@ angular.module('focaCrearCobranza') .controller('cobranzaController', FEC: $scope.fecha.toISOString().slice(0, 19).replace('T', ' '), CLI: $scope.cobranza.cliente.COD, ATO: 0, //número de asiento - CFE: $scope.usuario.NomVen.trim(), + CFE: $scope.cobranza.cobrador.nombre, PLA: '',//Numero de planilla, sin uso ID_MONEDA: $scope.cobranza.moneda.ID, COTIZACION: $scope.cobranza.cotizacion.VENDEDOR @@ -210,13 +212,14 @@ angular.module('focaCrearCobranza') .controller('cobranzaController', focaModalService.alert('Cobranza guardada con éxito'); focaSeguimientoService.guardarPosicion( - $scope.sucursal+$scope.comprobante, + $scope.comprobante, + $scope.puntoVenta, 'Cobranza', 'Nº: ' + $filter('comprobante')([ $scope.puntoVenta, $scope.comprobante ]) + '
' + - 'Vendedor: ' + $scope.usuario.NomVen + '
' + + 'Vendedor: ' + $scope.cobranza.cobrador.nombre + '
' + 'Total: ' + $filter('currency')($scope.getTotalCobrado()) ); @@ -241,6 +244,33 @@ angular.module('focaCrearCobranza') .controller('cobranzaController', $scope.cobroDeuda = true; }; + $scope.seleccionarCobranza = function() { + + var modalInstance = $uibModal.open( + { + ariaLabelledBy: 'Busqueda de Cobranzas', + templateUrl: 'foca-modal-cobranza.html', + controller: 'focaModalCobranzaController', + size: 'lg' + } + ); + modalInstance.result.then(function(cobranza) { + $scope.editando = true; + $scope.cabecera = []; + $scope.facturaTabla = []; + $scope.cobrosTabla = []; + + $scope.fecha = new Date(cobranza.fecha); + + addCabecera('Cliente:', cobranza.cliente.NOM); + addCabecera('Cobrador:', cobranza.cobrador); + + $scope.facturaTabla = cobranza.facturas; + $scope.cobrosTabla = cobranza.cobros; + + }); + }; + $scope.seleccionarCliente = function() { var modalInstance = $uibModal.open( diff --git a/src/views/cobranza.html b/src/views/cobranza.html index 53364b7..78a12aa 100644 --- a/src/views/cobranza.html +++ b/src/views/cobranza.html @@ -10,6 +10,13 @@
Nº {{puntoVenta}}-{{comprobante}} +
Fecha: @@ -168,7 +175,7 @@ DF: - {{((getTotalCobrado() - getTotalDeuda()) / + {{((getTotalCobrado() + getTotalDeuda()) / cobranza.cotizacion.VENDEDOR) | currency: cobranza.moneda.SIMBOLO}} @@ -266,7 +273,7 @@ DF: - {{((getTotalCobrado() - getTotalDeuda()) / + {{((getTotalCobrado() + getTotalDeuda()) / cobranza.cotizacion.VENDEDOR) | currency: cobranza.moneda.SIMBOLO}} @@ -495,7 +502,7 @@ {{(getTotalCobrado() / cobranza.cotizacion.VENDEDOR) | currency: cobranza.moneda.SIMBOLO}} - {{((getTotalCobrado() - getTotalDeuda()) / cobranza.cotizacion.VENDEDOR) | currency: cobranza.moneda.SIMBOLO}} + {{((getTotalCobrado() + getTotalDeuda()) / cobranza.cotizacion.VENDEDOR) | currency: cobranza.moneda.SIMBOLO}} @@ -507,7 +514,9 @@