Commit af9e4723d0a866c5081e5407030b80c1a9d59723
1 parent
dbb702bb53
Exists in
master
Corregidos errores
Showing
1 changed file
with
12 additions
and
14 deletions
Show diff stats
src/js/controller.js
... | ... | @@ -20,8 +20,6 @@ angular.module('focaModalDescarga') |
20 | 20 | $scope.nroRecibo = 0; |
21 | 21 | $scope.cisternas = remito.cisternas; |
22 | 22 | $scope.nroRemito = "00" + remito.sucursal + "-000000000" + remito.numeroRemito; |
23 | - | |
24 | - console.log(remito); | |
25 | 23 | //#endregion |
26 | 24 | |
27 | 25 | $scope.crearRemito = function () { |
... | ... | @@ -48,7 +46,7 @@ angular.module('focaModalDescarga') |
48 | 46 | numeroNotaPedido: $scope.remito.numeroNotaPedido, |
49 | 47 | idVendedor: $scope.remito.vendedor.NUM, |
50 | 48 | idProveedor: $scope.remito.proveedor.COD, |
51 | - idDomicilio: $scope.remito.idDomicilio || $scope.remito.domicilio.id, | |
49 | + idDomicilio: 0, | |
52 | 50 | idCotizacion: $scope.remito.cotizacion.ID, |
53 | 51 | idListaPrecio: $scope.remito.cliente.mod, |
54 | 52 | flete: $scope.remito.flete, |
... | ... | @@ -86,14 +84,15 @@ angular.module('focaModalDescarga') |
86 | 84 | idHojaRuta: $scope.remito.idHojaRuta |
87 | 85 | } |
88 | 86 | //#endregionc |
89 | - focaModalDescargasService.crearRemito({remito: remito, notaPedido: {id:0}}) | |
87 | + focaModalDescargasService.crearRemito({ remito: remito, notaPedido: { id: 0 } }) | |
90 | 88 | .then(function (res) { |
91 | 89 | console.log(res); |
92 | 90 | remitoId = res.data.id |
93 | 91 | descargar(remitoId); |
94 | - focaModalDescargasService.addArticulos($scope.remito.articulosRemito, remitoId, 1); | |
92 | + focaModalDescargasService. | |
93 | + addArticulos($scope.remito.articulosRemito, remitoId, 1); | |
95 | 94 | focaModalService.alert("Descarga realizada") |
96 | - .then(function(){ | |
95 | + .then(function () { | |
97 | 96 | $uibModalInstance.dismiss(); |
98 | 97 | }) |
99 | 98 | }) |
... | ... | @@ -102,9 +101,12 @@ angular.module('focaModalDescarga') |
102 | 101 | }; |
103 | 102 | $scope.getTotal = function () { |
104 | 103 | var total = 0; |
105 | - var arrayTempArticulos = $scope.remito.articulosRemito; | |
106 | - for (var i = 0; i < arrayTempArticulos.length; i++) { | |
107 | - total += arrayTempArticulos[i].precio * arrayTempArticulos[i].cantidad; | |
104 | + var articulos = []; | |
105 | + $scope.cisternas.forEach(function (cisterna) { | |
106 | + articulos.push(cisterna.cisternaCarga.articulo); | |
107 | + }); | |
108 | + for (var i = 0; i < articulos.length; i++) { | |
109 | + total += articulos[i].PreVen * articulos[i].cantidad; | |
108 | 110 | } |
109 | 111 | return parseFloat(total.toFixed(2)); |
110 | 112 | }; |
... | ... | @@ -152,7 +154,7 @@ angular.module('focaModalDescarga') |
152 | 154 | focaModalDetalleHojaRutaService |
153 | 155 | .postMovimientoHojaRuta(save) |
154 | 156 | .then(guardarSeguimiento) |
155 | - .catch(function() {}); | |
157 | + .catch(function () { }); | |
156 | 158 | function guardarSeguimiento(res) { |
157 | 159 | focaSeguimientoService |
158 | 160 | .guardarPosicion( |
... | ... | @@ -164,16 +166,12 @@ angular.module('focaModalDescarga') |
164 | 166 | }; |
165 | 167 | function getImporte(propiedad) { |
166 | 168 | var importe = 0; |
167 | - | |
168 | 169 | $scope.remito.articulosRemito.forEach(function (articulo) { |
169 | - | |
170 | 170 | if (articulo[propiedad]) { |
171 | 171 | importe += articulo[propiedad] * articulo.cantidad; |
172 | 172 | } |
173 | 173 | return; |
174 | - | |
175 | 174 | }); |
176 | - | |
177 | 175 | return importe; |
178 | 176 | }; |
179 | 177 | function validarDescarga() { |