|
@@ -140,6 +140,9 @@ let calcTools = {
|
|
|
treeNode.data.gljList = projectObj.project.ration_glj.getGljArrByBill(treeNode, needOneBill);
|
|
|
};
|
|
|
},
|
|
|
+ getGLJListByProgramID: function (programID) {
|
|
|
+ return null;
|
|
|
+ },
|
|
|
getLeafBills: function (treeNode){
|
|
|
let leafBills = [];
|
|
|
|
|
@@ -1081,18 +1084,16 @@ let calcTools = {
|
|
|
else if (tender == tenderTypes.ttReverseRation)
|
|
|
return node.data.rationQuantityCoe;
|
|
|
},
|
|
|
- getUsedTemplateIDs: function(){
|
|
|
- let IDsArr = [];
|
|
|
- let rations = projectObj.project.Ration.datas;
|
|
|
+ getUsedTemplates: function(){
|
|
|
+ let arr = [];
|
|
|
+ let rations = projectObj.project.Ration.datas;
|
|
|
for (const r of rations) {
|
|
|
- let ID = r.programID;
|
|
|
- if (!IDsArr.includes(ID))
|
|
|
- IDsArr.push(ID);
|
|
|
+ let tpl = projectObj.project.calcProgram.compiledTemplates[r.programID];
|
|
|
+ if (!arr.includes(tpl))
|
|
|
+ arr.push(tpl);
|
|
|
};
|
|
|
- return IDsArr;
|
|
|
+ return arr;
|
|
|
}
|
|
|
-
|
|
|
-
|
|
|
};
|
|
|
|
|
|
let rationCalcBases = {
|
|
@@ -1509,14 +1510,14 @@ let analyzer = {
|
|
|
else return false;
|
|
|
},
|
|
|
templateIsUsed: function (ID, tree = projectObj.project.mainTree){
|
|
|
-
|
|
|
+
|
|
|
let nodes = tree.items;
|
|
|
for (let node of nodes){
|
|
|
if (node.data && node.data.programID && node.data.programID == ID) {
|
|
|
return true;
|
|
|
}
|
|
|
};
|
|
|
-
|
|
|
+
|
|
|
return false;
|
|
|
},
|
|
|
fieldNameIsUsed: function(template, fieldName){
|
|
@@ -2758,22 +2759,17 @@ class CalcProgram {
|
|
|
|
|
|
};
|
|
|
|
|
|
- gatherRationFees(programID){
|
|
|
+ gatherFee(template){
|
|
|
// $.bootstrapLoading.start();
|
|
|
// setTimeout(()=>{
|
|
|
// 先把符合的定额筛选出来,以提高速度。
|
|
|
- let rations = [];
|
|
|
+ let rations = [];
|
|
|
+ let rst = 0;
|
|
|
for (const r of projectObj.project.Ration.datas) {
|
|
|
- if (r.programID == programID) rations.push(r);
|
|
|
- };
|
|
|
+ if (r.programID == template.ID) rations.push(r);
|
|
|
+ };
|
|
|
|
|
|
- let gatherObj = {};
|
|
|
- gatherObj.programID = programID;
|
|
|
- gatherObj.name = projectObj.project.calcProgram.compiledTemplates[programID].name;
|
|
|
for (let ft of cpFeeTypes) {
|
|
|
- let ftObj = {};
|
|
|
- ftObj.name = ft.name;
|
|
|
-
|
|
|
let sum_uf = 0, sum_tuf = 0, sum_tf = 0, sum_ttf = 0;
|
|
|
for (const r of rations) {
|
|
|
let uf = 0, tuf = 0, tf = 0, ttf = 0;
|
|
@@ -2788,30 +2784,40 @@ class CalcProgram {
|
|
|
sum_tf = (sum_tf + tf).toDecimal(decimalObj.process);
|
|
|
sum_ttf = (sum_ttf + ttf).toDecimal(decimalObj.process);
|
|
|
};
|
|
|
-
|
|
|
- ftObj.totalFee = sum_tf.toDecimal(decimalObj.bills.totalPrice);
|
|
|
- ftObj.tenderTotalFee = sum_ttf.toDecimal(decimalObj.bills.totalPrice);
|
|
|
- ftObj.unitFee = sum_uf.toDecimal(decimalObj.bills.unitPrice);
|
|
|
- ftObj.tenderUnitFee = sum_tuf.toDecimal(decimalObj.bills.unitPrice);
|
|
|
-
|
|
|
- gatherObj[ft.type] = ftObj;
|
|
|
+ for (let i = 0; i < template.calcItems.length; i++) {
|
|
|
+ let ci = template.calcItems[i];
|
|
|
+ if (ci.fieldName == ft.type){
|
|
|
+ ci.totalFee = sum_tf.toDecimal(decimalObj.bills.totalPrice);
|
|
|
+ ci.tenderTotalFee = sum_ttf.toDecimal(decimalObj.bills.totalPrice);
|
|
|
+ ci.unitFee = sum_uf.toDecimal(decimalObj.bills.unitPrice);
|
|
|
+ ci.tenderUnitFee = sum_tuf.toDecimal(decimalObj.bills.unitPrice);
|
|
|
+ if (ft.type =='common') {
|
|
|
+ template.totalFee = ci.totalFee;
|
|
|
+ rst = ci.totalFee;
|
|
|
+ }
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ };
|
|
|
};
|
|
|
- return gatherObj;
|
|
|
+ return rst;
|
|
|
// });
|
|
|
- // $.bootstrapLoading.end();
|
|
|
+ // $.bootstrapLoading.end();
|
|
|
};
|
|
|
|
|
|
- //报表用:汇总所有。projectObj.project.calcProgram.gatherAllRationFees();
|
|
|
- gatherAllRationFees(){
|
|
|
- let IDsArr = calcTools.getUsedTemplateIDs();
|
|
|
- let rstObj = {};
|
|
|
- for (const ID of IDsArr) {
|
|
|
- let obj = this.gatherRationFees(ID);
|
|
|
- rstObj[ID] = obj;
|
|
|
+ //报表用取费类别汇总。调用:let obj = projectObj.project.calcProgram.getGatherFeeData();
|
|
|
+ getGatherFeeData(){
|
|
|
+ let rst = {};
|
|
|
+ let tpls = calcTools.getUsedTemplates();
|
|
|
+
|
|
|
+ let temp = 0;
|
|
|
+ for (const t of tpls) {
|
|
|
+ temp = temp + this.gatherFee(t);
|
|
|
}
|
|
|
- console.log(rstObj);
|
|
|
- return rstObj;
|
|
|
- }
|
|
|
+ rst.calcPrograms = tpls;
|
|
|
+ rst.totalFee = temp.toDecimal(decimalObj.bills.totalPrice);
|
|
|
+ console.log(rst);
|
|
|
+ return rst;
|
|
|
+ };
|
|
|
};
|
|
|
|
|
|
// export default analyzer;
|