Commit 104c0b86747dc3fcfbfa62a7860d5990b4b02891

Authored by Eric Fernandez
1 parent f9f995a7a5
Exists in master

fix número factura

Showing 1 changed file with 17 additions and 11 deletions   Show diff stats
src/js/controller.js
... ... @@ -76,19 +76,10 @@ angular.module('focaCrearFactura').controller('facturaController', [
76 76 $scope.factura.articulosFactura = [];
77 77 $scope.idLista = undefined;
78 78  
79   - crearRemitoService.getNumeroRemito().then(
80   - function (res) {
81   - $scope.puntoVenta = rellenar(res.data.sucursal, 4);
82   - $scope.comprobante = rellenar(res.data.numeroRemito, 8);
83   - },
84   - function (err) {
85   - focaModalService.alert('La terminal no esta configurada correctamente');
86   - console.info(err);
87   - }
88   - );
89   -
90 79 $scope.inicial = angular.copy($scope.factura);
91 80  
  81 + getNumeroFactura('B');
  82 +
92 83 if (APP == 'facturador') {
93 84 crearFacturaService
94 85 .getVendedorPlayaById(loginServ.getLoginData().vendedorPlaya)
... ... @@ -282,6 +273,7 @@ angular.module('focaCrearFactura').controller('facturaController', [
282 273 $scope.factura.formaPago = data.formaDePago;
283 274  
284 275 $scope.factura.cliente = cliente;
  276 + getNumeroFactura(cliente.TIP)
285 277  
286 278 $scope.$broadcast('addCabecera', {
287 279 label: 'Cliente:',
... ... @@ -1017,5 +1009,19 @@ angular.module('focaCrearFactura').controller('facturaController', [
1017 1009  
1018 1010 return importe;
1019 1011 }
  1012 +
  1013 + function getNumeroFactura(tipoFactura) {
  1014 +
  1015 + crearRemitoService.getNumeroRemito(tipoFactura).then(
  1016 + function (res) {
  1017 + $scope.puntoVenta = rellenar(res.data.sucursal, 4);
  1018 + $scope.comprobante = rellenar(res.data.numeroRemito, 8);
  1019 + },
  1020 + function (err) {
  1021 + focaModalService.alert('La terminal no esta configurada correctamente');
  1022 + console.info(err);
  1023 + }
  1024 + );
  1025 + }
1020 1026 }
1021 1027 ]);