|
@@ -382,12 +382,12 @@ let executeObj = {
|
|
|
};
|
|
|
return result;
|
|
|
};
|
|
|
- // 量价。没有具体的工料机类型,但仍然要用定额的计算程序,所以要给计算基数直接指定。
|
|
|
- function volumePriceFee() {
|
|
|
+ // 量价、工料机形式的定额, 要把自己的市场单价用于计算程序中的基数。
|
|
|
+ function marketPriceToBase() {
|
|
|
let result = 0;
|
|
|
if (
|
|
|
( me.treeNode.data.subType === gljType.LABOUR && base.dispName === '定额基价人工费') ||
|
|
|
- ( me.treeNode.data.subType === gljType.GENERAL_MATERIAL && base.dispName === '定额基价材料费') ||
|
|
|
+ ( baseMaterialTypes.includes(me.treeNode.data.subType) && base.dispName === '定额基价材料费') ||
|
|
|
( me.treeNode.data.subType === gljType.GENERAL_MACHINE && base.dispName === '定额基价机械费') ||
|
|
|
( me.treeNode.data.subType === gljType.MAIN_MATERIAL && base.dispName === '主材费') ||
|
|
|
( me.treeNode.data.subType === gljType.EQUIPMENT && base.dispName === '设备费')
|
|
@@ -397,7 +397,7 @@ let executeObj = {
|
|
|
};
|
|
|
|
|
|
if (me.treeNode.data.type == rationType.volumePrice || me.treeNode.data.type == rationType.gljRation){
|
|
|
- rst = volumePriceFee();
|
|
|
+ rst = marketPriceToBase();
|
|
|
}
|
|
|
else{
|
|
|
if (isSubset(base.gljTypes, [gljType.MACHINE_LABOUR]))
|
|
@@ -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));
|
|
|
}
|
|
|
};
|
|
|
|
|
@@ -819,22 +822,15 @@ class CalcProgram {
|
|
|
}
|
|
|
else{
|
|
|
if (!treeNode.data.gljList) return;
|
|
|
-
|
|
|
- let eTypes = [
|
|
|
- gljType.GENERAL_MATERIAL, gljType.MAIN_MATERIAL, gljType.EQUIPMENT,
|
|
|
- gljType.CONCRETE, gljType.MORTAR, gljType.MIX_RATIO,
|
|
|
- gljType.COMMERCIAL_CONCRETE, gljType.COMMERCIAL_MORTAR];
|
|
|
- let eDetailTypes = [gljType.MAIN_MATERIAL, gljType.CONCRETE, gljType.MORTAR, gljType.MIX_RATIO];
|
|
|
-
|
|
|
let GLJObjs = [];
|
|
|
for (let glj of treeNode.data.gljList) {
|
|
|
- if (eTypes.indexOf(glj.type) >= 0) {
|
|
|
+ if (allMaterialTypes.indexOf(glj.type) >= 0) {
|
|
|
if (glj.isEstimate){
|
|
|
GLJObjs.push({code: glj.code, name: glj.name, specs: glj.specs, unit: glj.unit, type: glj.type,
|
|
|
quantity: glj.quantity, marketPrice: glj.marketPrice});
|
|
|
}
|
|
|
else{ // 组成物
|
|
|
- if (eDetailTypes.indexOf(glj.type) >= 0){
|
|
|
+ if (compositionTypes.indexOf(glj.type) >= 0){
|
|
|
let mds = projectObj.project.composition.getCompositionByGLJ(glj);
|
|
|
if (!mds) mds = [];
|
|
|
for (let md of mds){
|
|
@@ -850,7 +846,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 +865,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 +902,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 +915,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 +1007,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 +1038,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){
|
|
@@ -1090,16 +1081,11 @@ class CalcProgram {
|
|
|
|
|
|
for (let idx of template.compiledSeq) {
|
|
|
let calcItem = template.calcItems[idx];
|
|
|
-
|
|
|
- let feeRate = calcItem.feeRate;
|
|
|
- if (!feeRate) feeRate = 100; // 100%
|
|
|
- feeRate = feeRate.toDecimal(decimalObj.feeRate);
|
|
|
+ let feeRate = parseFloatPlus(calcItem.feeRate) ? parseFloatPlus(calcItem.feeRate).toDecimal(decimalObj.feeRate) : 100; // 100%
|
|
|
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);
|