fix: wrong price calc

This commit is contained in:
Methapon2001 2025-01-24 20:57:41 +07:00
parent ab26a52c48
commit 5de762bb72
2 changed files with 4 additions and 3 deletions

View file

@ -63,7 +63,7 @@ function calcPrice(c: (typeof rows.value)[number]) {
);
const finalPriceNoVat = finalPriceWithVat / (1 + (config.value?.vat || 0.07));
const price = finalPriceNoVat * c.amount;
const price = finalPriceNoVat * c.amount - c.discount;
const vat = c.product.calcVat
? (finalPriceNoVat * c.amount - c.discount) * (config.value?.vat || 0.07)
: 0;
@ -434,7 +434,8 @@ watch(
<q-td align="right">
{{
formatNumberDecimal(
props.row.pricePerUnit * props.row.amount,
props.row.pricePerUnit * props.row.amount -
props.row.discount,
2,
)
}}

View file

@ -237,7 +237,7 @@ onMounted(async () => {
const finalPriceNoVat =
finalPriceWithVat / (1 + (config.value?.vat || 0.07));
const price = finalPriceNoVat * v.amount;
const price = finalPriceNoVat * v.amount - v.discount;
const vat =
(finalPriceNoVat * v.amount - v.discount) *
(config.value?.vat || 0.07);