diff --git a/src/pages/05_quotation/QuotationForm.vue b/src/pages/05_quotation/QuotationForm.vue index 817d6b18..0002ee10 100644 --- a/src/pages/05_quotation/QuotationForm.vue +++ b/src/pages/05_quotation/QuotationForm.vue @@ -678,41 +678,6 @@ function triggerProductServiceDialog() { pageState.productServiceModal = true; } -function handlePaySplitDiscount() { - if (readonly.value) return; - if (quotationFormData.value.payCondition === 'Split') { - // Calculate average discount - const paySplitArray = JSON.parse(JSON.stringify(tempPaySplit.value)); - const numSplits = paySplitArray.length; - let totalDiscount = quotationFormData.value.discount || 0; - const averageDiscount = totalDiscount / numSplits; - - // Adjust each amount - paySplitArray.forEach((split: PaySplit) => { - if (split.amount < averageDiscount) { - totalDiscount -= split.amount; // Subtract the full amount from totalDiscount - split.amount = 0; // Set the amount to 0 - } else { - split.amount -= averageDiscount; // Subtract the average discount - totalDiscount -= averageDiscount; // Adjust remaining totalDiscount - } - }); - - // Distribute any remaining discount - if (totalDiscount > 0) { - paySplitArray.forEach((split: PaySplit) => { - if (totalDiscount === 0) return; - const deduction = Math.min(split.amount, totalDiscount); - split.amount -= deduction; - totalDiscount -= deduction; - }); - } - - // Update paySplit in quotationFormData - quotationFormData.value.paySplit = paySplitArray; - } -} - function handleChangePayType(type: PayCondition) { if ( type === 'Split' && @@ -1082,13 +1047,6 @@ watch( }, ); -watch( - () => quotationFormData.value.discount, - () => { - handlePaySplitDiscount(); - }, -); - async function searchEmployee(text: string) { let query: string | undefined = text; let pageSize = 50; diff --git a/src/pages/05_quotation/QuotationFormInfo.vue b/src/pages/05_quotation/QuotationFormInfo.vue index 6bddf3d9..530c8c51 100644 --- a/src/pages/05_quotation/QuotationFormInfo.vue +++ b/src/pages/05_quotation/QuotationFormInfo.vue @@ -67,8 +67,8 @@ const summaryPrice = defineModel<{ }, }); -const finalDiscount = defineModel('finalDiscount', { default: 0 }); -const finalDiscount4Show = ref(finalDiscount.value.toString()); +// const finalDiscount = defineModel('finalDiscount', { default: 0 }); +// const finalDiscount4Show = ref(finalDiscount.value.toString()); const payTypeOption = computed(() => [ { value: 'Full', @@ -412,7 +412,7 @@ function calculateInstallments(param: { ฿ -
+ -
+ -->
{{ $t('quotation.totalPriceBaht') }}