fix: wrong decimal

This commit is contained in:
Methapon2001 2025-01-17 09:05:36 +07:00
parent 7cb8dd6000
commit 6d43d4e796
2 changed files with 11 additions and 16 deletions

View file

@ -242,12 +242,11 @@ function getPrice(
return a;
}
const price = precisionRound(c.pricePerUnit * c.amount);
const price = c.pricePerUnit * c.amount;
const vat =
precisionRound(
(c.pricePerUnit * (c.discount ? c.amount : 1) - c.discount) *
(config.value?.vat || 0.07),
) * (!c.discount ? c.amount : 1);
(c.pricePerUnit * (c.discount ? c.amount : 1) - c.discount) *
(config.value?.vat || 0.07) *
(!c.discount ? c.amount : 1);
a.totalPrice = precisionRound(a.totalPrice + price);
a.totalDiscount = precisionRound(a.totalDiscount + Number(c.discount));