diff --git a/src/js/controller.js b/src/js/controller.js index 16ac00b..546e827 100644 --- a/src/js/controller.js +++ b/src/js/controller.js @@ -63,13 +63,19 @@ angular.module('focaCrearCobranza') .controller('cobranzaController', } ); $scope.crearCobranza = function() { - if(!$scope.cliente.COD) { + if(!$scope.cobranza.cliente) { focaModalService.alert('Ingrese Cliente'); return; - }else if($scope.facturaTabla.length < 1) { + } + if($scope.facturaTabla.length < 1) { focaModalService.alert('Ingrese al menos una factura'); return; } + if($scope.getTotalCobrado() - $scope.getTotalDeuda() !== 0) { + focaModalService.alert('La diferencia debe ser ' + + $scope.cobranza.moneda.SIMBOLO + '0,00'); + return; + } //TODO: Guarda cobranza // var date = new Date(); // var cobranza = { @@ -149,9 +155,9 @@ angular.module('focaCrearCobranza') .controller('cobranzaController', modalInstance.result.then( function(cheque) { var cobro = { - tipo: 'Cheque', - fecha: cheque.fechaValor, - importe: cheque.importe + tipo: 'Ch' + '(' + cheque.numero + ')' + ' ' + cheque.banco, + fecha: cheque.fechaPresentacion, + importe: cheque.importe * $scope.cobranza.cotizacion.VENDEDOR }; $scope.cobrosTabla.push(cobro); }, function() { @@ -174,7 +180,7 @@ angular.module('focaCrearCobranza') .controller('cobranzaController', var cobro = { tipo: 'Efectivo', fecha: new Date(), - importe: efectivo + importe: efectivo * $scope.cobranza.cotizacion.VENDEDOR }; $scope.cobrosTabla.push(cobro); }, function() { diff --git a/src/views/cobranza.html b/src/views/cobranza.html index 9f031ff..8bbc608 100644 --- a/src/views/cobranza.html +++ b/src/views/cobranza.html @@ -130,7 +130,7 @@ + currency: cobranza.moneda.SIMBOLO : 4">