Browse Source

[FIX] correcion en la impresion del informe de stock

Rodney Elpidio Enciso Arias 7 năm trước cách đây
mục cha
commit
fb9b4d1c6a

+ 14 - 21
static/src/js/reports/report_stock.js

@@ -170,12 +170,13 @@ function report_stock (reporting){
                         product : product.product_id[1],
                         ean13 : self.valorNull(itemProduct.ean13),
                         category_name : itemProduct.categ_id[1],
-                        qty : quantity,
+                        qty : accounting.formatNumber(quantity,2, ".", ","),
                         standard_price : accounting.formatNumber(itemProduct.standard_price,0, ".", ","),
                         lst_price : accounting.formatNumber(itemProduct.lst_price,0, ".", ","),
                         valuation: accounting.formatNumber(total,0,".",","),
                         category_id : itemProduct.categ_id[0],
-                        location_id : product.location_id[0]
+                        location_id : product.location_id[0],
+                        total : total
                     });
                 }
             })
@@ -233,27 +234,18 @@ function report_stock (reporting){
         getObjectPdf: function(){
             var self = this;
             var rows=[];
-            var newStock = self.newStock;
-            var amount_total = 0;
-            var qty = 0;
-            for (var i = 0; i < newStock.length; i++) {
+            var rows = self.rowsData;
+            var total = _.reduce(_.map(rows,function(map){
+                return(map.total);
+            }),function(memo, num){
+                return memo + num;
+            },0);
+            if (rows.length > 0){
                 rows.push({
-                    product : newStock[i].product,
-                    qty : newStock[i].qty,
-                    standard_price : newStock[i].standard_price,
-                    lst_price : newStock[i].lst_price,
-                    total: newStock[i].total
+                    product: "Totales ",
+                    valuation: accounting.formatNumber(total,0,".",","),
                 });
-                qty+=parseInt(newStock[i].qty);
-                amount_total+=parseInt(newStock[i].total.replace(".",""));
             }
-            rows.push({
-                product : 'Totales',
-                qty : accounting.formatNumber(qty,0,".",","),
-                standard_price : '',
-                lst_price : '',
-                total: accounting.formatNumber(amount_total,0,".",","),
-            });
             return rows;
         },
         clickOnAction: function (e) {
@@ -294,10 +286,11 @@ function report_stock (reporting){
                     styles: { overflow: 'linebreak', fontSize:8 , columnWidth: 'wrap'},
                     columnStyles:{
                                     product :{columnWidth: '8px'},
+
                                     qty : {halign:'center'},
                                     standard_price : {halign:'right'},
                                     lst_price : {halign:'right'},
-                                    total : {halign:'right'},
+                                    valuation : {halign:'right'},
                                 },
                     margin: { top: 16, horizontal: 7},
                 addPageContent: function (data) {

+ 1 - 1
static/src/js/reports/report_vouchers.js

@@ -331,7 +331,7 @@ function report_vouchers (reporting){
             var self = this;
             var rowsPdf=[];
             var rows=[];
-            var rows = self.rowsData;
+            var rows = self.rowsData; 
             var total_in = _.reduce(_.map(rows,function(map){
                 return(map.in_amount);
             }),function(memo, num){