Commit db25b151280e5096fb4d34a2cec89e3649700f01
1 parent
0cf3df0ce6
Exists in
master
Modal cobranza
validación correcta diferencia
Showing
2 changed files
with
48 additions
and
9 deletions
Show diff stats
src/js/controller.js
| ... | ... | @@ -58,7 +58,7 @@ angular.module('focaCrearCobranza') .controller('cobranzaController', |
| 58 | 58 | focaModalService.alert('Ingrese al menos una factura'); |
| 59 | 59 | return; |
| 60 | 60 | } |
| 61 | - if($scope.getTotalCobrado() - $scope.getTotalDeuda() !== 0) { | |
| 61 | + if($scope.getTotalCobrado() + $scope.getTotalDeuda() !== 0) { | |
| 62 | 62 | focaModalService.alert('La diferencia debe ser ' + |
| 63 | 63 | $scope.cobranza.moneda.SIMBOLO + '0,00'); |
| 64 | 64 | return; |
| ... | ... | @@ -66,6 +66,8 @@ angular.module('focaCrearCobranza') .controller('cobranzaController', |
| 66 | 66 | var cobranza = {}; |
| 67 | 67 | var cheques = []; |
| 68 | 68 | var cuerpos = []; |
| 69 | + //TODO: habilitar edición | |
| 70 | + $scope.editando = false; | |
| 69 | 71 | |
| 70 | 72 | for (var i = 0; i < $scope.facturaTabla.length; i++) { |
| 71 | 73 | var cuerpoFactura = { |
| ... | ... | @@ -168,7 +170,7 @@ angular.module('focaCrearCobranza') .controller('cobranzaController', |
| 168 | 170 | FEC: $scope.fecha.toISOString().slice(0, 19).replace('T', ' '), |
| 169 | 171 | CLI: $scope.cobranza.cliente.COD, |
| 170 | 172 | ATO: 0, //número de asiento |
| 171 | - CFE: $scope.usuario.NomVen.trim(), | |
| 173 | + CFE: $scope.cobranza.cobrador.nombre, | |
| 172 | 174 | PLA: '',//Numero de planilla, sin uso |
| 173 | 175 | ID_MONEDA: $scope.cobranza.moneda.ID, |
| 174 | 176 | COTIZACION: $scope.cobranza.cotizacion.VENDEDOR |
| ... | ... | @@ -210,13 +212,14 @@ angular.module('focaCrearCobranza') .controller('cobranzaController', |
| 210 | 212 | focaModalService.alert('Cobranza guardada con éxito'); |
| 211 | 213 | |
| 212 | 214 | focaSeguimientoService.guardarPosicion( |
| 213 | - $scope.sucursal+$scope.comprobante, | |
| 215 | + $scope.comprobante, | |
| 216 | + $scope.puntoVenta, | |
| 214 | 217 | 'Cobranza', |
| 215 | 218 | 'Nº: ' + $filter('comprobante')([ |
| 216 | 219 | $scope.puntoVenta, |
| 217 | 220 | $scope.comprobante |
| 218 | 221 | ]) + '<br/>' + |
| 219 | - 'Vendedor: ' + $scope.usuario.NomVen + '<br/>' + | |
| 222 | + 'Vendedor: ' + $scope.cobranza.cobrador.nombre + '<br/>' + | |
| 220 | 223 | 'Total: ' + $filter('currency')($scope.getTotalCobrado()) |
| 221 | 224 | ); |
| 222 | 225 | |
| ... | ... | @@ -241,6 +244,33 @@ angular.module('focaCrearCobranza') .controller('cobranzaController', |
| 241 | 244 | $scope.cobroDeuda = true; |
| 242 | 245 | }; |
| 243 | 246 | |
| 247 | + $scope.seleccionarCobranza = function() { | |
| 248 | + | |
| 249 | + var modalInstance = $uibModal.open( | |
| 250 | + { | |
| 251 | + ariaLabelledBy: 'Busqueda de Cobranzas', | |
| 252 | + templateUrl: 'foca-modal-cobranza.html', | |
| 253 | + controller: 'focaModalCobranzaController', | |
| 254 | + size: 'lg' | |
| 255 | + } | |
| 256 | + ); | |
| 257 | + modalInstance.result.then(function(cobranza) { | |
| 258 | + $scope.editando = true; | |
| 259 | + $scope.cabecera = []; | |
| 260 | + $scope.facturaTabla = []; | |
| 261 | + $scope.cobrosTabla = []; | |
| 262 | + | |
| 263 | + $scope.fecha = new Date(cobranza.fecha); | |
| 264 | + | |
| 265 | + addCabecera('Cliente:', cobranza.cliente.NOM); | |
| 266 | + addCabecera('Cobrador:', cobranza.cobrador); | |
| 267 | + | |
| 268 | + $scope.facturaTabla = cobranza.facturas; | |
| 269 | + $scope.cobrosTabla = cobranza.cobros; | |
| 270 | + | |
| 271 | + }); | |
| 272 | + }; | |
| 273 | + | |
| 244 | 274 | $scope.seleccionarCliente = function() { |
| 245 | 275 | |
| 246 | 276 | var modalInstance = $uibModal.open( |
src/views/cobranza.html
| ... | ... | @@ -10,6 +10,13 @@ |
| 10 | 10 | </div> |
| 11 | 11 | <div class="col-5 col-sm-4 numero-pedido" |
| 12 | 12 | >Nº {{puntoVenta}}-{{comprobante}} |
| 13 | + <button | |
| 14 | + class="btn btn-xs btn-outline-dark" | |
| 15 | + type="button" | |
| 16 | + ng-click="seleccionarCobranza()" | |
| 17 | + > | |
| 18 | + <i class="fa fa-search"></i> | |
| 19 | + </button> | |
| 13 | 20 | </div> |
| 14 | 21 | <div class="col-7 col-sm-4 text-right"> |
| 15 | 22 | Fecha: |
| ... | ... | @@ -168,7 +175,7 @@ |
| 168 | 175 | <strong>DF:</strong> |
| 169 | 176 | </td> |
| 170 | 177 | <td class="table-celda-total text-right no-border-top mr-1"> |
| 171 | - <strong>{{((getTotalCobrado() - getTotalDeuda()) / | |
| 178 | + <strong>{{((getTotalCobrado() + getTotalDeuda()) / | |
| 172 | 179 | cobranza.cotizacion.VENDEDOR) | currency: cobranza.moneda.SIMBOLO}} |
| 173 | 180 | </strong> |
| 174 | 181 | </td> |
| ... | ... | @@ -266,7 +273,7 @@ |
| 266 | 273 | <strong>DF:</strong> |
| 267 | 274 | </td> |
| 268 | 275 | <td class="table-celda-total text-right no-border-top mr-1"> |
| 269 | - <strong>{{((getTotalCobrado() - getTotalDeuda()) / | |
| 276 | + <strong>{{((getTotalCobrado() + getTotalDeuda()) / | |
| 270 | 277 | cobranza.cotizacion.VENDEDOR) | currency: cobranza.moneda.SIMBOLO}} |
| 271 | 278 | </strong> |
| 272 | 279 | </td> |
| ... | ... | @@ -495,7 +502,7 @@ |
| 495 | 502 | <strong>{{(getTotalCobrado() / cobranza.cotizacion.VENDEDOR) | currency: cobranza.moneda.SIMBOLO}}</strong> |
| 496 | 503 | </td> |
| 497 | 504 | <td class="table-celda-total text-center no-border-top col-4"> |
| 498 | - <strong>{{((getTotalCobrado() - getTotalDeuda()) / cobranza.cotizacion.VENDEDOR) | currency: cobranza.moneda.SIMBOLO}}</strong> | |
| 505 | + <strong>{{((getTotalCobrado() + getTotalDeuda()) / cobranza.cotizacion.VENDEDOR) | currency: cobranza.moneda.SIMBOLO}}</strong> | |
| 499 | 506 | </td> |
| 500 | 507 | </tr> |
| 501 | 508 | </table> |
| ... | ... | @@ -507,7 +514,9 @@ |
| 507 | 514 | <button |
| 508 | 515 | ng-click="crearCobranza()" |
| 509 | 516 | title="Crear nota pedido" |
| 510 | - class="btn btn-default btn-block mb-2"> | |
| 517 | + class="btn btn-default btn-block mb-2" | |
| 518 | + ng-disabled="editando" | |
| 519 | + > | |
| 511 | 520 | Guardar |
| 512 | 521 | </button> |
| 513 | 522 | <button |
| ... | ... | @@ -524,7 +533,7 @@ |
| 524 | 533 | <div class="row d-md-none fixed-bottom"> |
| 525 | 534 | <div class="w-100 bg-dark d-flex px-3 acciones-mobile"> |
| 526 | 535 | <span class="ml-3 text-muted" ng-click="salir()">Salir</span> |
| 527 | - <span class="mr-3 ml-auto" ng-click="crearCobranza()">Guardar</span> | |
| 536 | + <span class="mr-3 ml-auto" ng-click="crearCobranza()" ng-show="!editando">Guardar</span> | |
| 528 | 537 | </div> |
| 529 | 538 | </div> |
| 530 | 539 | </div> |