From c34feaa42151ea8d21409265e2e0d1f33515e82a Mon Sep 17 00:00:00 2001 From: Methapon2001 <61303214+Methapon2001@users.noreply.github.com> Date: Thu, 23 Jan 2025 11:08:28 +0700 Subject: [PATCH] fix: vat not calculated --- src/components/05_quotation/ProductItem.vue | 6 ++---- src/pages/05_quotation/QuotationForm.vue | 5 +---- src/pages/05_quotation/preview/ViewForm.vue | 10 ++-------- 3 files changed, 5 insertions(+), 16 deletions(-) diff --git a/src/components/05_quotation/ProductItem.vue b/src/components/05_quotation/ProductItem.vue index 20990594..597107ce 100644 --- a/src/components/05_quotation/ProductItem.vue +++ b/src/components/05_quotation/ProductItem.vue @@ -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)); diff --git a/src/pages/05_quotation/QuotationForm.vue b/src/pages/05_quotation/QuotationForm.vue index 26329fff..c1edbf4d 100644 --- a/src/pages/05_quotation/QuotationForm.vue +++ b/src/pages/05_quotation/QuotationForm.vue @@ -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)); diff --git a/src/pages/05_quotation/preview/ViewForm.vue b/src/pages/05_quotation/preview/ViewForm.vue index c1fab7b7..bdb3899c 100644 --- a/src/pages/05_quotation/preview/ViewForm.vue +++ b/src/pages/05_quotation/preview/ViewForm.vue @@ -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));