From ec7d76b6fa5eadb6ac3bc065c67babf365a2b856 Mon Sep 17 00:00:00 2001 From: puriphatt Date: Thu, 26 Dec 2024 16:13:38 +0700 Subject: [PATCH] fix: product vat calculation logic in PriceDataComponent --- .../04_product-service/PriceDataComponent.vue | 21 +++++++++++++------ 1 file changed, 15 insertions(+), 6 deletions(-) diff --git a/src/components/04_product-service/PriceDataComponent.vue b/src/components/04_product-service/PriceDataComponent.vue index b45549d0..b8ba324c 100644 --- a/src/components/04_product-service/PriceDataComponent.vue +++ b/src/components/04_product-service/PriceDataComponent.vue @@ -304,12 +304,21 @@ withDefaults( calculatePrice({ output: 'vat', calcVat: calcVat, - price: - (props.rowIndex === 0 - ? price - : props.rowIndex === 1 - ? agentPrice - : serviceCharge) || 0, + price: Number( + formatNumberDecimal( + calculatePrice({ + output: 'beforeVat', + vatIncluded: vatIncluded, + price: + (props.rowIndex === 0 + ? price + : props.rowIndex === 1 + ? agentPrice + : serviceCharge) || 0, + }), + 2, + ).replaceAll(',', ''), + ), }), 2, )