|
|
@@ -305,7 +305,8 @@ async function getBudgetSummayDatas(projectIDs){
|
|
|
SummaryAudit:{
|
|
|
"name": parentProject?parentProject.name:"",
|
|
|
"编制": mp.author,
|
|
|
- "复核": mp.auditor
|
|
|
+ "复核": mp.auditor,
|
|
|
+ "编制范围":mp.compilationScope
|
|
|
},
|
|
|
SummaryAuditDetail:SummaryAuditDetail
|
|
|
}
|
|
|
@@ -320,8 +321,8 @@ function getReportData(nameList,items,decimal) {
|
|
|
let datas = [],totalItem = null;
|
|
|
setChildrenDatas(items,datas);
|
|
|
for(let d of datas){
|
|
|
- if(d.billsTtlPrices){
|
|
|
- d['各项费用比例'] = scMathUtil.roundForObj(d.billsTtlPrices/totalItem.billsTtlPrices * 100,2)
|
|
|
+ if(d.billsTtlPrice){
|
|
|
+ d['各项费用比例'] = scMathUtil.roundForObj(d.billsTtlPrice/totalItem.billsTtlPrice * 100,2)
|
|
|
}
|
|
|
d['prjNames'] = nameList;
|
|
|
}
|
|
|
@@ -342,21 +343,31 @@ function getReportData(nameList,items,decimal) {
|
|
|
billsUnit:bills.unit,
|
|
|
billsTtlAmt:bills.quantity,
|
|
|
billsPrices:[],
|
|
|
+ billsAmounts:[],
|
|
|
+ prjTypeNames:[],
|
|
|
+ '技术经济指标':[],
|
|
|
billsMemos:bills.remark
|
|
|
};
|
|
|
let total = 0;
|
|
|
for(let n of nameList){
|
|
|
+ let p = 0;
|
|
|
if(bills.prices[n]){
|
|
|
- let p = scMathUtil.roundForObj(bills.prices[n],decimal.bills.totalPrice);
|
|
|
- tem.billsPrices.push(p);
|
|
|
+ p = scMathUtil.roundForObj(bills.prices[n],decimal.bills.totalPrice);
|
|
|
total = scMathUtil.roundForObj(p+total,decimal.process);
|
|
|
+ }
|
|
|
+ tem.billsPrices.push(p);
|
|
|
+ if(bills.quantityMap[n]){
|
|
|
+ tem.billsAmounts.push(bills.quantityMap[n]);
|
|
|
+ tem['技术经济指标'].push(scMathUtil.roundForObj(p/bills.quantityMap[n],2));
|
|
|
}else {
|
|
|
- tem.billsPrices.push(0);
|
|
|
+ tem.billsAmounts.push(0);
|
|
|
+ tem['技术经济指标'].push(0);
|
|
|
}
|
|
|
+ let pt = bills.prjType[n]?bills.prjType[n]:'';
|
|
|
+ tem.prjTypeNames.push(pt);
|
|
|
}
|
|
|
- tem.billsTtlPrices = scMathUtil.roundForObj(total,decimal.bills.totalPrice);
|
|
|
-
|
|
|
- if(tem.billsTtlAmt) tem['技术经济指标'] = scMathUtil.roundForObj(tem.billsTtlPrices/tem.billsTtlAmt,2);
|
|
|
+ tem.billsTtlPrice = scMathUtil.roundForObj(total,decimal.bills.totalPrice);
|
|
|
+ tem['技术经济综合指标'] = tem.billsTtlAmt?scMathUtil.roundForObj(tem.billsTtlPrice/tem.billsTtlAmt,2):0;
|
|
|
if(bills.flag == fixedFlag.TOTAL_COST) totalItem = tem;
|
|
|
return tem
|
|
|
}
|
|
|
@@ -387,7 +398,13 @@ async function mergeItem(a,b,decimal,project) {
|
|
|
a.quantity = scMathUtil.roundForObj(a.quantity+b.quantity,decimal.process);
|
|
|
for(let name in b.prices){
|
|
|
a.prices[name] = b.prices[name];
|
|
|
+ a.quantityMap[name] = b.quantityMap[name];
|
|
|
+ a.prjType[name] = b.prjType[name];
|
|
|
+ }
|
|
|
+ for(let name in a.quantityMap){
|
|
|
+ a.quantityMap[name] = a.quantityMap[name]?scMathUtil.roundForObj(a.quantityMap[name],bqDecimal):0;
|
|
|
}
|
|
|
+
|
|
|
await mergeChildren(a,b,decimal,project);
|
|
|
}
|
|
|
|
|
|
@@ -448,8 +465,6 @@ function findTheSameItem(main,item) {//编号名称单位三个相同,认为
|
|
|
return _.find(main,function (tem) {
|
|
|
return isEqual(tem.code,item.code)&&isEqual(tem.name,item.name)&&isEqual(tem.unit,item.unit);
|
|
|
})
|
|
|
-
|
|
|
-
|
|
|
}
|
|
|
|
|
|
|
|
|
@@ -469,18 +484,26 @@ async function getBillsByProjectID(projectID){
|
|
|
let projectName = project.name;
|
|
|
let author='';//编制人
|
|
|
let auditor='';//审核人
|
|
|
+ let compilationScope='';//编制范围
|
|
|
+ let engineering='';//养护类别
|
|
|
if(project.property&&project.property.projectFeature){
|
|
|
for(let f of project.property.projectFeature){
|
|
|
if(f.key == 'author') author = f.value;
|
|
|
if(f.key == 'auditor') auditor = f.value;
|
|
|
+ if(f.key =='compilationScope') compilationScope = f.value;
|
|
|
+ if(f.key == 'engineering') engineering = f.value;
|
|
|
}
|
|
|
}
|
|
|
for(let b of bills){
|
|
|
let commonFee =_.find(b._doc.fees,{"fieldName":"common"});
|
|
|
let prices = {};
|
|
|
+ let quantityMap={};
|
|
|
+ let prjType = {};
|
|
|
if(commonFee&&commonFee.totalFee) prices[projectName] = commonFee.totalFee;
|
|
|
+ quantityMap[projectName] = b.quantity;
|
|
|
+ prjType[projectName] = engineering;
|
|
|
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,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,quantity:b.quantity,prices:prices,quantityMap:quantityMap,prjType:prjType,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];
|
|
|
}//设置子节点
|
|
|
@@ -488,7 +511,7 @@ async function getBillsByProjectID(projectID){
|
|
|
setChildren(r,parentMap,1);
|
|
|
}
|
|
|
roots = sortChildren(roots);
|
|
|
- return {name:projectName,roots:roots,author:author,auditor:auditor,ParentID:project.ParentID}
|
|
|
+ return {name:projectName,roots:roots,author:author,auditor:auditor,compilationScope:compilationScope,ParentID:project.ParentID}
|
|
|
}
|
|
|
|
|
|
function setChildren(bill,parentMap,level) {
|