feat: adjust price to respect its calc vat

This commit is contained in:
Methapon2001 2025-01-28 17:56:23 +07:00
parent fba9adc5f3
commit 82793dc7a8
4 changed files with 50 additions and 25 deletions

View file

@ -199,7 +199,7 @@ onMounted(async () => {
})
.reduce(
(a, c) => {
const priceNoVat = c.product.vatIncluded
const priceNoVat = c.product.serviceChargeVatIncluded
? c.pricePerUnit / (1 + (config.value?.vat || 0.07))
: c.pricePerUnit;
const adjustedPriceWithVat = precisionRound(
@ -219,9 +219,10 @@ onMounted(async () => {
priceUnit: precisionRound(priceNoVat),
amount: c.amount,
discount: c.discount,
vat: c.product.calcVat ? precisionRound(rawVat) : 0,
vat: c.product.serviceChargeCalcVat ? precisionRound(rawVat) : 0,
value: precisionRound(
priceNoVat * c.amount + (c.product.calcVat ? rawVatTotal : 0),
priceNoVat * c.amount +
(c.product.serviceChargeCalcVat ? rawVatTotal : 0),
),
});