Commit 1515b17487d19ab37506d45bb7b8e2b685799f1c

Authored by Eric Fernandez
1 parent 2a6ca4e38e
Exists in master

valido que la diferencia sea 0

Showing 2 changed files with 21 additions and 13 deletions   Show diff stats
src/js/controller.js
... ... @@ -63,13 +63,19 @@ angular.module('focaCrearCobranza') .controller('cobranzaController',
63 63 }
64 64 );
65 65 $scope.crearCobranza = function() {
66   - if(!$scope.cliente.COD) {
  66 + if(!$scope.cobranza.cliente) {
67 67 focaModalService.alert('Ingrese Cliente');
68 68 return;
69   - }else if($scope.facturaTabla.length < 1) {
  69 + }
  70 + if($scope.facturaTabla.length < 1) {
70 71 focaModalService.alert('Ingrese al menos una factura');
71 72 return;
72 73 }
  74 + if($scope.getTotalCobrado() - $scope.getTotalDeuda() !== 0) {
  75 + focaModalService.alert('La diferencia debe ser ' +
  76 + $scope.cobranza.moneda.SIMBOLO + '0,00');
  77 + return;
  78 + }
73 79 //TODO: Guarda cobranza
74 80 // var date = new Date();
75 81 // var cobranza = {
... ... @@ -149,9 +155,9 @@ angular.module(&#39;focaCrearCobranza&#39;) .controller(&#39;cobranzaController&#39;,
149 155 modalInstance.result.then(
150 156 function(cheque) {
151 157 var cobro = {
152   - tipo: 'Cheque',
153   - fecha: cheque.fechaValor,
154   - importe: cheque.importe
  158 + tipo: 'Ch' + '(' + cheque.numero + ')' + ' ' + cheque.banco,
  159 + fecha: cheque.fechaPresentacion,
  160 + importe: cheque.importe * $scope.cobranza.cotizacion.VENDEDOR
155 161 };
156 162 $scope.cobrosTabla.push(cobro);
157 163 }, function() {
... ... @@ -174,7 +180,7 @@ angular.module(&#39;focaCrearCobranza&#39;) .controller(&#39;cobranzaController&#39;,
174 180 var cobro = {
175 181 tipo: 'Efectivo',
176 182 fecha: new Date(),
177   - importe: efectivo
  183 + importe: efectivo * $scope.cobranza.cotizacion.VENDEDOR
178 184 };
179 185 $scope.cobrosTabla.push(cobro);
180 186 }, function() {
src/views/cobranza.html
... ... @@ -130,7 +130,7 @@
130 130 <td
131 131 class="col"
132 132 ng-bind="(factura.IPA / cobranza.cotizacion.VENDEDOR) |
133   - currency: cobranza.moneda.SIMBOLO"></td>
  133 + currency: cobranza.moneda.SIMBOLO : 4"></td>
134 134 <td class="text-center col-auto">
135 135 <button
136 136 class="btn btn-outline-secondary"
... ... @@ -222,7 +222,7 @@
222 222 <td
223 223 class="col"
224 224 ng-bind="(cobro.importe / cobranza.cotizacion.VENDEDOR) |
225   - currency: cobranza.moneda.SIMBOLO"></td>
  225 + currency: cobranza.moneda.SIMBOLO : 4"></td>
226 226 <td class="text-center col-auto">
227 227 <button
228 228 class="btn btn-outline-secondary"
... ... @@ -281,6 +281,7 @@
281 281 </div>
282 282 <!-- MOBILE -->
283 283 <div class="row d-sm-none">
  284 + <!-- FACTURAS -->
284 285 <table class="table table-sm table-striped table-dark" ng-show="cobroDeuda">
285 286 <thead>
286 287 <tr class="d-flex">
... ... @@ -320,7 +321,7 @@
320 321 <div class="col-4 px-1">
321 322 <span
322 323 ng-bind="(factura.IPA / cobranza.cotizacion.VENDEDOR) |
323   - currency:cobranza.moneda.SIMBOLO"></span>
  324 + currency:cobranza.moneda.SIMBOLO : 4"></span>
324 325 </div>
325 326 </div>
326 327 </div>
... ... @@ -378,6 +379,7 @@
378 379 </tr>
379 380 </tfoot>
380 381 </table>
  382 + <!-- COBROS -->
381 383 <table class="table table-sm table-striped table-dark" ng-show="!cobroDeuda">
382 384 <thead>
383 385 <tr class="d-flex">
... ... @@ -415,7 +417,7 @@
415 417 <div class="col-4 px-1">
416 418 <span
417 419 ng-bind="(cobro.importe / cobranza.cotizacion.VENDEDOR) |
418   - currency: cobranza.moneda.SIMBOLO"></span>
  420 + currency: cobranza.moneda.SIMBOLO : 4"></span>
419 421 </div>
420 422 </div>
421 423 </div>
... ... @@ -481,6 +483,7 @@
481 483 </tfoot>
482 484 </table>
483 485 </tr>
  486 + <!-- DEUDA, COBRADO, DIFERENCIA -->
484 487 <table class="table-responsive">
485 488 <tr class="d-flex row">
486 489 <td class="text-center ml-auto table-celda-total no-border-top col-4">
... ... @@ -509,8 +512,7 @@
509 512 <div class="row align-items-end">
510 513 <div class="col-12">
511 514 <button
512   - ng-click="crearHojaRuta()"
513   - type="submit"
  515 + ng-click="crearCobranza()"
514 516 title="Crear nota pedido"
515 517 class="btn btn-default btn-block mb-2">
516 518 Guardar
... ... @@ -529,7 +531,7 @@
529 531 <div class="row d-md-none fixed-bottom">
530 532 <div class="w-100 bg-dark d-flex px-3 acciones-mobile">
531 533 <span class="ml-3 text-muted" ng-click="salir()">Salir</span>
532   - <span class="mr-3 ml-auto" ng-click="crearHojaRuta()">Guardar</span>
  534 + <span class="mr-3 ml-auto" ng-click="crearCobranza()">Guardar</span>
533 535 </div>
534 536 </div>
535 537 </div>