|
@@ -119,61 +119,37 @@ class CalcProgram {
|
|
|
};
|
|
|
};
|
|
|
|
|
|
- gatherRationFeeTypes(treeNode){
|
|
|
+ gatherFeeTypes(treeNode, gatherType){
|
|
|
let me = this;
|
|
|
let rst = [];
|
|
|
+
|
|
|
if (treeNode.sourceType === this.project.Bills.getSourceType()) {
|
|
|
me.initFees(treeNode);
|
|
|
|
|
|
- let rations = this.project.Ration.getRationsByNode(treeNode);
|
|
|
- for (let ft of feeType) {
|
|
|
- let ftObj = {};
|
|
|
- ftObj.type = ft.type;
|
|
|
- ftObj.name = ft.name;
|
|
|
- let uf = 0, tf = 0, tuf = 0, ttf = 0;
|
|
|
- for (let ration of rations) {
|
|
|
- if (ration.feesIndex && ration.feesIndex[ft.type]) {
|
|
|
- uf = (uf + parseFloat(ration.feesIndex[ft.type].unitFee)).toDecimal(me.digitDefault);
|
|
|
- tf = (tf + parseFloat(ration.feesIndex[ft.type].totalFee)).toDecimal(me.digitDefault);
|
|
|
- tuf = (tuf + parseFloat(ration.feesIndex[ft.type].tenderUnitFee)).toDecimal(me.digitDefault);
|
|
|
- ttf = (ttf + parseFloat(ration.feesIndex[ft.type].tenderTotalFee)).toDecimal(me.digitDefault);
|
|
|
- };
|
|
|
- };
|
|
|
- ftObj.unitFee = uf.toDecimal(me.digit);
|
|
|
- ftObj.totalFee = tf.toDecimal(me.digit);
|
|
|
- ftObj.tenderUnitFee = tuf.toDecimal(me.digit);
|
|
|
- ftObj.tenderTotalFee = ttf.toDecimal(me.digit);
|
|
|
-
|
|
|
- me.checkFee(treeNode, ftObj);
|
|
|
-
|
|
|
- rst.push(ftObj);
|
|
|
+ let objsArr = [];
|
|
|
+ if (gatherType == CP_GatherType.rations){
|
|
|
+ objsArr = this.project.Ration.getRationsByNode(treeNode);
|
|
|
+ }else if (gatherType == CP_GatherType.bills){
|
|
|
+ objsArr = treeNode.children;
|
|
|
};
|
|
|
|
|
|
- if (treeNode.changed) {
|
|
|
- me.saveAndCalcParents(treeNode);
|
|
|
- delete treeNode.changed;
|
|
|
- };
|
|
|
- };
|
|
|
- return rst;
|
|
|
- };
|
|
|
-
|
|
|
- gatherBillFeeTypes(treeNode){
|
|
|
- let me = this;
|
|
|
- let rst = [];
|
|
|
- if (treeNode.sourceType === this.project.Bills.getSourceType()) {
|
|
|
- me.initFees(treeNode);
|
|
|
-
|
|
|
for (let ft of feeType) {
|
|
|
let ftObj = {};
|
|
|
ftObj.type = ft.type;
|
|
|
ftObj.name = ft.name;
|
|
|
let uf = 0, tf = 0, tuf = 0, ttf = 0;
|
|
|
- for (let node of treeNode.children) {
|
|
|
- if (node.data.feesIndex && node.data.feesIndex[ft.type]) {
|
|
|
- uf = (uf + parseFloat(node.data.feesIndex[ft.type].unitFee)).toDecimal(me.digitDefault);
|
|
|
- tf = (tf + parseFloat(node.data.feesIndex[ft.type].totalFee)).toDecimal(me.digitDefault);
|
|
|
- tuf = (tuf + parseFloat(node.data.feesIndex[ft.type].tenderUnitFee)).toDecimal(me.digitDefault);
|
|
|
- ttf = (ttf + parseFloat(node.data.feesIndex[ft.type].tenderTotalFee)).toDecimal(me.digitDefault);
|
|
|
+ for (let item of objsArr) {
|
|
|
+ let data = {};
|
|
|
+ if (gatherType == CP_GatherType.rations){
|
|
|
+ data = item;
|
|
|
+ }else if (gatherType == CP_GatherType.bills){
|
|
|
+ data = item.data;
|
|
|
+ };
|
|
|
+ if (data.feesIndex && data.feesIndex[ft.type]) {
|
|
|
+ uf = (uf + parseFloat(data.feesIndex[ft.type].unitFee)).toDecimal(me.digitDefault);
|
|
|
+ tf = (tf + parseFloat(data.feesIndex[ft.type].totalFee)).toDecimal(me.digitDefault);
|
|
|
+ tuf = (tuf + parseFloat(data.feesIndex[ft.type].tenderUnitFee)).toDecimal(me.digitDefault);
|
|
|
+ ttf = (ttf + parseFloat(data.feesIndex[ft.type].tenderTotalFee)).toDecimal(me.digitDefault);
|
|
|
};
|
|
|
};
|
|
|
ftObj.unitFee = uf.toDecimal(me.digit);
|
|
@@ -182,6 +158,7 @@ class CalcProgram {
|
|
|
ftObj.tenderTotalFee = ttf.toDecimal(me.digit);
|
|
|
|
|
|
me.checkFee(treeNode, ftObj);
|
|
|
+
|
|
|
rst.push(ftObj);
|
|
|
};
|
|
|
|
|
@@ -190,6 +167,7 @@ class CalcProgram {
|
|
|
delete treeNode.changed;
|
|
|
};
|
|
|
};
|
|
|
+
|
|
|
return rst;
|
|
|
- }
|
|
|
+ };
|
|
|
}
|