Commit 0d01c9d6c84b0ea276db7730a03a23322514dae9

Authored by Nicolás Guarnieri
Exists in master

Merge branch 'master' into 'master'

Master(efernandez)

See merge request !3
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
... ... @@ -128,7 +128,7 @@
128 128 <td
129 129 class="col"
130 130 ng-bind="(factura.IPA / cobranza.cotizacion.VENDEDOR) |
131   - currency: cobranza.moneda.SIMBOLO"></td>
  131 + currency: cobranza.moneda.SIMBOLO : 4"></td>
132 132 <td class="text-center col-auto">
133 133 <button
134 134 class="btn btn-outline-secondary"
... ... @@ -220,7 +220,7 @@
220 220 <td
221 221 class="col"
222 222 ng-bind="(cobro.importe / cobranza.cotizacion.VENDEDOR) |
223   - currency: cobranza.moneda.SIMBOLO"></td>
  223 + currency: cobranza.moneda.SIMBOLO : 4"></td>
224 224 <td class="text-center col-auto">
225 225 <button
226 226 class="btn btn-outline-secondary"
... ... @@ -279,6 +279,7 @@
279 279 </div>
280 280 <!-- MOBILE -->
281 281 <div class="row d-sm-none">
  282 + <!-- FACTURAS -->
282 283 <table class="table table-sm table-striped table-dark" ng-show="cobroDeuda">
283 284 <thead>
284 285 <tr class="d-flex">
... ... @@ -318,7 +319,7 @@
318 319 <div class="col-4 px-1">
319 320 <span
320 321 ng-bind="(factura.IPA / cobranza.cotizacion.VENDEDOR) |
321   - currency:cobranza.moneda.SIMBOLO"></span>
  322 + currency:cobranza.moneda.SIMBOLO : 4"></span>
322 323 </div>
323 324 </div>
324 325 </div>
... ... @@ -376,6 +377,7 @@
376 377 </tr>
377 378 </tfoot>
378 379 </table>
  380 + <!-- COBROS -->
379 381 <table class="table table-sm table-striped table-dark" ng-show="!cobroDeuda">
380 382 <thead>
381 383 <tr class="d-flex">
... ... @@ -413,7 +415,7 @@
413 415 <div class="col-4 px-1">
414 416 <span
415 417 ng-bind="(cobro.importe / cobranza.cotizacion.VENDEDOR) |
416   - currency: cobranza.moneda.SIMBOLO"></span>
  418 + currency: cobranza.moneda.SIMBOLO : 4"></span>
417 419 </div>
418 420 </div>
419 421 </div>
... ... @@ -479,6 +481,7 @@
479 481 </tfoot>
480 482 </table>
481 483 </tr>
  484 + <!-- DEUDA, COBRADO, DIFERENCIA -->
482 485 <table class="table-responsive">
483 486 <tr class="d-flex row">
484 487 <td class="text-center ml-auto table-celda-total no-border-top col-4">
... ... @@ -507,8 +510,7 @@
507 510 <div class="row align-items-end">
508 511 <div class="col-12">
509 512 <button
510   - ng-click="crearHojaRuta()"
511   - type="submit"
  513 + ng-click="crearCobranza()"
512 514 title="Crear nota pedido"
513 515 class="btn btn-default btn-block mb-2">
514 516 Guardar
... ... @@ -527,7 +529,7 @@
527 529 <div class="row d-md-none fixed-bottom">
528 530 <div class="w-100 bg-dark d-flex px-3 acciones-mobile">
529 531 <span class="ml-3 text-muted" ng-click="salir()">Salir</span>
530   - <span class="mr-3 ml-auto" ng-click="crearHojaRuta()">Guardar</span>
  532 + <span class="mr-3 ml-auto" ng-click="crearCobranza()">Guardar</span>
531 533 </div>
532 534 </div>
533 535 </div>