Commit f3af9b320d3d2a8fd9ab5300cf50389dc553b630
1 parent
dc667eace5
Exists in
master
refactor transportista
Showing
3 changed files
with
69 additions
and
59 deletions
Show diff stats
src/js/controller.js
... | ... | @@ -51,60 +51,67 @@ angular.module('focaModalDescarga') |
51 | 51 | return; |
52 | 52 | } |
53 | 53 | //#region OBJETO REMITO |
54 | - var remito = { | |
55 | - id: 0, | |
56 | - fechaRemito: new Date().toISOString().slice(0, 19).replace('T', ' '), | |
57 | - idCliente: $scope.remito.cliente.cod, | |
58 | - nombreCliente: $scope.remito.cliente.nom, | |
59 | - cuitCliente: $scope.remito.cliente.cuit, | |
60 | - total: $scope.getTotal() * $scope.remito.cotizacion.VENDEDOR, | |
61 | - numeroNotaPedido: $scope.remito.numeroNotaPedido, | |
62 | - idVendedor: $scope.remito.cliente.ven, | |
63 | - idProveedor: $scope.remito.proveedor.COD, | |
64 | - idDomicilio: 0, | |
65 | - idCotizacion: $scope.remito.cotizacion.ID, | |
66 | - idListaPrecio: parseInt($scope.remito.cliente.mod) || '', | |
67 | - flete: $scope.remito.flete, | |
68 | - fob: $scope.remito.fob, | |
69 | - bomba: $scope.remito.bomba, | |
70 | - kilometros: $scope.remito.kilometros, | |
71 | - domicilioStamp: $scope.remito.cliente.DOM, | |
72 | - observaciones: $scope.remito.observaciones, | |
73 | - numeroRemito: parseInt($scope.nroRemito), | |
74 | - sucursal: parseInt($scope.nroSucursal), | |
75 | - responsabilidadIvaCliente: $scope.remito.cliente.iva, | |
76 | - descuento: 0,//TODO, | |
77 | - importeNeto: getImporte('netoUnitario'), | |
78 | - importeExento: getImporte('exentoUnitario'), | |
79 | - importeIva: getImporte('ivaUnitario'), | |
80 | - importeIvaServicios: 0,//TODO | |
81 | - importeImpuestoInterno: getImporte('impuestoInternoUnitario'), | |
82 | - importeImpuestoInterno1: getImporte('impuestoInterno1Unitario'), | |
83 | - importeImpuestoInterno2: getImporte('impuestoInterno2Unitario'), | |
84 | - percepcion: 0,//TODO | |
85 | - percepcionIva: 0,//TODO | |
86 | - redondeo: 0,//TODO | |
87 | - anulado: false, | |
88 | - planilla: $filter('date')($scope.now, 'ddMMyyyy'), | |
89 | - lugar: parseInt($scope.puntoVenta), | |
90 | - cuentaMadre: 0,//TODO | |
91 | - cuentaContable: 0,//TODO | |
92 | - asiento: 0,//TODO | |
93 | - e_hd: '',//TODO | |
94 | - c_hd: '', | |
95 | - numeroLiquidoProducto: 0,//TODO | |
96 | - estado: 0, | |
97 | - destinoVenta: 0,//TODO | |
98 | - operacionTipo: 0, //TODO | |
99 | - idHojaRuta: $scope.remito.idHojaRuta | |
100 | - } | |
54 | + var save = { | |
55 | + remito: { | |
56 | + id: 0, | |
57 | + fechaRemito: new Date().toISOString().slice(0, 19).replace('T', ' '), | |
58 | + idCliente: $scope.remito.cliente.COD, | |
59 | + nombreCliente: $scope.remito.cliente.NOM, | |
60 | + cuitCliente: $scope.remito.cliente.CUIT, | |
61 | + total: $scope.getTotal() * $scope.remito.cotizacion.VENDEDOR, | |
62 | + numeroNotaPedido: $scope.remito.numeroNotaPedido, | |
63 | + idVendedor: $scope.remito.cliente.VEN, | |
64 | + idProveedor: $scope.remito.proveedor.COD, | |
65 | + idDomicilio: 0, | |
66 | + idCotizacion: $scope.remito.cotizacion.ID, | |
67 | + idListaPrecio: parseInt($scope.remito.cliente.MOD) || '', | |
68 | + flete: $scope.remito.flete, | |
69 | + fob: $scope.remito.fob, | |
70 | + bomba: $scope.remito.bomba, | |
71 | + kilometros: $scope.remito.kilometros, | |
72 | + domicilioStamp: $scope.remito.cliente.DOM, | |
73 | + observaciones: $scope.remito.observaciones, | |
74 | + numeroRemito: parseInt($scope.nroRemito), | |
75 | + sucursal: parseInt($scope.nroSucursal), | |
76 | + responsabilidadIvaCliente: $scope.remito.cliente.IVA, | |
77 | + descuento: 0,//TODO, | |
78 | + importeNeto: getImporte('netoUnitario'), | |
79 | + importeExento: getImporte('exentoUnitario'), | |
80 | + importeIva: getImporte('ivaUnitario'), | |
81 | + importeIvaServicios: 0,//TODO | |
82 | + importeImpuestoInterno: getImporte('impuestoInternoUnitario'), | |
83 | + importeImpuestoInterno1: getImporte('impuestoInterno1Unitario'), | |
84 | + importeImpuestoInterno2: getImporte('impuestoInterno2Unitario'), | |
85 | + percepcion: 0,//TODO | |
86 | + percepcionIva: 0,//TODO | |
87 | + redondeo: 0,//TODO | |
88 | + anulado: false, | |
89 | + planilla: $filter('date')($scope.now, 'ddMMyyyy'), | |
90 | + lugar: parseInt($scope.puntoVenta), | |
91 | + cuentaMadre: 0,//TODO | |
92 | + cuentaContable: 0,//TODO | |
93 | + asiento: 0,//TODO | |
94 | + e_hd: '',//TODO | |
95 | + c_hd: '', | |
96 | + numeroLiquidoProducto: 0,//TODO | |
97 | + estado: 0, | |
98 | + destinoVenta: 0,//TODO | |
99 | + operacionTipo: 0, //TODO | |
100 | + idHojaRuta: $scope.remito.idHojaRuta | |
101 | + }, | |
102 | + notaPedido: { | |
103 | + id: 0 | |
104 | + }, | |
105 | + articulos: focaModalDescargasService | |
106 | + .addArticulos($scope.remito.articulosRemito, $scope.articulos, 1), | |
107 | + puntosDescarga: [], | |
108 | + plazos: [] | |
109 | + }; | |
101 | 110 | //#endregion |
102 | - focaModalDescargasService.crearRemito({ remito: remito, notaPedido: { id: 0 } }) | |
111 | + focaModalDescargasService.crearRemito(save) | |
103 | 112 | .then(function (res) { |
104 | - remitoId = res.data.id | |
113 | + remitoId = res.data.id; | |
105 | 114 | descargar(remitoId); |
106 | - focaModalDescargasService. | |
107 | - addArticulos($scope.remito.articulosRemito, $scope.articulos, remitoId, 1); | |
108 | 115 | focaModalService.alert("Descarga realizada") |
109 | 116 | .then(function () { |
110 | 117 | $uibModalInstance.dismiss(); |
... | ... | @@ -214,8 +221,12 @@ angular.module('focaModalDescarga') |
214 | 221 | templateUrl: 'foca-busqueda-cliente-modal.html', |
215 | 222 | controller: 'focaBusquedaClienteModalController', |
216 | 223 | resolve: { |
217 | - vendedor: function () { return null; }, | |
218 | - cobrador: function () { return null; } | |
224 | + parametros: function() { | |
225 | + return { | |
226 | + vendedor: function () { return null; }, | |
227 | + cobrador: function () { return null; } | |
228 | + } | |
229 | + } | |
219 | 230 | }, |
220 | 231 | size: 'lg' |
221 | 232 | } |
src/js/service.js
... | ... | @@ -10,7 +10,7 @@ angular.module('focaModalDescarga') |
10 | 10 | return $http.get(route + '/remito/validar/' + |
11 | 11 | sucursal + '/' + remito); |
12 | 12 | }, |
13 | - addArticulos: function (articulosRemito, articulosBase, idRemito, cotizacion) { | |
13 | + addArticulos: function (articulosRemito, articulosBase, cotizacion) { | |
14 | 14 | |
15 | 15 | for (var i = 0; i < articulosRemito.length; i++) { |
16 | 16 | |
... | ... | @@ -24,16 +24,14 @@ angular.module('focaModalDescarga') |
24 | 24 | delete articulosRemito[i].editCantidad; |
25 | 25 | delete articulosRemito[i].editPrecio; |
26 | 26 | |
27 | - articulosRemito[i].idRemito = articulosRemito[i].idRemito !== -1 ? | |
28 | - idRemito : articulosRemito[i].idRemito; | |
29 | - | |
30 | 27 | articulosRemito[i].precio = articuloReferencia.PreVen * cotizacion; |
31 | 28 | articulosRemito[i].cantidad = articuloReferencia.cantidad; |
32 | 29 | articulosRemito[i].cantidadDescargada = articuloReferencia.cantidad; |
33 | 30 | |
34 | 31 | delete articulosRemito[i].idNotaPedido; |
35 | - crearRemitoService.crearArticulosParaRemito(articulosRemito[i]); | |
36 | 32 | } |
33 | + | |
34 | + return articulosRemito; | |
37 | 35 | } |
38 | 36 | }; |
39 | 37 | }]); |
src/views/foca-modal-descarga.html
... | ... | @@ -20,9 +20,10 @@ |
20 | 20 | <button |
21 | 21 | ladda="searchLoading" |
22 | 22 | data-spinner-color="#FF0000" |
23 | - class="btn btn-outline-secondary" | |
23 | + class="btn btn-outline-secondary" | |
24 | 24 | type="button" |
25 | 25 | ng-click="seleccionarCliente()" |
26 | + id="esEsteXD" | |
26 | 27 | > |
27 | 28 | <i class="fa fa-search fa-x1" aria-hidden="true"></i> |
28 | 29 | </button> |