|
@@ -203,26 +203,40 @@ let calcTools = {
|
|
|
rationBaseFee: function (treeNode, gljTypes, priceType){
|
|
|
if (!treeNode.data.gljList) return 0;
|
|
|
let me = this, result = 0;
|
|
|
+ let price = 0, temp = 0, temp2 = 0;
|
|
|
for (let glj of treeNode.data.gljList) {
|
|
|
- let price = 0, temp = 0;
|
|
|
if (gljTypes.indexOf(glj.type) >= 0) {
|
|
|
- if (priceType == priceTypes.ptDiffPrice){
|
|
|
+/* if (priceType == priceTypes.ptDiffPrice){
|
|
|
let aprice = me.uiGLJPrice(glj["adjustPrice"]);
|
|
|
let mprice = me.uiGLJPrice(glj["marketPrice"]);
|
|
|
temp = (me.uiGLJQty(glj["quantity"]) * mprice).toDecimal(decimalObj.process) - (me.uiGLJQty(glj["quantity"]) * aprice).toDecimal(decimalObj.process);
|
|
|
temp = temp.toDecimal(decimalObj.process);
|
|
|
+ }*/
|
|
|
+ if (priceType == priceTypes.ptDiffPrice){
|
|
|
+ let aprice = me.uiGLJPrice(glj["adjustPrice"]);
|
|
|
+ let mprice = me.uiGLJPrice(glj["marketPrice"]);
|
|
|
+ if (aprice != mprice){
|
|
|
+ temp = (temp + (me.uiGLJQty(glj["quantity"]) * mprice).toDecimal(decimalObj.process)).toDecimal(decimalObj.process);
|
|
|
+ temp2 = (temp2 + (me.uiGLJQty(glj["quantity"]) * aprice).toDecimal(decimalObj.process)).toDecimal(decimalObj.process);
|
|
|
+ }
|
|
|
}
|
|
|
else {
|
|
|
if (priceType == priceTypes.ptBasePrice){ price = me.uiGLJPrice(glj["basePrice"]);}
|
|
|
else if (priceType == priceTypes.ptAdjustPrice){price = me.uiGLJPrice(glj["adjustPrice"]);}
|
|
|
else if (priceType == priceTypes.ptMarketPrice){price = me.uiGLJPrice(glj["marketPrice"]);}
|
|
|
temp = (me.uiGLJQty(glj["quantity"]) * price).toDecimal(decimalObj.process);
|
|
|
+ result = (result + temp).toDecimal(decimalObj.process);
|
|
|
};
|
|
|
- result = (result + temp).toDecimal(decimalObj.process);
|
|
|
};
|
|
|
};
|
|
|
|
|
|
- result = result.toDecimal(decimalObj.ration.unitPrice);
|
|
|
+ if (priceType == priceTypes.ptDiffPrice){
|
|
|
+ result = (temp.toDecimal(decimalObj.ration.unitPrice) - temp2.toDecimal(decimalObj.ration.unitPrice)).toDecimal(decimalObj.ration.unitPrice);
|
|
|
+ }
|
|
|
+ else{
|
|
|
+ result = result.toDecimal(decimalObj.ration.unitPrice);
|
|
|
+ };
|
|
|
+
|
|
|
return result;
|
|
|
},
|
|
|
machineLabourFee: function (gljArr) {
|
|
@@ -388,47 +402,72 @@ let calcTools = {
|
|
|
|
|
|
let supplyT = [];
|
|
|
if (baseName.includes('甲供'))
|
|
|
- supplyT = [supplyType.BFJG, supplyType.WQJG]
|
|
|
+ supplyT = [supplyType.BFJG, supplyType.WQJG] // 字段中存储的是汉字!
|
|
|
+ // supplyT = ['部分甲供', '完全甲供']
|
|
|
else if (baseName.includes('甲定'))
|
|
|
supplyT = [supplyType.JDYG];
|
|
|
+ // supplyT = ['甲定乙供'];
|
|
|
|
|
|
- let gljT = [], compositionArr = [];
|
|
|
+ let gljT = [], compositionTypesArr = [];
|
|
|
if (baseName == calcBaseNames.JGDEJJRGF || baseName == calcBaseNames.JDDEJJRGF){
|
|
|
gljT = [gljType.LABOUR];
|
|
|
}
|
|
|
else if (baseName == calcBaseNames.JGDEJJCLF || baseName == calcBaseNames.JDDEJJCLF){
|
|
|
gljT = baseMaterialTypes;
|
|
|
- compositionArr = compositionTypes;
|
|
|
+ compositionTypesArr = compositionTypes;
|
|
|
}
|
|
|
else if (baseName == calcBaseNames.JGDEJJJXF || baseName == calcBaseNames.JDDEJJJXF){
|
|
|
gljT = baseMachineTypes;
|
|
|
- compositionArr = [gljType.GENERAL_MACHINE];
|
|
|
+ compositionTypesArr = [gljType.GENERAL_MACHINE];
|
|
|
}
|
|
|
else if (baseName == calcBaseNames.JGZCF || baseName == calcBaseNames.JDZCF){
|
|
|
gljT = [gljType.MAIN_MATERIAL];
|
|
|
- compositionArr = [gljType.MAIN_MATERIAL];
|
|
|
+ compositionTypesArr = [gljType.MAIN_MATERIAL];
|
|
|
}
|
|
|
else if (baseName == calcBaseNames.JGSBF || baseName == calcBaseNames.JDSBF){
|
|
|
gljT = [gljType.EQUIPMENT];
|
|
|
};
|
|
|
|
|
|
- let pGLJs = projectGLJ.getGLJsBySupply(supplyT, gljT);
|
|
|
- if (pGLJs.length == 0) return 0;
|
|
|
+ let supplyProjectGLJs = projectGLJ.getGLJsBySupply(supplyT, gljT);
|
|
|
+ if (supplyProjectGLJs.length == 0) return 0;
|
|
|
|
|
|
let pGLJIdx = {};
|
|
|
- for (let pglj of pGLJs){pGLJIdx[pglj.GLJID] = pglj};
|
|
|
+ for (let pglj of supplyProjectGLJs){pGLJIdx[pglj.id] = pglj};
|
|
|
|
|
|
let sum = 0;
|
|
|
for (let glj of treeNode.data.gljList){
|
|
|
- // 组成物
|
|
|
- if (compositionArr.includes(glj.type)) {
|
|
|
+ // 组成物的母体。母体如果有组成物,则母体无法作为甲供材料,无法设置,此时要看其组成物是否是甲供材料;母体如果没有组成物,则母体有可能成为甲供材料。
|
|
|
+ if (compositionTypesArr.includes(glj.type)) {
|
|
|
+ if (pGLJIdx[glj.projectGLJID]) { // 组成物的母体是甲供材料
|
|
|
+ sum = (sum + glj.basePrice * glj.quantity).toDecimal(decimalObj.process);
|
|
|
+ }
|
|
|
+ else{ // 组成物明细
|
|
|
+ let pGLJ = projectGLJ.getDataByID(glj.projectGLJID);
|
|
|
+ let compositions = pGLJ.ratio_data;
|
|
|
+ if (compositions.length > 0){
|
|
|
+ function isSupply(composition, supplies) {
|
|
|
+ for (let supply of supplies){
|
|
|
+ if(supply.code == composition.code && supply.name == composition.name && supply.unit == composition.unit &&
|
|
|
+ supply.specs == composition.specs && supply.type == composition.type ){
|
|
|
+ composition.basePrice = supply.unit_price.base_price;
|
|
|
+ return true;
|
|
|
+ }
|
|
|
+ };
|
|
|
+ return false;
|
|
|
+ };
|
|
|
|
|
|
+ for (let composition of compositions){
|
|
|
+ if (isSupply(composition, supplyProjectGLJs)) {
|
|
|
+ sum = (sum + composition.basePrice * composition.consumption * glj.quantity).toDecimal(decimalObj.process);
|
|
|
+ }
|
|
|
+ };
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
else {
|
|
|
- if (pGLJIdx[glj.GLJID]) {
|
|
|
-
|
|
|
+ if (pGLJIdx[glj.projectGLJID]) {
|
|
|
+ sum = (sum + glj.basePrice * glj.quantity).toDecimal(decimalObj.process);
|
|
|
}
|
|
|
- sum = sum + glj.basePrice * glj.quantity;
|
|
|
};
|
|
|
|
|
|
};
|
|
@@ -589,24 +628,34 @@ const rationCalcBases = {
|
|
|
return rst.toDecimal(decimalObj.glj.quantity);
|
|
|
},
|
|
|
'甲供定额基价人工费': function (node) {
|
|
|
+ return calcTools.supplyABFee(node, calcBaseNames.JGDEJJRGF);
|
|
|
},
|
|
|
'甲供定额基价材料费': function (node) {
|
|
|
+ return calcTools.supplyABFee(node, calcBaseNames.JGDEJJCLF);
|
|
|
},
|
|
|
'甲供定额基价机械费': function (node) {
|
|
|
+ return calcTools.supplyABFee(node, calcBaseNames.JGDEJJJXF);
|
|
|
},
|
|
|
'甲供主材费': function (node) {
|
|
|
+ return calcTools.supplyABFee(node, calcBaseNames.JGZCF);
|
|
|
},
|
|
|
'甲供设备费': function (node) {
|
|
|
+ return calcTools.supplyABFee(node, calcBaseNames.JGSBF);
|
|
|
},
|
|
|
'甲定定额基价人工费': function (node) {
|
|
|
+ return calcTools.supplyABFee(node, calcBaseNames.JDDEJJRGF);
|
|
|
},
|
|
|
'甲定定额基价材料费': function (node) {
|
|
|
+ return calcTools.supplyABFee(node, calcBaseNames.JDDEJJCLF);
|
|
|
},
|
|
|
'甲定定额基价机械费': function (node) {
|
|
|
+ return calcTools.supplyABFee(node, calcBaseNames.JDDEJJJXF);
|
|
|
},
|
|
|
'甲定主材费': function (node) {
|
|
|
+ return calcTools.supplyABFee(node, calcBaseNames.JDZCF);
|
|
|
},
|
|
|
'甲定设备费': function (node) {
|
|
|
+ return calcTools.supplyABFee(node, calcBaseNames.JDSBF);
|
|
|
},
|
|
|
'暂估材料费': function (node) {
|
|
|
return calcTools.estimateFee(node, true);
|
|
@@ -1094,8 +1143,8 @@ class CalcProgram {
|
|
|
rttf = parseFloatPlus(node.data.feesIndex[ft.type].tenderTotalFee).toDecimal(decimalObj.bills.totalPrice);
|
|
|
};
|
|
|
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);
|
|
|
+ buf = (buf + (ruf * parseFloatPlus(node.data.contain)).toDecimal(decimalObj.bills.unitPrice)).toDecimal(decimalObj.process);
|
|
|
+ btuf = (btuf + (rtuf * parseFloatPlus(node.data.contain)).toDecimal(decimalObj.bills.unitPrice)).toDecimal(decimalObj.process);
|
|
|
};
|
|
|
sum_rtf = (sum_rtf + rtf).toDecimal(decimalObj.process);
|
|
|
sum_rttf = (sum_rttf + rttf).toDecimal(decimalObj.process);
|
|
@@ -1177,11 +1226,12 @@ class CalcProgram {
|
|
|
}
|
|
|
|
|
|
let f = treeNode.data.feeRate ? treeNode.data.feeRate : 100;
|
|
|
- let q = calcTools.uiNodeQty(treeNode) ? calcTools.uiNodeQty(treeNode) : 1;
|
|
|
let b = treeNode.data.calcBaseValue ? treeNode.data.calcBaseValue : 0;
|
|
|
- let uf = (b * f * q / 100).toDecimal(decimalObj.bills.unitPrice);
|
|
|
+ let q = calcTools.uiNodeQty(treeNode) ? calcTools.uiNodeQty(treeNode) : 1;
|
|
|
+ let uf = (b * f * 0.01 / q).toDecimal(decimalObj.bills.unitPrice);
|
|
|
let tuf = uf;
|
|
|
- let tf = (me.project.property.billsCalcMode === leafBillGetFeeType.rationPrice) ? (b * f / 100).toDecimal(decimalObj.bills.totalPrice) : (uf * q).toDecimal(decimalObj.bills.totalPrice);
|
|
|
+ let tf = (me.project.property.billsCalcMode === leafBillGetFeeType.rationPrice) ? (b * f / 100) : (uf * q);
|
|
|
+ tf = tf.toDecimal(decimalObj.bills.totalPrice);
|
|
|
let ttf = tf;
|
|
|
deleteUselessFees(treeNode);
|
|
|
calcTools.checkFeeField(treeNode, {'fieldName': 'common', 'unitFee': uf, 'totalFee': tf});
|
|
@@ -1222,7 +1272,8 @@ class CalcProgram {
|
|
|
}
|
|
|
else if (treeNode.calcType == treeNodeCalcType.ctBillCalcProgram) {
|
|
|
let rations = me.project.Ration.getBillsSortRation(treeNode.source.getID());
|
|
|
- treeNode.data.gljList = me.project.ration_glj.getGatherGljArrByRations(rations);
|
|
|
+ let q = calcTools.uiNodeQty(treeNode) ? calcTools.uiNodeQty(treeNode) : 1;
|
|
|
+ treeNode.data.gljList = me.project.ration_glj.getGatherGljArrByRations(rations, q);
|
|
|
|
|
|
if (treeNode.data.programID == undefined){
|
|
|
treeNode.data.programID = projectInfoObj.projectInfo.property.engineering;
|