Browse Source

报表结构

zhangweicheng 6 năm trước cách đây
mục cha
commit
06ca9558d3
1 tập tin đã thay đổi với 9 bổ sung2 xóa
  1. 9 2
      modules/main/facade/project_facade.js

+ 9 - 2
modules/main/facade/project_facade.js

@@ -351,6 +351,7 @@ function getReportData(nameList,items,prjTypeNames,compilationScopes,decimal) {
             billsUnit:bills.unit,
             billsTtlAmt:bills.quantity,
             billsPrices:[],
+            billsUnitPrices:[],
             billsAmounts:[],
             '技术经济指标':[],
             billsLevel:level,
@@ -358,7 +359,10 @@ function getReportData(nameList,items,prjTypeNames,compilationScopes,decimal) {
         };
         let total = 0;
         for(let n of nameList){
-            let  p = 0;
+            let  p = 0;//金额
+            let up =0;//单价
+            if(bills.unitPrices[n]) up = scMathUtil.roundForObj(bills.unitPrices[n],decimal.bills.unitPrice);
+            tem.billsUnitPrices.push(up);
             if(bills.prices[n]){
                 p =  scMathUtil.roundForObj(bills.prices[n],decimal.bills.totalPrice);
                 total = scMathUtil.roundForObj(p+total,decimal.process);
@@ -405,6 +409,7 @@ async function mergeItem(a,b,decimal,project) {
     for(let name in b.prices){
         a.prices[name] = b.prices[name];
         a.quantityMap[name] = b.quantityMap[name];
+        a.unitPrices[name]=b.unitPrices[name];
     }
     for(let name in a.quantityMap){
         a.quantityMap[name] = a.quantityMap[name]?scMathUtil.roundForObj(a.quantityMap[name],bqDecimal):0;
@@ -503,10 +508,12 @@ async function getBillsByProjectID(projectID){
        let commonFee =_.find(b._doc.fees,{"fieldName":"common"});
        let prices = {};
        let quantityMap={};
+       let unitPrices ={};
        if(commonFee&&commonFee.totalFee) prices[projectName] =  commonFee.totalFee;
+       if (commonFee&&commonFee.unitFee) unitPrices[projectName] = commonFee.unitFee;
        quantityMap[projectName] = b.quantity;
        let flagIndex = _.find(b._doc.flags,{'fieldName':'fixed'});
-       let doc = {ID:b.ID,name:b.name,code:b.code,unit:b.unit,projectID:b.projectID, ParentID:b.ParentID,NextSiblingID:b.NextSiblingID,quantity:b.quantity,prices:prices,quantityMap:quantityMap,flag:flagIndex?flagIndex.flag:-99,remark:b.remark};//选取有用字段
+       let doc = {ID:b.ID,name:b.name,code:b.code,unit:b.unit,projectID:b.projectID, ParentID:b.ParentID,NextSiblingID:b.NextSiblingID,unitPrices:unitPrices,quantity:b.quantity,prices:prices,quantityMap:quantityMap,flag:flagIndex?flagIndex.flag:-99,remark:b.remark};//选取有用字段
        if(b.ParentID == -1) roots.push(doc);
        parentMap[b.ParentID]?parentMap[b.ParentID].push(doc):parentMap[b.ParentID]=[doc];
    }//设置子节点