|
@@ -593,7 +593,7 @@ function isDef(v){
|
|
|
return typeof v !== 'undefined' && v !== null;
|
|
return typeof v !== 'undefined' && v !== null;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
-function getCommonTotalFee(bills) {
|
|
|
|
|
|
|
+function getTotalFee(bills, feeName) {
|
|
|
if(!isDef(bills)){
|
|
if(!isDef(bills)){
|
|
|
return 0;
|
|
return 0;
|
|
|
}
|
|
}
|
|
@@ -601,7 +601,7 @@ function getCommonTotalFee(bills) {
|
|
|
return 0;
|
|
return 0;
|
|
|
}
|
|
}
|
|
|
for(let fee of bills.fees){
|
|
for(let fee of bills.fees){
|
|
|
- if(isDef(fee.fieldName) && fee.fieldName === 'common'){
|
|
|
|
|
|
|
+ if(isDef(fee.fieldName) && fee.fieldName === feeName){
|
|
|
return isDef(fee.totalFee) ? fee.totalFee : 0;
|
|
return isDef(fee.totalFee) ? fee.totalFee : 0;
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
@@ -610,13 +610,18 @@ function getCommonTotalFee(bills) {
|
|
|
|
|
|
|
|
function summarizeToParent(parent, child) {
|
|
function summarizeToParent(parent, child) {
|
|
|
const decimal = -2;
|
|
const decimal = -2;
|
|
|
|
|
+ let costFields = ['engineeringCost', 'subEngineering', 'measure', 'safetyConstruction', 'other', 'charge', 'tax', 'estimate'];
|
|
|
|
|
+ for (let field of costFields) {
|
|
|
|
|
+ parent[field] = scMathUtil.roundTo(parseFloat(parent[field]) + parseFloat(child[field]), decimal);
|
|
|
|
|
+ }
|
|
|
|
|
+ /* const decimal = -2;
|
|
|
parent.engineeringCost = scMathUtil.roundTo(parseFloat(parent.engineeringCost) + parseFloat(child.engineeringCost), decimal);
|
|
parent.engineeringCost = scMathUtil.roundTo(parseFloat(parent.engineeringCost) + parseFloat(child.engineeringCost), decimal);
|
|
|
parent.subEngineering = scMathUtil.roundTo(parseFloat(parent.subEngineering) + parseFloat(child.subEngineering), decimal);
|
|
parent.subEngineering = scMathUtil.roundTo(parseFloat(parent.subEngineering) + parseFloat(child.subEngineering), decimal);
|
|
|
parent.measure = scMathUtil.roundTo(parseFloat(parent.measure) + parseFloat(child.measure), decimal);
|
|
parent.measure = scMathUtil.roundTo(parseFloat(parent.measure) + parseFloat(child.measure), decimal);
|
|
|
parent.safetyConstruction = scMathUtil.roundTo(parseFloat(parent.safetyConstruction) + parseFloat(child.safetyConstruction), decimal);
|
|
parent.safetyConstruction = scMathUtil.roundTo(parseFloat(parent.safetyConstruction) + parseFloat(child.safetyConstruction), decimal);
|
|
|
parent.other = scMathUtil.roundTo(parseFloat(parent.other) + parseFloat(child.other), decimal);
|
|
parent.other = scMathUtil.roundTo(parseFloat(parent.other) + parseFloat(child.other), decimal);
|
|
|
parent.charge = scMathUtil.roundTo(parseFloat(parent.charge) + parseFloat(child.charge), decimal);
|
|
parent.charge = scMathUtil.roundTo(parseFloat(parent.charge) + parseFloat(child.charge), decimal);
|
|
|
- parent.tax = scMathUtil.roundTo(parseFloat(parent.tax) + parseFloat(child.tax), decimal);
|
|
|
|
|
|
|
+ parent.tax = scMathUtil.roundTo(parseFloat(parent.tax) + parseFloat(child.tax), decimal);*/
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
function getBuildingArea(projFeature){
|
|
function getBuildingArea(projFeature){
|
|
@@ -689,7 +694,7 @@ async function getTendersFeeInfo(tenders) {
|
|
|
if(tenders.length > 0){
|
|
if(tenders.length > 0){
|
|
|
for(let tender of tenders){
|
|
for(let tender of tenders){
|
|
|
tenderIDs.push(tender.ID);
|
|
tenderIDs.push(tender.ID);
|
|
|
- IDMapping[tender.ID] = {engineeringCost: 0, subEngineering: 0, measure: 0, safetyConstruction: 0, other: 0, charge: 0, tax: 0, rate: 0, buildingArea: '', perCost: ''};
|
|
|
|
|
|
|
+ IDMapping[tender.ID] = {engineeringCost: 0, subEngineering: 0, measure: 0, safetyConstruction: 0, other: 0, charge: 0, tax: 0, estimate: 0, rate: 0, buildingArea: '', perCost: ''};
|
|
|
IDMapping[tender.ID]['buildingArea'] = '';
|
|
IDMapping[tender.ID]['buildingArea'] = '';
|
|
|
}
|
|
}
|
|
|
//需要获取的清单固定类别综合合价:工程造价、分部分项、措施项目、安全文明施工专项、规费、其他项目、税金
|
|
//需要获取的清单固定类别综合合价:工程造价、分部分项、措施项目、安全文明施工专项、规费、其他项目、税金
|
|
@@ -702,7 +707,11 @@ async function getTendersFeeInfo(tenders) {
|
|
|
for(let bills of allBills){
|
|
for(let bills of allBills){
|
|
|
let billsFlag = bills.flags[0]['flag'];
|
|
let billsFlag = bills.flags[0]['flag'];
|
|
|
let costField = flagFieldMapping[billsFlag];
|
|
let costField = flagFieldMapping[billsFlag];
|
|
|
- IDMapping[bills.projectID][costField] = getCommonTotalFee(bills);
|
|
|
|
|
|
|
+ IDMapping[bills.projectID][costField] = getTotalFee(bills, 'common');
|
|
|
|
|
+ //暂估合价(工程造价暂估合价)
|
|
|
|
|
+ if (billsFlag === billsFlags.ENGINEERINGCOST){
|
|
|
|
|
+ IDMapping[bills.projectID]['estimate'] = getTotalFee(bills, 'estimate');
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|
|
|
//占造价比例、单方造价
|
|
//占造价比例、单方造价
|
|
|
for(let tender of tenders){
|
|
for(let tender of tenders){
|
|
@@ -742,7 +751,7 @@ async function getSummaryInfo(projectIDs){
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
- IDMapping[project.ID] = {engineeringCost: 0, subEngineering: 0, measure: 0, safetyConstruction: 0, other: 0, charge: 0, tax: 0, rate: 0, buildingArea: grossArea, perCost: ''};
|
|
|
|
|
|
|
+ IDMapping[project.ID] = {engineeringCost: 0, subEngineering: 0, measure: 0, safetyConstruction: 0, other: 0, charge: 0, tax: 0, estimate: 0, rate: 0, buildingArea: grossArea, perCost: ''};
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
//单项工程
|
|
//单项工程
|
|
@@ -752,7 +761,7 @@ async function getSummaryInfo(projectIDs){
|
|
|
let engIDs = [];
|
|
let engIDs = [];
|
|
|
for(let eng of engineerings){
|
|
for(let eng of engineerings){
|
|
|
engIDs.push(eng.ID);
|
|
engIDs.push(eng.ID);
|
|
|
- IDMapping[eng.ID] = {engineeringCost: 0, subEngineering: 0, measure: 0, safetyConstruction: 0, other: 0, charge: 0, tax: 0, rate: 0, buildingArea: '', perCost: ''};
|
|
|
|
|
|
|
+ IDMapping[eng.ID] = {engineeringCost: 0, subEngineering: 0, measure: 0, safetyConstruction: 0, other: 0, charge: 0, tax: 0, estimate: 0, rate: 0, buildingArea: '', perCost: ''};
|
|
|
}
|
|
}
|
|
|
if(engIDs.length > 0){
|
|
if(engIDs.length > 0){
|
|
|
tenders = await projectModel.find({ParentID: {$in : engIDs}, projType: projectType.tender, $or: [{deleteInfo: null}, {'deleteInfo.deleted': false}]});
|
|
tenders = await projectModel.find({ParentID: {$in : engIDs}, projType: projectType.tender, $or: [{deleteInfo: null}, {'deleteInfo.deleted': false}]});
|
|
@@ -761,7 +770,8 @@ async function getSummaryInfo(projectIDs){
|
|
|
if(tenders.length > 0){
|
|
if(tenders.length > 0){
|
|
|
for(let tender of tenders){
|
|
for(let tender of tenders){
|
|
|
tenderIDs.push(tender.ID);
|
|
tenderIDs.push(tender.ID);
|
|
|
- IDMapping[tender.ID] = {engineeringCost: 0, subEngineering: 0, measure: 0, safetyConstruction: 0, other: 0, charge: 0, tax: 0, rate: 0, buildingArea: '', perCost: '',changeMark:tender.changeMark,property:tender.property};
|
|
|
|
|
|
|
+ IDMapping[tender.ID] = {engineeringCost: 0, subEngineering: 0, measure: 0, safetyConstruction: 0, other: 0, charge: 0, tax: 0, rate: 0, estimate: 0,
|
|
|
|
|
+ buildingArea: '', perCost: '',changeMark:tender.changeMark,property:tender.property};
|
|
|
let buildingArea = getBuildingArea(tender.property.projectFeature);
|
|
let buildingArea = getBuildingArea(tender.property.projectFeature);
|
|
|
if(buildingArea){
|
|
if(buildingArea){
|
|
|
IDMapping[tender.ID]['buildingArea'] = buildingArea;
|
|
IDMapping[tender.ID]['buildingArea'] = buildingArea;
|
|
@@ -777,7 +787,11 @@ async function getSummaryInfo(projectIDs){
|
|
|
for(let bills of allBills){
|
|
for(let bills of allBills){
|
|
|
let billsFlag = bills.flags[0]['flag'];
|
|
let billsFlag = bills.flags[0]['flag'];
|
|
|
let costField = flagFieldMapping[billsFlag];
|
|
let costField = flagFieldMapping[billsFlag];
|
|
|
- IDMapping[bills.projectID][costField] = getCommonTotalFee(bills);
|
|
|
|
|
|
|
+ IDMapping[bills.projectID][costField] = getTotalFee(bills, 'common');
|
|
|
|
|
+ //暂估合价(工程造价暂估合价)
|
|
|
|
|
+ if (billsFlag === billsFlags.ENGINEERINGCOST){
|
|
|
|
|
+ IDMapping[bills.projectID]['estimate'] = getTotalFee(bills, 'estimate');
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|
|
|
//进行单项工程级别的汇总
|
|
//进行单项工程级别的汇总
|
|
|
for(let tender of tenders){
|
|
for(let tender of tenders){
|