|
@@ -81,7 +81,7 @@ class StageIm {
|
|
|
this.ctx.helper.assignRelaData(billsData, [
|
|
|
{ data: curStage, fields: ['contract_qty', 'contract_tp', 'qc_qty', 'qc_tp', 'qc_minus_qty'], prefix: '', relaId: 'lid' },
|
|
|
{ data: preStage, fields: ['contract_qty', 'contract_tp', 'qc_qty', 'qc_tp', 'qc_minus_qty'], prefix: 'pre_', relaId: 'lid' },
|
|
|
- { data: bpcStage, fields: ['contract_pc_tp', 'qc_pc_tp', 'pc_tp'], prefix: '', relaId: 'lid' },
|
|
|
+ { data: bpcStage, fields: ['contract_pc_tp', 'qc_pc_tp', 'pc_tp', 'org_price'], prefix: '', relaId: 'lid' },
|
|
|
]);
|
|
|
this.billsTree.loadDatas(billsData);
|
|
|
this.billsTree.calculateAll();
|
|
@@ -575,7 +575,7 @@ class StageIm {
|
|
|
helper.checkZero(helper.sub(bills.unit_price, x.unit_price));
|
|
|
});
|
|
|
if (!gcl) {
|
|
|
- gcl = {b_code: bills.b_code, name: bills.name, unit: bills.unit, unit_price: bills.unit_price};
|
|
|
+ gcl = { b_code: bills.b_code, name: bills.name, unit: bills.unit, unit_price: bills.unit_price, org_price: bills.org_price };
|
|
|
im.gclBills.push(gcl);
|
|
|
}
|
|
|
if (pos) {
|
|
@@ -641,6 +641,7 @@ class StageIm {
|
|
|
}
|
|
|
}
|
|
|
_calculateBwBillsIm(im) {
|
|
|
+ const helper = this.ctx.helper;
|
|
|
const tp_decimal = this.ctx.tender.info.decimal.tp;
|
|
|
im.contract_jl = 0;
|
|
|
im.qc_jl = 0;
|
|
@@ -652,8 +653,20 @@ class StageIm {
|
|
|
im.qc_jl = this.ctx.helper.add(im.qc_jl, this.ctx.helper.mul(b.qc_jl, b.unit_price, tp_decimal));
|
|
|
im.pre_qc_jl = this.ctx.helper.add(im.pre_qc_jl, this.ctx.helper.mul(b.pre_qc_jl, b.unit_price, tp_decimal));
|
|
|
im.end_qc_jl = this.ctx.helper.add(im.end_qc_jl, this.ctx.helper.mul(b.end_qc_jl, b.unit_price, tp_decimal));
|
|
|
+
|
|
|
+ const priceDiff = b.org_price ? helper.sub(b.unit_price, b.org_price) : 0;
|
|
|
+ if (priceDiff) {
|
|
|
+ const contract_pc_tp = helper.sub(helper.mul(b.unit_price, b.pre_contract_jl, tp_decimal), helper.mul(b.org_price, b.pre_contract_jl, tp_decimal));
|
|
|
+ const qc_pc_tp = helper.sub(helper.mul(b.unit_price, b.pre_qc_jl, tp_decimal), helper.mul(b.org_price, b.pre_qc_jl, tp_decimal));
|
|
|
+ const pc_tp = helper.add(contract_pc_tp, qc_pc_tp);
|
|
|
+ im.contract_pc_jl = helper.add(contract_pc_tp, im.contract_pc_jl);
|
|
|
+ im.qc_pc_jl = helper.add(qc_pc_tp, im.qc_pc_jl);
|
|
|
+ im.pc_jl = helper.add(pc_tp, im.pc_jl);
|
|
|
+ im.end_contract_jl = helper.add(contract_pc_tp, im.end_contract_jl);
|
|
|
+ im.end_qc_jl = helper.add(qc_pc_tp, im.end_qc_jl);
|
|
|
+ }
|
|
|
}
|
|
|
- im.jl = this.ctx.helper.add(im.contract_jl, im.qc_jl);
|
|
|
+ im.jl = this.ctx.helper.sum([im.contract_jl, im.qc_jl, im.pc_jl]);
|
|
|
im.pre_jl = this.ctx.helper.add(im.pre_contract_jl, im.pre_qc_jl);
|
|
|
im.end_jl = this.ctx.helper.add(im.end_contract_jl, im.end_qc_jl);
|
|
|
}
|