|
@@ -211,8 +211,8 @@ class revisePriceCalc {
|
|
|
let total_price = 0, positive_tp = 0, negative_tp = 0;
|
|
|
for (const b of changeBills) {
|
|
|
const p = this.findChangeBillsPrice(b.code, b.name, b.unit, b.unit_price, change.cid);
|
|
|
- const settleGcl = p.gcl_id ? this.settleBills.find(x => { return x.lid === p.gcl_id; }) : null;
|
|
|
- const settlePos = p.mx_id ? this.settlePos.find(x => { return x.pid === p.mx_id; }): null;
|
|
|
+ const settleGcl = b.gcl_id ? this.settleBills.find(x => { return x.lid === b.gcl_id; }) : null;
|
|
|
+ const settlePos = b.mx_id ? this.settlePos.find(x => { return x.pid === b.mx_id; }): null;
|
|
|
let bills_tp;
|
|
|
if (p && !settleGcl && !settlePos) {
|
|
|
bills_tp = this.ctx.helper.mul(p.new_price, b.spamount, change.tp_decimal || decimal.tp);
|
|
@@ -379,8 +379,8 @@ class revisePriceCalc {
|
|
|
|
|
|
this.price = await this.ctx.service.revisePrice.getAllDataByCondition({ where: { rid: revise.id } });
|
|
|
this.settleStatus = this.ctx.service.settle.settleStatus;
|
|
|
- this.settleBills = await this.ctx.service.settleBills.getAllDataByCondition({ where: { settle_id: revise.readySettle.id, settle_status: settleStatus.finish } });
|
|
|
- this.settlePos = await this.ctx.service.settlePos.getAllDataByCondition({ where: { settle_id: revise.readySettle.id }});
|
|
|
+ this.settleBills = revise.readySettle ? await this.ctx.service.settleBills.getAllDataByCondition({ where: { settle_id: revise.readySettle.id, settle_status: settleStatus.finish } }) : [];
|
|
|
+ this.settlePos = revise.readySettle ? await this.ctx.service.settlePos.getAllDataByCondition({ where: { settle_id: revise.readySettle.id }}) : [];
|
|
|
const pcTp = await this.calcReviseLedger(revise, transaction);
|
|
|
// 引用到所有工程变更
|
|
|
await this.calcAllChanges(revise.tid, transaction);
|