|
@@ -285,6 +285,7 @@ async function getBudgetSummayDatas(projectIDs){
|
|
|
try {
|
|
try {
|
|
|
let projects = [];
|
|
let projects = [];
|
|
|
let names = [];
|
|
let names = [];
|
|
|
|
|
+ let prjTypeNames = [];
|
|
|
let decimal = null;
|
|
let decimal = null;
|
|
|
for(let ID of projectIDs){
|
|
for(let ID of projectIDs){
|
|
|
projects.push(await getBillsByProjectID(ID)) ;
|
|
projects.push(await getBillsByProjectID(ID)) ;
|
|
@@ -294,11 +295,13 @@ async function getBudgetSummayDatas(projectIDs){
|
|
|
}
|
|
}
|
|
|
let mp = projects[0];
|
|
let mp = projects[0];
|
|
|
names.push(mp.name);
|
|
names.push(mp.name);
|
|
|
|
|
+ prjTypeNames.push(mp.prjTypeName);
|
|
|
for(let i = 1;i<projects.length;i++){
|
|
for(let i = 1;i<projects.length;i++){
|
|
|
names.push(projects[i].name);
|
|
names.push(projects[i].name);
|
|
|
|
|
+ prjTypeNames.push(projects[i].prjTypeName);
|
|
|
decimal = await mergeProject(mp.roots,projects[i].roots)
|
|
decimal = await mergeProject(mp.roots,projects[i].roots)
|
|
|
}
|
|
}
|
|
|
- let SummaryAuditDetail = getReportData(names,mp.roots,decimal);
|
|
|
|
|
|
|
+ let SummaryAuditDetail = getReportData(names,mp.roots,prjTypeNames,decimal);
|
|
|
let parentProject = await projectsModel.findOne({ID:mp.ParentID});
|
|
let parentProject = await projectsModel.findOne({ID:mp.ParentID});
|
|
|
let result = {
|
|
let result = {
|
|
|
prj: {},
|
|
prj: {},
|
|
@@ -317,14 +320,15 @@ async function getBudgetSummayDatas(projectIDs){
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
-function getReportData(nameList,items,decimal) {
|
|
|
|
|
|
|
+function getReportData(nameList,items,prjTypeNames,decimal) {
|
|
|
let datas = [],totalItem = null;
|
|
let datas = [],totalItem = null;
|
|
|
setChildrenDatas(items,datas);
|
|
setChildrenDatas(items,datas);
|
|
|
for(let d of datas){
|
|
for(let d of datas){
|
|
|
- if(d.billsTtlPrice){
|
|
|
|
|
|
|
+ if(d.billsTtlPrice&&totalItem.billsTtlPrice){
|
|
|
d['各项费用比例'] = scMathUtil.roundForObj(d.billsTtlPrice/totalItem.billsTtlPrice * 100,2)
|
|
d['各项费用比例'] = scMathUtil.roundForObj(d.billsTtlPrice/totalItem.billsTtlPrice * 100,2)
|
|
|
}
|
|
}
|
|
|
d['prjNames'] = nameList;
|
|
d['prjNames'] = nameList;
|
|
|
|
|
+ d['prjTypeNames'] = prjTypeNames;
|
|
|
}
|
|
}
|
|
|
return datas;
|
|
return datas;
|
|
|
|
|
|
|
@@ -344,7 +348,6 @@ function getReportData(nameList,items,decimal) {
|
|
|
billsTtlAmt:bills.quantity,
|
|
billsTtlAmt:bills.quantity,
|
|
|
billsPrices:[],
|
|
billsPrices:[],
|
|
|
billsAmounts:[],
|
|
billsAmounts:[],
|
|
|
- prjTypeNames:[],
|
|
|
|
|
'技术经济指标':[],
|
|
'技术经济指标':[],
|
|
|
billsMemos:bills.remark
|
|
billsMemos:bills.remark
|
|
|
};
|
|
};
|
|
@@ -363,8 +366,6 @@ function getReportData(nameList,items,decimal) {
|
|
|
tem.billsAmounts.push(0);
|
|
tem.billsAmounts.push(0);
|
|
|
tem['技术经济指标'].push(0);
|
|
tem['技术经济指标'].push(0);
|
|
|
}
|
|
}
|
|
|
- let pt = bills.prjType[n]?bills.prjType[n]:'';
|
|
|
|
|
- tem.prjTypeNames.push(pt);
|
|
|
|
|
}
|
|
}
|
|
|
tem.billsTtlPrice = scMathUtil.roundForObj(total,decimal.bills.totalPrice);
|
|
tem.billsTtlPrice = scMathUtil.roundForObj(total,decimal.bills.totalPrice);
|
|
|
tem['技术经济综合指标'] = tem.billsTtlAmt?scMathUtil.roundForObj(tem.billsTtlPrice/tem.billsTtlAmt,2):0;
|
|
tem['技术经济综合指标'] = tem.billsTtlAmt?scMathUtil.roundForObj(tem.billsTtlPrice/tem.billsTtlAmt,2):0;
|
|
@@ -399,7 +400,6 @@ async function mergeItem(a,b,decimal,project) {
|
|
|
for(let name in b.prices){
|
|
for(let name in b.prices){
|
|
|
a.prices[name] = b.prices[name];
|
|
a.prices[name] = b.prices[name];
|
|
|
a.quantityMap[name] = b.quantityMap[name];
|
|
a.quantityMap[name] = b.quantityMap[name];
|
|
|
- a.prjType[name] = b.prjType[name];
|
|
|
|
|
}
|
|
}
|
|
|
for(let name in a.quantityMap){
|
|
for(let name in a.quantityMap){
|
|
|
a.quantityMap[name] = a.quantityMap[name]?scMathUtil.roundForObj(a.quantityMap[name],bqDecimal):0;
|
|
a.quantityMap[name] = a.quantityMap[name]?scMathUtil.roundForObj(a.quantityMap[name],bqDecimal):0;
|
|
@@ -498,12 +498,10 @@ async function getBillsByProjectID(projectID){
|
|
|
let commonFee =_.find(b._doc.fees,{"fieldName":"common"});
|
|
let commonFee =_.find(b._doc.fees,{"fieldName":"common"});
|
|
|
let prices = {};
|
|
let prices = {};
|
|
|
let quantityMap={};
|
|
let quantityMap={};
|
|
|
- let prjType = {};
|
|
|
|
|
if(commonFee&&commonFee.totalFee) prices[projectName] = commonFee.totalFee;
|
|
if(commonFee&&commonFee.totalFee) prices[projectName] = commonFee.totalFee;
|
|
|
quantityMap[projectName] = b.quantity;
|
|
quantityMap[projectName] = b.quantity;
|
|
|
- prjType[projectName] = engineering;
|
|
|
|
|
let flagIndex = _.find(b._doc.flags,{'fieldName':'fixed'});
|
|
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,prjType:prjType,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,flag:flagIndex?flagIndex.flag:-99,remark:b.remark};//选取有用字段
|
|
|
if(b.ParentID == -1) roots.push(doc);
|
|
if(b.ParentID == -1) roots.push(doc);
|
|
|
parentMap[b.ParentID]?parentMap[b.ParentID].push(doc):parentMap[b.ParentID]=[doc];
|
|
parentMap[b.ParentID]?parentMap[b.ParentID].push(doc):parentMap[b.ParentID]=[doc];
|
|
|
}//设置子节点
|
|
}//设置子节点
|
|
@@ -511,7 +509,7 @@ async function getBillsByProjectID(projectID){
|
|
|
setChildren(r,parentMap,1);
|
|
setChildren(r,parentMap,1);
|
|
|
}
|
|
}
|
|
|
roots = sortChildren(roots);
|
|
roots = sortChildren(roots);
|
|
|
- return {name:projectName,roots:roots,author:author,auditor:auditor,compilationScope:compilationScope,ParentID:project.ParentID}
|
|
|
|
|
|
|
+ return {name:projectName,roots:roots,author:author,auditor:auditor,compilationScope:compilationScope,ParentID:project.ParentID,prjTypeName:engineering}
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
function setChildren(bill,parentMap,level) {
|
|
function setChildren(bill,parentMap,level) {
|