|
@@ -175,16 +175,17 @@ class revisePriceCalc {
|
|
|
let total_price = 0, positive_tp = 0, negative_tp = 0;
|
|
|
for (const b of changeBills) {
|
|
|
const p = this.findPrice(b.code, b.name, b.unit, b.unit_price);
|
|
|
+ let newPrice = this.ctx.helper.mul(b.unit_price, b.spamount, change.tp_decimal);
|
|
|
if (p) {
|
|
|
updateBills.push({ id: b.id, unit_price: p.new_price });
|
|
|
- total_price = this.ctx.helper.add(total_price, this.ctx.helper.mul(p.new_price, b.spamount, change.tp_decimal));
|
|
|
- } else {
|
|
|
- total_price = this.ctx.helper.add(total_price, this.ctx.helper.mul(b.unit_price, b.spamount, change.tp_decimal));
|
|
|
+ newPrice = this.ctx.helper.mul(p.new_price, b.spamount, change.tp_decimal);
|
|
|
+ // total_price = this.ctx.helper.add(total_price, this.ctx.helper.mul(p.new_price, b.spamount, change.tp_decimal));
|
|
|
}
|
|
|
+ total_price = this.ctx.helper.add(total_price, newPrice);
|
|
|
if (b.spamount >= 0) {
|
|
|
- positive_tp = this.ctx.helper.add(positive_tp, total_price);
|
|
|
+ positive_tp = this.ctx.helper.add(positive_tp, newPrice);
|
|
|
} else {
|
|
|
- negative_tp = this.ctx.helper.add(negative_tp, total_price);
|
|
|
+ negative_tp = this.ctx.helper.add(negative_tp, newPrice);
|
|
|
}
|
|
|
}
|
|
|
if (updateBills.length > 0) {
|