|
@@ -105,7 +105,7 @@ import SectionTreeDao from '../../complementary_ration_lib/models/sectionTreeMod
|
|
let sectionTreeDao = new SectionTreeDao();
|
|
let sectionTreeDao = new SectionTreeDao();
|
|
import CounterModel from "../../glj/models/counter_model";
|
|
import CounterModel from "../../glj/models/counter_model";
|
|
import moment from 'moment-timezone';
|
|
import moment from 'moment-timezone';
|
|
-import billsFlags from '../../common/const/bills_fixed';
|
|
|
|
|
|
+const { fixedFlag } = require('../../../public/common_constants');
|
|
const notDeleted = [{deleteInfo: null}, {'deleteInfo.deleted': false}];
|
|
const notDeleted = [{deleteInfo: null}, {'deleteInfo.deleted': false}];
|
|
import {
|
|
import {
|
|
defaultDecimal,
|
|
defaultDecimal,
|
|
@@ -1046,13 +1046,13 @@ async function getTendersFeeInfo(tenders) {
|
|
let IDMapping = {};
|
|
let IDMapping = {};
|
|
//固定清单类别与汇总金额字段映射
|
|
//固定清单类别与汇总金额字段映射
|
|
let flagFieldMapping = {};
|
|
let flagFieldMapping = {};
|
|
- flagFieldMapping[billsFlags.ENGINEERINGCOST] = 'engineeringCost';
|
|
|
|
- flagFieldMapping[billsFlags.SUB_ENGINERRING] = 'subEngineering';
|
|
|
|
- flagFieldMapping[billsFlags.MEASURE] = 'measure';
|
|
|
|
- flagFieldMapping[billsFlags.SAFETY_CONSTRUCTION] = 'safetyConstruction';
|
|
|
|
- flagFieldMapping[billsFlags.OTHER] = 'other';
|
|
|
|
- flagFieldMapping[billsFlags.CHARGE] = 'charge';
|
|
|
|
- flagFieldMapping[billsFlags.TAX] = 'tax';
|
|
|
|
|
|
+ flagFieldMapping[fixedFlag.ENGINEERINGCOST] = 'engineeringCost';
|
|
|
|
+ flagFieldMapping[fixedFlag.SUB_ENGINERRING] = 'subEngineering';
|
|
|
|
+ flagFieldMapping[fixedFlag.MEASURE] = 'measure';
|
|
|
|
+ flagFieldMapping[fixedFlag.SAFETY_CONSTRUCTION] = 'safetyConstruction';
|
|
|
|
+ flagFieldMapping[fixedFlag.OTHER] = 'other';
|
|
|
|
+ flagFieldMapping[fixedFlag.CHARGE] = 'charge';
|
|
|
|
+ flagFieldMapping[fixedFlag.TAX] = 'tax';
|
|
let tenderIDs = [];
|
|
let tenderIDs = [];
|
|
if(tenders.length > 0){
|
|
if(tenders.length > 0){
|
|
for(let tender of tenders){
|
|
for(let tender of tenders){
|
|
@@ -1061,8 +1061,8 @@ async function getTendersFeeInfo(tenders) {
|
|
IDMapping[tender.ID]['buildingArea'] = '';
|
|
IDMapping[tender.ID]['buildingArea'] = '';
|
|
}
|
|
}
|
|
//需要获取的清单固定类别综合合价:工程造价、分部分项、措施项目、安全文明施工专项、规费、其他项目、税金
|
|
//需要获取的清单固定类别综合合价:工程造价、分部分项、措施项目、安全文明施工专项、规费、其他项目、税金
|
|
- let needFlags = [billsFlags.ENGINEERINGCOST, billsFlags.SUB_ENGINERRING, billsFlags.MEASURE,
|
|
|
|
- billsFlags.SAFETY_CONSTRUCTION, billsFlags.CHARGE, billsFlags.OTHER, billsFlags.TAX];
|
|
|
|
|
|
+ let needFlags = [fixedFlag.ENGINEERINGCOST, fixedFlag.SUB_ENGINERRING, fixedFlag.MEASURE,
|
|
|
|
+ fixedFlag.SAFETY_CONSTRUCTION, fixedFlag.CHARGE, fixedFlag.OTHER, fixedFlag.TAX];
|
|
//获取单位工程汇总金额需要用到的所有清单
|
|
//获取单位工程汇总金额需要用到的所有清单
|
|
let allBills = await billsModel.find({projectID: {$in: tenderIDs}, 'flags.flag': {$in: needFlags}, $or: notDeleted},
|
|
let allBills = await billsModel.find({projectID: {$in: tenderIDs}, 'flags.flag': {$in: needFlags}, $or: notDeleted},
|
|
'-_id projectID fees flags');
|
|
'-_id projectID fees flags');
|
|
@@ -1072,7 +1072,7 @@ async function getTendersFeeInfo(tenders) {
|
|
let costField = flagFieldMapping[billsFlag];
|
|
let costField = flagFieldMapping[billsFlag];
|
|
IDMapping[bills.projectID][costField] = getTotalFee(bills, 'common');
|
|
IDMapping[bills.projectID][costField] = getTotalFee(bills, 'common');
|
|
//暂估合价(工程造价暂估合价)
|
|
//暂估合价(工程造价暂估合价)
|
|
- if (billsFlag === billsFlags.ENGINEERINGCOST){
|
|
|
|
|
|
+ if (billsFlag === fixedFlag.ENGINEERINGCOST){
|
|
IDMapping[bills.projectID]['estimate'] = getTotalFee(bills, 'estimate');
|
|
IDMapping[bills.projectID]['estimate'] = getTotalFee(bills, 'estimate');
|
|
}
|
|
}
|
|
}
|
|
}
|
|
@@ -1088,28 +1088,28 @@ async function getTendersFeeInfo(tenders) {
|
|
}
|
|
}
|
|
|
|
|
|
const defaultSummaryField = {
|
|
const defaultSummaryField = {
|
|
- [billsFlags.ENGINEERINGCOST]: {
|
|
|
|
|
|
+ [fixedFlag.ENGINEERINGCOST]: {
|
|
items: [
|
|
items: [
|
|
{ name: 'engineeringCost', feeName: 'common' },
|
|
{ name: 'engineeringCost', feeName: 'common' },
|
|
{ name: 'estimate', feeName: 'estimate' }
|
|
{ name: 'estimate', feeName: 'estimate' }
|
|
]
|
|
]
|
|
},
|
|
},
|
|
- [billsFlags.SUB_ENGINERRING]: {
|
|
|
|
|
|
+ [fixedFlag.SUB_ENGINERRING]: {
|
|
items: [{ name: 'subEngineering', feeName: 'common' }]
|
|
items: [{ name: 'subEngineering', feeName: 'common' }]
|
|
},
|
|
},
|
|
- [billsFlags.MEASURE]: {
|
|
|
|
|
|
+ [fixedFlag.MEASURE]: {
|
|
items: [{ name: 'measure', feeName: 'common' }]
|
|
items: [{ name: 'measure', feeName: 'common' }]
|
|
},
|
|
},
|
|
- [billsFlags.SAFETY_CONSTRUCTION]: {
|
|
|
|
|
|
+ [fixedFlag.SAFETY_CONSTRUCTION]: {
|
|
items: [{ name: 'safetyConstruction', feeName: 'common' }]
|
|
items: [{ name: 'safetyConstruction', feeName: 'common' }]
|
|
},
|
|
},
|
|
- [billsFlags.OTHER]: {
|
|
|
|
|
|
+ [fixedFlag.OTHER]: {
|
|
items: [{ name: 'other', feeName: 'common' }]
|
|
items: [{ name: 'other', feeName: 'common' }]
|
|
},
|
|
},
|
|
- [billsFlags.CHARGE]: {
|
|
|
|
|
|
+ [fixedFlag.CHARGE]: {
|
|
items: [{ name: 'charge', feeName: 'common' }]
|
|
items: [{ name: 'charge', feeName: 'common' }]
|
|
},
|
|
},
|
|
- [billsFlags.TAX]: {
|
|
|
|
|
|
+ [fixedFlag.TAX]: {
|
|
items: [{ name: 'tax', feeName: 'common' }]
|
|
items: [{ name: 'tax', feeName: 'common' }]
|
|
}
|
|
}
|
|
};
|
|
};
|
|
@@ -1260,13 +1260,13 @@ async function getSummaryInfo(projectIDs, summaryField = defaultSummaryField){
|
|
}
|
|
}
|
|
if (!feeFields) {
|
|
if (!feeFields) {
|
|
feeFields = [
|
|
feeFields = [
|
|
- {k: billsFlags.ENGINEERINGCOST, v: 'engineeringCost'},
|
|
|
|
- {k: billsFlags.SUB_ENGINERRING, v: 'subEngineering'},
|
|
|
|
- {k: billsFlags.MEASURE, v: 'measure'},
|
|
|
|
- {k: billsFlags.SAFETY_CONSTRUCTION, v: 'safetyConstruction'},
|
|
|
|
- {k: billsFlags.OTHER, v: 'other'},
|
|
|
|
- {k: billsFlags.CHARGE, v: 'charge'},
|
|
|
|
- {k: billsFlags.TAX, v: 'tax'}
|
|
|
|
|
|
+ {k: fixedFlag.ENGINEERINGCOST, v: 'engineeringCost'},
|
|
|
|
+ {k: fixedFlag.SUB_ENGINERRING, v: 'subEngineering'},
|
|
|
|
+ {k: fixedFlag.MEASURE, v: 'measure'},
|
|
|
|
+ {k: fixedFlag.SAFETY_CONSTRUCTION, v: 'safetyConstruction'},
|
|
|
|
+ {k: fixedFlag.OTHER, v: 'other'},
|
|
|
|
+ {k: fixedFlag.CHARGE, v: 'charge'},
|
|
|
|
+ {k: fixedFlag.TAX, v: 'tax'}
|
|
];
|
|
];
|
|
}
|
|
}
|
|
// 项目总造价的各个费用,k为汇总的字段,v为工程造价的费用字段
|
|
// 项目总造价的各个费用,k为汇总的字段,v为工程造价的费用字段
|
|
@@ -1336,7 +1336,7 @@ async function getSummaryInfo(projectIDs, summaryField = defaultSummaryField){
|
|
let costField = flagFieldMapping[billsFlag];
|
|
let costField = flagFieldMapping[billsFlag];
|
|
IDMapping[bills.projectID][costField] = getTotalFee(bills, 'common');
|
|
IDMapping[bills.projectID][costField] = getTotalFee(bills, 'common');
|
|
// 工程造价各费用
|
|
// 工程造价各费用
|
|
- if (billsFlag === billsFlags.ENGINEERINGCOST){
|
|
|
|
|
|
+ if (billsFlag === fixedFlag.ENGINEERINGCOST){
|
|
engineeringCostFields.forEach(({k, v}) => {
|
|
engineeringCostFields.forEach(({k, v}) => {
|
|
IDMapping[bills.projectID][k] = getTotalFee(bills, v);
|
|
IDMapping[bills.projectID][k] = getTotalFee(bills, v);
|
|
});
|
|
});
|