|
@@ -348,8 +348,6 @@ class revisePriceCalc {
|
|
|
const said = this.ctx.session.sessionUser.accountId;
|
|
|
billsTree.calculateAll(node => {
|
|
|
if (node.children && node.children.length > 0) return;
|
|
|
- // const priceDiff = helper.sub(node.unit_price, node.pre_unit_price);
|
|
|
- // if (!priceDiff) return;
|
|
|
if (node.cur_id && (node.cur_contract_qty || node.cur_qc_qty)) {
|
|
|
const cur_contract_tp = helper.mul(node.cur_contract_qty, node.unit_price, decimal.tp);
|
|
|
const cur_qc_tp = helper.mul(node.cur_qc_qty, node.unit_price, decimal.tp);
|
|
@@ -375,6 +373,12 @@ class revisePriceCalc {
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
+ const scDetail = stageChange.filter(x => { return x.lid === node.id; });
|
|
|
+ for (const scd of scDetail) {
|
|
|
+ result.scData.push({ id: scd.id, unit_price: node.unit_price });
|
|
|
+ }
|
|
|
+ const priceDiff = helper.sub(node.unit_price, node.pre_unit_price);
|
|
|
+ if (!priceDiff) return;
|
|
|
if (node.pre_id && (node.pre_contract_qty || node.pre_qc_qty)) {
|
|
|
node.contract_pc_tp = helper.sub(helper.mul(node.pre_contract_qty, node.unit_price, decimal.tp), node.pre_contract_tp);
|
|
|
node.qc_pc_tp = helper.sub(helper.mul(node.pre_qc_qty, node.unit_price, decimal.tp), node.pre_qc_tp);
|
|
@@ -387,10 +391,6 @@ class revisePriceCalc {
|
|
|
positive_qc_pc_tp: node.positive_qc_pc_tp, negative_qc_pc_tp: node.negative_qc_pc_tp,
|
|
|
});
|
|
|
}
|
|
|
- const scDetail = stageChange.filter(x => { return x.lid === node.id; });
|
|
|
- for (const scd of scDetail) {
|
|
|
- result.scData.push({ id: scd.id, unit_price: node.unit_price });
|
|
|
- }
|
|
|
});
|
|
|
if (result.ibData.length > 0) await transaction.insert(this.ctx.service.stageBills.tableName, result.ibData);
|
|
|
if (result.ubData.length > 0) await transaction.updateRows(this.ctx.service.stageBills.tableName, result.ubData);
|
|
@@ -430,8 +430,6 @@ class revisePriceCalc {
|
|
|
const said = this.ctx.session.sessionUser.accountId;
|
|
|
billsTree.calculateAll(node => {
|
|
|
if (node.children && node.children.length > 0) return;
|
|
|
- // const priceDiff = helper.sub(node.unit_price, node.pre_unit_price);
|
|
|
- // if (!priceDiff) return;
|
|
|
if (node.cur_id && (node.cur_contract_qty || node.cur_qc_qty)) {
|
|
|
const cur_contract_tp = helper.mul(node.cur_contract_qty, node.unit_price, decimal.tp);
|
|
|
const cur_qc_tp = helper.mul(node.cur_qc_qty, node.unit_price, decimal.tp);
|