|
|
@@ -87,7 +87,7 @@ class BillsPosConvert {
|
|
|
let end_contract_qty = data.contract_qty;
|
|
|
activeQty = this.ctx.helper.add(activeQty, data.pre_qc_minus_qty);
|
|
|
end_contract_qty = this.ctx.helper.add(end_contract_qty, data.pre_contract_qty);
|
|
|
- const end_contract_tp = this.ctx.helper.mul(this.ctx.helper.div(end_contract_qty, activeQty), data.total_price, info.decimal.tp);
|
|
|
+ const end_contract_tp = activeQty === 0 ? data.total_price : this.ctx.helper.mul(this.ctx.helper.div(end_contract_qty, activeQty), data.total_price, info.decimal.tp);
|
|
|
return this.ctx.helper.sub(end_contract_tp, data.pre_contract_tp);
|
|
|
} else if (info.calc_type === 'up') {
|
|
|
if (correct) {
|
|
|
@@ -108,7 +108,7 @@ class BillsPosConvert {
|
|
|
if (info.calc_type === 'tp') {
|
|
|
const activeQty = this.ctx.helper.add(data.quantity, data.pre_qc_minus_qty);
|
|
|
const orgTotalPrice = this.ctx.helper.mul(data.quantity, org_price, info.decimal.tp);
|
|
|
- return this.ctx.helper.mul(this.ctx.helper.div(data.pre_contract_qty, activeQty), orgTotalPrice, info.decimal.tp);
|
|
|
+ return activeQty === 0 ? orgTotalPrice : this.ctx.helper.mul(this.ctx.helper.div(data.pre_contract_qty, activeQty), orgTotalPrice, info.decimal.tp);
|
|
|
} else if (info.calc_type === 'up') {
|
|
|
return this.ctx.helper.mul(org_price, data.pre_contract_qty, info.decimal.tp);
|
|
|
}
|