Commit ce7a007600ea7dffbc21ec3cdbc1e5951b487fa7
1 parent
af9e4723d0
Exists in
master
agregado variable articulos.
Showing
1 changed file
with
8 additions
and
6 deletions
Show diff stats
src/js/controller.js
... | ... | @@ -15,11 +15,13 @@ angular.module('focaModalDescarga') |
15 | 15 | focaModalDetalleHojaRutaService, focaSeguimientoService) { |
16 | 16 | |
17 | 17 | //#region variables |
18 | + console.log(remito); | |
18 | 19 | $scope.remito = {}; |
19 | 20 | $scope.remito = remito; |
20 | 21 | $scope.nroRecibo = 0; |
21 | 22 | $scope.cisternas = remito.cisternas; |
22 | 23 | $scope.nroRemito = "00" + remito.sucursal + "-000000000" + remito.numeroRemito; |
24 | + $scope.articulos = []; | |
23 | 25 | //#endregion |
24 | 26 | |
25 | 27 | $scope.crearRemito = function () { |
... | ... | @@ -90,7 +92,7 @@ angular.module('focaModalDescarga') |
90 | 92 | remitoId = res.data.id |
91 | 93 | descargar(remitoId); |
92 | 94 | focaModalDescargasService. |
93 | - addArticulos($scope.remito.articulosRemito, remitoId, 1); | |
95 | + addArticulos($scope.articulos, remitoId, 1); | |
94 | 96 | focaModalService.alert("Descarga realizada") |
95 | 97 | .then(function () { |
96 | 98 | $uibModalInstance.dismiss(); |
... | ... | @@ -101,13 +103,13 @@ angular.module('focaModalDescarga') |
101 | 103 | }; |
102 | 104 | $scope.getTotal = function () { |
103 | 105 | var total = 0; |
104 | - var articulos = []; | |
105 | 106 | $scope.cisternas.forEach(function (cisterna) { |
106 | - articulos.push(cisterna.cisternaCarga.articulo); | |
107 | + $scope.articulos.push(cisterna.cisternaCarga.articulo); | |
108 | + total += cisterna.cisternaCarga.articulo.PreVen * cisterna.cisternaCarga.descargar; | |
107 | 109 | }); |
108 | - for (var i = 0; i < articulos.length; i++) { | |
109 | - total += articulos[i].PreVen * articulos[i].cantidad; | |
110 | - } | |
110 | + // for (var i = 0; i < articulos.length; i++) { | |
111 | + // total += articulos[i].PreVen * articulos[i].cantidad; | |
112 | + // } | |
111 | 113 | return parseFloat(total.toFixed(2)); |
112 | 114 | }; |
113 | 115 | function descargar(idRemito) { |