|
@@ -1658,80 +1658,12 @@ class CalcProgram {
|
|
|
let nTQ = calcTools.uiNodeTenderQty(treeNode);
|
|
let nTQ = calcTools.uiNodeTenderQty(treeNode);
|
|
|
treeNode.calcType = calcTools.getCalcType(treeNode);
|
|
treeNode.calcType = calcTools.getCalcType(treeNode);
|
|
|
|
|
|
|
|
- // 父清单汇总子清单的费用类别、叶子清单汇总定额的费用类别
|
|
|
|
|
- if (treeNode.calcType == treeNodeCalcType.ctGatherBillsFees || treeNode.calcType == treeNodeCalcType.ctGatherRationsFees){
|
|
|
|
|
- treeNode.data.programID = null;
|
|
|
|
|
- calcTools.initFees(treeNode);
|
|
|
|
|
-
|
|
|
|
|
- let nodes = [];
|
|
|
|
|
- if (treeNode.calcType == treeNodeCalcType.ctGatherRationsFees){
|
|
|
|
|
- calcTools.getGLJList(treeNode, true);
|
|
|
|
|
- nodes = me.project.Ration.getRationNodes(treeNode);
|
|
|
|
|
- }
|
|
|
|
|
- else nodes = treeNode.children;
|
|
|
|
|
-
|
|
|
|
|
- let rst = [];
|
|
|
|
|
- for (let ft of cpFeeTypes) {
|
|
|
|
|
- let ftObj = {};
|
|
|
|
|
- ftObj.fieldName = ft.type;
|
|
|
|
|
- ftObj.name = ft.name;
|
|
|
|
|
- let buf = 0, btf = 0, btuf = 0, bttf = 0;
|
|
|
|
|
- let bq = nQ ? nQ : 1;
|
|
|
|
|
- let btq = nTQ ? nTQ : 1;
|
|
|
|
|
-
|
|
|
|
|
- if (treeNode.calcType == treeNodeCalcType.ctGatherBillsFees){
|
|
|
|
|
- for (let node of nodes) {
|
|
|
|
|
- if (node.data.feesIndex && node.data.feesIndex[ft.type]) {
|
|
|
|
|
- btf = (btf + parseFloatPlus(node.data.feesIndex[ft.type].totalFee)).toDecimal(decimalObj.process);
|
|
|
|
|
- bttf = (bttf + parseFloatPlus(node.data.feesIndex[ft.type].tenderTotalFee)).toDecimal(decimalObj.process);
|
|
|
|
|
-
|
|
|
|
|
- if (calcTools.isBudgetProject()){
|
|
|
|
|
- buf = (btf / bq).toDecimal(decimalObj.process);
|
|
|
|
|
- btuf = (bttf / bq).toDecimal(decimalObj.process);
|
|
|
|
|
- }
|
|
|
|
|
- };
|
|
|
|
|
- };
|
|
|
|
|
- }
|
|
|
|
|
- else if (treeNode.calcType == treeNodeCalcType.ctGatherRationsFees){
|
|
|
|
|
- let sum_rtf = 0, sum_rttf = 0;
|
|
|
|
|
- for (let node of nodes) {
|
|
|
|
|
- let ruf = 0, rtuf = 0, rtf = 0, rttf = 0;
|
|
|
|
|
- if (node.data.feesIndex && node.data.feesIndex[ft.type]) {
|
|
|
|
|
- ruf = parseFloatPlus(node.data.feesIndex[ft.type].unitFee).toDecimal(decimalObj.bills.unitPrice);
|
|
|
|
|
- rtuf = parseFloatPlus(node.data.feesIndex[ft.type].tenderUnitFee).toDecimal(decimalObj.bills.unitPrice);
|
|
|
|
|
- rtf = parseFloatPlus(node.data.feesIndex[ft.type].totalFee).toDecimal(decimalObj.bills.totalPrice);
|
|
|
|
|
- rttf = parseFloatPlus(node.data.feesIndex[ft.type].tenderTotalFee).toDecimal(decimalObj.bills.totalPrice);
|
|
|
|
|
- };
|
|
|
|
|
-
|
|
|
|
|
- sum_rtf = (sum_rtf + rtf).toDecimal(decimalObj.process);
|
|
|
|
|
- sum_rttf = (sum_rttf + rttf).toDecimal(decimalObj.process);
|
|
|
|
|
- };
|
|
|
|
|
-
|
|
|
|
|
- buf = (sum_rtf / bq).toDecimal(decimalObj.process);
|
|
|
|
|
- btuf = (sum_rttf / btq).toDecimal(decimalObj.process);
|
|
|
|
|
- btf = sum_rtf;
|
|
|
|
|
- bttf = sum_rttf;
|
|
|
|
|
-
|
|
|
|
|
- if (calcTools.isBillProject() && (ft.type == 'common' || ft.type == 'rationCommon')) { // 招投标项目, 还要反算
|
|
|
|
|
- buf = buf.toDecimal(decimalObj.bills.unitPrice);
|
|
|
|
|
- btuf = btuf.toDecimal(decimalObj.bills.unitPrice);
|
|
|
|
|
- btf = (buf * nQ).toDecimal(decimalObj.bills.totalPrice);
|
|
|
|
|
- bttf = (btuf * nQ).toDecimal(decimalObj.bills.totalPrice);
|
|
|
|
|
- };
|
|
|
|
|
- };
|
|
|
|
|
-
|
|
|
|
|
- ftObj.unitFee = buf.toDecimal(decimalObj.bills.unitPrice);
|
|
|
|
|
- ftObj.tenderUnitFee = btuf.toDecimal(decimalObj.bills.unitPrice);
|
|
|
|
|
- ftObj.totalFee = btf.toDecimal(decimalObj.bills.totalPrice);
|
|
|
|
|
- ftObj.tenderTotalFee = bttf.toDecimal(decimalObj.bills.totalPrice);
|
|
|
|
|
-
|
|
|
|
|
-
|
|
|
|
|
- calcTools.checkFeeField(treeNode, ftObj);
|
|
|
|
|
-
|
|
|
|
|
- rst.push(ftObj);
|
|
|
|
|
- };
|
|
|
|
|
- treeNode.data.calcTemplate = {"calcItems": rst};
|
|
|
|
|
- }
|
|
|
|
|
|
|
+ // 父清单汇总子清单的费用类别
|
|
|
|
|
+ if (treeNode.calcType == treeNodeCalcType.ctGatherBillsFees)
|
|
|
|
|
+ me.innerCalcBill(treeNode, 2)
|
|
|
|
|
+ // 叶子清单汇总定额的费用类别
|
|
|
|
|
+ else if (treeNode.calcType == treeNodeCalcType.ctGatherRationsFees)
|
|
|
|
|
+ me.innerCalcBill(treeNode, 1)
|
|
|
// 叶子清单:公式计算
|
|
// 叶子清单:公式计算
|
|
|
else if (treeNode.calcType == treeNodeCalcType.ctCalcBaseValue){
|
|
else if (treeNode.calcType == treeNodeCalcType.ctCalcBaseValue){
|
|
|
delete treeNode.data.gljList;
|
|
delete treeNode.data.gljList;
|
|
@@ -1803,9 +1735,8 @@ class CalcProgram {
|
|
|
treeNode.data.calcTemplate = {"calcItems": []};
|
|
treeNode.data.calcTemplate = {"calcItems": []};
|
|
|
}
|
|
}
|
|
|
// 定额:计算程序
|
|
// 定额:计算程序
|
|
|
- else{
|
|
|
|
|
|
|
+ else
|
|
|
me.innerCalcRation(treeNode, tender);
|
|
me.innerCalcRation(treeNode, tender);
|
|
|
- };
|
|
|
|
|
|
|
|
|
|
// if (!calcTools.isTotalCostBill(treeNode)) // 已在上面的分支中计算过
|
|
// if (!calcTools.isTotalCostBill(treeNode)) // 已在上面的分支中计算过
|
|
|
// calcTools.estimateFee(treeNode);
|
|
// calcTools.estimateFee(treeNode);
|
|
@@ -1871,6 +1802,86 @@ class CalcProgram {
|
|
|
};
|
|
};
|
|
|
};
|
|
};
|
|
|
|
|
|
|
|
|
|
+ // 清单部分抽取出来,供分摊清单公用。commonCalcType:1 叶子清单汇总定额的费用类别; 2 父清单汇总子清单的费用类别。3: 分摊:叶子清单汇总定额的费用类别。
|
|
|
|
|
+ innerCalcBill(treeNode, commonCalcType, tender = tenderTypes.ttCalc){
|
|
|
|
|
+ treeNode.data.programID = null;
|
|
|
|
|
+ calcTools.initFees(treeNode);
|
|
|
|
|
+ let nodes = [];
|
|
|
|
|
+
|
|
|
|
|
+ if (commonCalcType == 1){
|
|
|
|
|
+ calcTools.getGLJList(treeNode, true);
|
|
|
|
|
+ nodes = me.project.Ration.getRationNodes(treeNode);
|
|
|
|
|
+ }
|
|
|
|
|
+ else if (commonCalcType == 2)
|
|
|
|
|
+ nodes = treeNode.children
|
|
|
|
|
+ else if (commonCalcType == 3)
|
|
|
|
|
+ nodes = treeNode.children;
|
|
|
|
|
+
|
|
|
|
|
+ let rst = [];
|
|
|
|
|
+ for (let ft of cpFeeTypes) {
|
|
|
|
|
+ let ftObj = {};
|
|
|
|
|
+ ftObj.fieldName = ft.type;
|
|
|
|
|
+ ftObj.name = ft.name;
|
|
|
|
|
+ let buf = 0, btf = 0, btuf = 0, bttf = 0;
|
|
|
|
|
+
|
|
|
|
|
+ let nQ = calcTools.uiNodeQty(treeNode);
|
|
|
|
|
+ let nTQ = calcTools.uiNodeTenderQty(treeNode);
|
|
|
|
|
+ let bq = nQ ? nQ : 1;
|
|
|
|
|
+ let btq = nTQ ? nTQ : 1;
|
|
|
|
|
+
|
|
|
|
|
+ if (commonCalcType == 2){
|
|
|
|
|
+ for (let node of nodes) {
|
|
|
|
|
+ if (node.data.feesIndex && node.data.feesIndex[ft.type]) {
|
|
|
|
|
+ btf = (btf + parseFloatPlus(node.data.feesIndex[ft.type].totalFee)).toDecimal(decimalObj.process);
|
|
|
|
|
+ bttf = (bttf + parseFloatPlus(node.data.feesIndex[ft.type].tenderTotalFee)).toDecimal(decimalObj.process);
|
|
|
|
|
+
|
|
|
|
|
+ if (calcTools.isBudgetProject()){
|
|
|
|
|
+ buf = (btf / bq).toDecimal(decimalObj.process);
|
|
|
|
|
+ btuf = (bttf / bq).toDecimal(decimalObj.process);
|
|
|
|
|
+ }
|
|
|
|
|
+ };
|
|
|
|
|
+ };
|
|
|
|
|
+ }
|
|
|
|
|
+ else if ((commonCalcType == 1) || (commonCalcType == 3)){
|
|
|
|
|
+ let sum_rtf = 0, sum_rttf = 0;
|
|
|
|
|
+ for (let node of nodes) {
|
|
|
|
|
+ let ruf = 0, rtuf = 0, rtf = 0, rttf = 0;
|
|
|
|
|
+ if (node.data.feesIndex && node.data.feesIndex[ft.type]) {
|
|
|
|
|
+ ruf = parseFloatPlus(node.data.feesIndex[ft.type].unitFee).toDecimal(decimalObj.bills.unitPrice);
|
|
|
|
|
+ rtuf = parseFloatPlus(node.data.feesIndex[ft.type].tenderUnitFee).toDecimal(decimalObj.bills.unitPrice);
|
|
|
|
|
+ rtf = parseFloatPlus(node.data.feesIndex[ft.type].totalFee).toDecimal(decimalObj.bills.totalPrice);
|
|
|
|
|
+ rttf = parseFloatPlus(node.data.feesIndex[ft.type].tenderTotalFee).toDecimal(decimalObj.bills.totalPrice);
|
|
|
|
|
+ };
|
|
|
|
|
+
|
|
|
|
|
+ sum_rtf = (sum_rtf + rtf).toDecimal(decimalObj.process);
|
|
|
|
|
+ sum_rttf = (sum_rttf + rttf).toDecimal(decimalObj.process);
|
|
|
|
|
+ };
|
|
|
|
|
+
|
|
|
|
|
+ buf = (sum_rtf / bq).toDecimal(decimalObj.process);
|
|
|
|
|
+ btuf = (sum_rttf / btq).toDecimal(decimalObj.process);
|
|
|
|
|
+ btf = sum_rtf;
|
|
|
|
|
+ bttf = sum_rttf;
|
|
|
|
|
+
|
|
|
|
|
+ if (calcTools.isBillProject() && (ft.type == 'common' || ft.type == 'rationCommon')) { // 招投标项目, 还要反算
|
|
|
|
|
+ buf = buf.toDecimal(decimalObj.bills.unitPrice);
|
|
|
|
|
+ btuf = btuf.toDecimal(decimalObj.bills.unitPrice);
|
|
|
|
|
+ btf = (buf * nQ).toDecimal(decimalObj.bills.totalPrice);
|
|
|
|
|
+ bttf = (btuf * nQ).toDecimal(decimalObj.bills.totalPrice);
|
|
|
|
|
+ };
|
|
|
|
|
+ };
|
|
|
|
|
+
|
|
|
|
|
+ ftObj.unitFee = buf.toDecimal(decimalObj.bills.unitPrice);
|
|
|
|
|
+ ftObj.tenderUnitFee = btuf.toDecimal(decimalObj.bills.unitPrice);
|
|
|
|
|
+ ftObj.totalFee = btf.toDecimal(decimalObj.bills.totalPrice);
|
|
|
|
|
+ ftObj.tenderTotalFee = bttf.toDecimal(decimalObj.bills.totalPrice);
|
|
|
|
|
+
|
|
|
|
|
+ calcTools.checkFeeField(treeNode, ftObj);
|
|
|
|
|
+
|
|
|
|
|
+ rst.push(ftObj);
|
|
|
|
|
+ };
|
|
|
|
|
+ treeNode.data.calcTemplate = {"calcItems": rst};
|
|
|
|
|
+ };
|
|
|
|
|
+
|
|
|
// 存储、刷新零散的多个结点。
|
|
// 存储、刷新零散的多个结点。
|
|
|
saveNodes(treeNodes, callback){
|
|
saveNodes(treeNodes, callback){
|
|
|
if (treeNodes.length < 1) {
|
|
if (treeNodes.length < 1) {
|