fix: vat not calculated

This commit is contained in:
Methapon2001 2025-01-23 11:08:28 +07:00
parent 35fbedd74f
commit c34feaa421
3 changed files with 5 additions and 16 deletions

View file

@ -57,12 +57,10 @@ const currentBtnOpen = ref<{ title: string; opened: boolean[] }[]>([
]);
function calcPrice(c: (typeof rows.value)[number]) {
console.log(c);
const originalPrice = c.pricePerUnit;
const finalPriceWithVat = precisionRound(
originalPrice +
(c.product.vatIncluded || c.vat !== 0
? 0
: originalPrice * (config.value?.vat || 0.07)),
originalPrice + originalPrice * (config.value?.vat || 0.07),
);
const finalPriceNoVat = finalPriceWithVat / (1 + (config.value?.vat || 0.07));

View file

@ -244,10 +244,7 @@ function getPrice(
const originalPrice = c.pricePerUnit;
const finalPriceWithVat = precisionRound(
originalPrice +
(c.product.vatIncluded
? 0
: originalPrice * (config.value?.vat || 0.07)),
originalPrice * (1 + (config.value?.vat || 0.07)),
);
const finalPriceNoVat =
finalPriceWithVat / (1 + (config.value?.vat || 0.07));

View file

@ -231,10 +231,7 @@ onMounted(async () => {
(v) => {
const originalPrice = v.pricePerUnit;
const finalPriceWithVat = precisionRound(
originalPrice +
(v.product.vatIncluded || v.vat !== 0
? 0
: originalPrice * (config.value?.vat || 0.07)),
originalPrice * (1 + (config.value?.vat || 0.07)),
);
const finalPriceNoVat =
finalPriceWithVat / (1 + (config.value?.vat || 0.07));
@ -265,10 +262,7 @@ onMounted(async () => {
(a, c) => {
const originalPrice = c.pricePerUnit;
const finalPriceWithVat = precisionRound(
originalPrice +
(c.product.vatIncluded || c.vat !== 0
? 0
: originalPrice * (config.value?.vat || 0.07)),
originalPrice * (1 + (config.value?.vat || 0.07)),
);
const finalPriceNoVat =
finalPriceWithVat / (1 + (config.value?.vat || 0.07));