diff --git a/src/pages/05_quotation/QuotationForm.vue b/src/pages/05_quotation/QuotationForm.vue index c1edbf4d..4ea677b6 100644 --- a/src/pages/05_quotation/QuotationForm.vue +++ b/src/pages/05_quotation/QuotationForm.vue @@ -704,18 +704,22 @@ function handleUpdateProductTable( newInstallmentNo: number; }, ) { + handleChangePayType(quotationFormData.value.payCondition); // calc price const calc = (c: QuotationPayload['productServiceList'][number]) => { - const pricePerUnit = c.pricePerUnit || 0; - const discount = c.discount || 0; - - return ( - pricePerUnit * c.amount - - discount + - (c.product.calcVat - ? (pricePerUnit * c.amount - discount) * (config.value?.vat || 0.07) - : 0) + const originalPrice = c.pricePerUnit || 0; + const finalPriceWithVat = precisionRound( + originalPrice * (1 + (config.value?.vat || 0.07)), ); + const finalPriceNoVat = + finalPriceWithVat / (1 + (config.value?.vat || 0.07)); + + const price = finalPriceNoVat * c.amount; + const vat = c.product.calcVat + ? (finalPriceNoVat * c.amount - (c.discount || 0)) * + (config.value?.vat || 0.07) + : 0; + return precisionRound(price + vat); }; // installment @@ -2057,23 +2061,20 @@ watch(