|
@@ -412,7 +412,7 @@ let executeObj = {
|
|
|
HJ: function () {
|
|
|
let me = this;
|
|
|
let p = me.treeNode.data.calcBaseValue ? me.treeNode.data.calcBaseValue : 0;
|
|
|
- let q = me.treeNode.data.quantity ? me.treeNode.data.quantity : 1;
|
|
|
+ let q = treeNodeTools.uiQuantity(me.treeNode) ? treeNodeTools.uiQuantity(me.treeNode) : 1;
|
|
|
let u = (p / q).toDecimal(decimalObj.decimal('unitPrice', me.treeNode));
|
|
|
return u;
|
|
|
}
|
|
@@ -527,6 +527,9 @@ let treeNodeTools = {
|
|
|
else {
|
|
|
return treeNodeCalcType.ctRationCalcProgram;
|
|
|
};
|
|
|
+ },
|
|
|
+ uiQuantity(treeNode){
|
|
|
+ return parseFloatPlus(treeNode.data.quantity).toDecimal(decimalObj.decimal("quantity", treeNode));
|
|
|
}
|
|
|
};
|
|
|
|
|
@@ -850,7 +853,8 @@ class CalcProgram {
|
|
|
}
|
|
|
};
|
|
|
if (!isExist)
|
|
|
- GLJObjs.push({code: md.code, quantity: mdQ, marketPrice: md.marketPrice});
|
|
|
+ GLJObjs.push({code: md.code, name: md.name, specs: md.specs, unit: md.unit, type: md.type,
|
|
|
+ quantity: mdQ, marketPrice: md.marketPrice});
|
|
|
}
|
|
|
}
|
|
|
}
|
|
@@ -868,7 +872,7 @@ class CalcProgram {
|
|
|
};
|
|
|
sumU = sumU.toDecimal(decimalObj.bills.unitPrice);
|
|
|
if (projectObj.project.property.zanguCalcMode == zanguCalcType.common){
|
|
|
- sumT = (parseFloatPlus(treeNode.data.quantity) * sumU).toDecimal(decimalObj.bills.totalPrice);
|
|
|
+ sumT = (treeNodeTools.uiQuantity(treeNode) * sumU).toDecimal(decimalObj.bills.totalPrice);
|
|
|
}
|
|
|
else if (projectObj.project.property.zanguCalcMode == zanguCalcType.gatherMaterial){
|
|
|
sumT = sumT.toDecimal(decimalObj.bills.totalPrice);
|
|
@@ -905,13 +909,11 @@ class CalcProgram {
|
|
|
};
|
|
|
};
|
|
|
|
|
|
- // 父清单汇总子项(定额或子清单)的费用类别
|
|
|
- if (treeNode.calcType == treeNodeCalcType.ctGatherRationsFees ||
|
|
|
- treeNode.calcType == treeNodeCalcType.ctGatherBillsFees){
|
|
|
+ // 父清单汇总子项(子清单或定额)的费用类别
|
|
|
+ if (treeNode.calcType == treeNodeCalcType.ctGatherBillsFees || treeNode.calcType == treeNodeCalcType.ctGatherRationsFees){
|
|
|
treeNode.data.programID = null;
|
|
|
treeNodeTools.initFees(treeNode);
|
|
|
-
|
|
|
- let objsArr = (treeNode.calcType == treeNodeCalcType.ctGatherRationsFees) ? me.project.Ration.getRationsByNode(treeNode) : treeNode.children;
|
|
|
+ let nodes = (treeNode.calcType == treeNodeCalcType.ctGatherBillsFees) ? treeNode.children : me.project.Ration.getRationNodes(treeNode);
|
|
|
let rst = [];
|
|
|
for (let ft of cpFeeTypes) {
|
|
|
let ftObj = {};
|
|
@@ -920,45 +922,42 @@ class CalcProgram {
|
|
|
let buf = 0, btf = 0, btuf = 0, bttf = 0;
|
|
|
|
|
|
if (treeNode.calcType == treeNodeCalcType.ctGatherBillsFees){
|
|
|
- for (let item of objsArr) {
|
|
|
- let data = item.data;
|
|
|
- if (data.feesIndex && data.feesIndex[ft.type]) {
|
|
|
- buf = (buf + parseFloatPlus(data.feesIndex[ft.type].unitFee)).toDecimal(decimalObj.process);
|
|
|
- btf = (btf + parseFloatPlus(data.feesIndex[ft.type].totalFee)).toDecimal(decimalObj.process);
|
|
|
- btuf = (btuf + parseFloatPlus(data.feesIndex[ft.type].tenderUnitFee)).toDecimal(decimalObj.process);
|
|
|
- bttf = (bttf + parseFloatPlus(data.feesIndex[ft.type].tenderTotalFee)).toDecimal(decimalObj.process);
|
|
|
+ for (let node of nodes) {
|
|
|
+ if (node.data.feesIndex && node.data.feesIndex[ft.type]) {
|
|
|
+ buf = (buf + parseFloatPlus(node.data.feesIndex[ft.type].unitFee)).toDecimal(decimalObj.process);
|
|
|
+ btf = (btf + parseFloatPlus(node.data.feesIndex[ft.type].totalFee)).toDecimal(decimalObj.process);
|
|
|
+ btuf = (btuf + parseFloatPlus(node.data.feesIndex[ft.type].tenderUnitFee)).toDecimal(decimalObj.process);
|
|
|
+ bttf = (bttf + parseFloatPlus(node.data.feesIndex[ft.type].tenderTotalFee)).toDecimal(decimalObj.process);
|
|
|
};
|
|
|
};
|
|
|
}
|
|
|
else if (treeNode.calcType == treeNodeCalcType.ctGatherRationsFees){ // 这里的算法要配合冷姐姐的神图才能看懂^_^
|
|
|
let sum_rtf = 0, sum_rttf = 0;
|
|
|
- let bq = parseFloat(treeNode.data.quantity ? treeNode.data.quantity : 1);
|
|
|
-
|
|
|
- for (let data of objsArr) {
|
|
|
- let rq = parseFloat(data.quantity ? data.quantity : 0);
|
|
|
-
|
|
|
+ let bq = treeNodeTools.uiQuantity(treeNode) ? treeNodeTools.uiQuantity(treeNode) : 1;
|
|
|
+ for (let node of nodes) {
|
|
|
+ let rq = treeNodeTools.uiQuantity(node) ? treeNodeTools.uiQuantity(node) : 0;
|
|
|
let ruf = 0, rtuf = 0, rtf = 0, rttf = 0;
|
|
|
- if (data.feesIndex && data.feesIndex[ft.type]) {
|
|
|
- ruf = parseFloat(data.feesIndex[ft.type].unitFee);
|
|
|
- rtuf = parseFloat(data.feesIndex[ft.type].tenderUnitFee);
|
|
|
- rtf = parseFloat(data.feesIndex[ft.type].totalFee);
|
|
|
- rttf = parseFloat(data.feesIndex[ft.type].tenderTotalFee);
|
|
|
+ if (node.data.feesIndex && node.data.feesIndex[ft.type]) {
|
|
|
+ ruf = parseFloat(node.data.feesIndex[ft.type].unitFee);
|
|
|
+ rtuf = parseFloat(node.data.feesIndex[ft.type].tenderUnitFee);
|
|
|
+ rtf = parseFloat(node.data.feesIndex[ft.type].totalFee);
|
|
|
+ rttf = parseFloat(node.data.feesIndex[ft.type].tenderTotalFee);
|
|
|
};
|
|
|
-
|
|
|
if (me.project.property.billsCalcMode === leafBillGetFeeType.rationContent) {
|
|
|
buf = (buf + (ruf * rq / bq).toDecimal(decimalObj.process)).toDecimal(decimalObj.process);
|
|
|
btuf = (btuf + (rtuf * rq / bq).toDecimal(decimalObj.process)).toDecimal(decimalObj.process);
|
|
|
};
|
|
|
-
|
|
|
sum_rtf = (sum_rtf + rtf).toDecimal(decimalObj.process);
|
|
|
sum_rttf = (sum_rttf + rttf).toDecimal(decimalObj.process);
|
|
|
};
|
|
|
|
|
|
- if (me.project.property.billsCalcMode === leafBillGetFeeType.rationPriceConverse || me.project.property.billsCalcMode === leafBillGetFeeType.rationPrice) {
|
|
|
+ if (me.project.property.billsCalcMode == leafBillGetFeeType.rationPriceConverse ||
|
|
|
+ me.project.property.billsCalcMode == leafBillGetFeeType.rationPrice) {
|
|
|
buf = (sum_rtf / bq).toDecimal(decimalObj.process);
|
|
|
btuf = (sum_rttf / bq).toDecimal(decimalObj.process);
|
|
|
};
|
|
|
- if (isBaseFeeType(ft.type) || (me.project.property.billsCalcMode === leafBillGetFeeType.rationPrice && ft.type == "common")){
|
|
|
+ if (isBaseFeeType(ft.type) ||
|
|
|
+ (me.project.property.billsCalcMode === leafBillGetFeeType.rationPrice && ft.type == "common")){
|
|
|
btf = sum_rtf;
|
|
|
bttf = sum_rttf;
|
|
|
}
|
|
@@ -1015,8 +1014,7 @@ class CalcProgram {
|
|
|
}
|
|
|
|
|
|
let f = treeNode.data.feeRate ? treeNode.data.feeRate : 100;
|
|
|
- if (!treeNode.data.quantity) treeNode.data.quantity = 1;
|
|
|
- let q = treeNode.data.quantity;
|
|
|
+ let q = treeNodeTools.uiQuantity(treeNode) ? treeNodeTools.uiQuantity(treeNode) : 1;
|
|
|
let b = treeNode.data.calcBaseValue ? treeNode.data.calcBaseValue : 0;
|
|
|
let uf = (b * f * q / 100).toDecimal(decimalObj.bills.unitPrice);
|
|
|
let tuf = uf;
|
|
@@ -1047,7 +1045,7 @@ class CalcProgram {
|
|
|
if (treeNode.data.type == rationType.volumePrice){
|
|
|
delete treeNode.data.gljList;
|
|
|
let muf = treeNode.data.marketUnitFee ? treeNode.data.marketUnitFee : 0;
|
|
|
- let q = treeNode.data.quantity ? treeNode.data.quantity : 0;
|
|
|
+ let q = treeNodeTools.uiQuantity(treeNode) ? treeNodeTools.uiQuantity(treeNode) : 0;
|
|
|
treeNode.data.marketTotalFee = (muf * q).toDecimal(decimalObj.ration.totalPrice);
|
|
|
}
|
|
|
else if (treeNode.data.type == rationType.gljRation){
|
|
@@ -1093,13 +1091,11 @@ class CalcProgram {
|
|
|
|
|
|
let feeRate = calcItem.feeRate;
|
|
|
if (!feeRate) feeRate = 100; // 100%
|
|
|
- feeRate = feeRate.toDecimal(decimalObj.feeRate);
|
|
|
+ feeRate = parseFloatPlus(feeRate).toDecimal(decimalObj.feeRate);
|
|
|
calcItem.unitFee = (eval(calcItem.compiledExpr) * feeRate * 0.01).toDecimal(decimalObj.decimal('unitPrice', treeNode)); // 如果eval()对清单树有影响,就换成小麦的Expression对象再试
|
|
|
|
|
|
- let quantity = treeNode.data.quantity;
|
|
|
- if (!quantity) quantity = 0
|
|
|
- else quantity = parseFloat(quantity).toDecimal(decimalObj.decimal('quantity', treeNode));
|
|
|
- calcItem.totalFee = (calcItem.unitFee * quantity).toDecimal(decimalObj.decimal('totalPrice', treeNode));
|
|
|
+ let q = treeNodeTools.uiQuantity(treeNode) ? treeNodeTools.uiQuantity(treeNode) : 0;
|
|
|
+ calcItem.totalFee = (calcItem.unitFee * q).toDecimal(decimalObj.decimal('totalPrice', treeNode));
|
|
|
|
|
|
if (calcItem.fieldName) {
|
|
|
fnArr.push(calcItem.fieldName);
|