fix: price is different by 0.01

This commit is contained in:
Methapon2001 2024-12-10 10:30:36 +07:00
parent f3f27e8f87
commit 5dcbcf881c

View file

@ -419,7 +419,7 @@ export class QuotationController extends Controller {
const price = body.agentPrice ? p.agentPrice : p.price;
const pricePerUnit = p.vatIncluded ? precisionRound(price / (1 + VAT_DEFAULT)) : price;
const vat = p.calcVat
? precisionRound((pricePerUnit * v.amount - (v.discount || 0)) * VAT_DEFAULT)
? precisionRound((pricePerUnit - (v.discount || 0)) * VAT_DEFAULT) * v.amount
: 0;
return {
@ -667,7 +667,7 @@ export class QuotationController extends Controller {
const price = record.agentPrice ? p.agentPrice : p.price;
const pricePerUnit = p.vatIncluded ? precisionRound(price / (1 + VAT_DEFAULT)) : price;
const vat = p.calcVat
? precisionRound((pricePerUnit * v.amount - (v.discount || 0)) * VAT_DEFAULT)
? precisionRound((pricePerUnit - (v.discount || 0)) * VAT_DEFAULT) * v.amount
: 0;
return {
order: i + 1,