2024-09-18 15:38:35 +07:00
|
|
|
<script lang="ts" setup>
|
|
|
|
|
import { Icon } from '@iconify/vue';
|
|
|
|
|
import { QSelect } from 'quasar';
|
|
|
|
|
import { selectFilterOptionRefMod } from 'src/stores/utils';
|
|
|
|
|
import { onMounted, ref, watch } from 'vue';
|
2024-09-27 15:45:24 +07:00
|
|
|
import { useI18n } from 'vue-i18n';
|
2024-09-18 15:38:35 +07:00
|
|
|
|
2024-10-11 11:28:06 +07:00
|
|
|
import { formatNumberDecimal, commaInput } from 'stores/utils';
|
2024-10-04 15:16:28 +07:00
|
|
|
|
2024-10-09 18:09:55 +07:00
|
|
|
import { useConfigStore } from 'stores/config';
|
2024-09-18 15:38:35 +07:00
|
|
|
import AppBox from 'components/app/AppBox.vue';
|
2024-09-27 15:45:24 +07:00
|
|
|
import DatePicker from 'src/components/shared/DatePicker.vue';
|
|
|
|
|
import SelectInput from 'src/components/shared/SelectInput.vue';
|
2024-09-18 15:38:35 +07:00
|
|
|
|
|
|
|
|
import useOptionStore from 'src/stores/options';
|
2024-10-09 18:09:55 +07:00
|
|
|
import { storeToRefs } from 'pinia';
|
2024-09-18 15:38:35 +07:00
|
|
|
|
|
|
|
|
defineProps<{
|
|
|
|
|
readonly?: boolean;
|
2024-10-11 11:28:06 +07:00
|
|
|
quotationNo?: string;
|
2024-09-18 15:38:35 +07:00
|
|
|
data?: {
|
|
|
|
|
total: number;
|
|
|
|
|
discount: number;
|
|
|
|
|
totalVatExcluded: number;
|
|
|
|
|
totalVatIncluded: number;
|
|
|
|
|
totalAfterDiscount: number;
|
|
|
|
|
};
|
|
|
|
|
}>();
|
|
|
|
|
|
2024-09-27 15:45:24 +07:00
|
|
|
const { t } = useI18n();
|
2024-10-09 18:09:55 +07:00
|
|
|
const configStore = useConfigStore();
|
|
|
|
|
const { data: config } = storeToRefs(configStore);
|
2024-09-27 15:45:24 +07:00
|
|
|
|
2024-10-04 15:16:28 +07:00
|
|
|
const urgent = defineModel<boolean>('urgent', {
|
|
|
|
|
required: true,
|
|
|
|
|
default: false,
|
|
|
|
|
});
|
2024-09-18 15:38:35 +07:00
|
|
|
const actor = defineModel<string>('actor', { required: true });
|
|
|
|
|
const workName = defineModel<string>('workName', { required: true });
|
|
|
|
|
const contactor = defineModel<string>('contactor', { required: true });
|
|
|
|
|
const telephone = defineModel<string>('telephone', { required: true });
|
|
|
|
|
const documentReceivePoint = defineModel<string>('documentReceivePoint', {
|
|
|
|
|
required: true,
|
|
|
|
|
});
|
2024-10-04 15:16:28 +07:00
|
|
|
const dueDate = defineModel<Date | string>('dueDate', { required: true });
|
|
|
|
|
const payType = defineModel<'Full' | 'Split' | 'BillFull' | 'BillSplit'>(
|
|
|
|
|
'payType',
|
|
|
|
|
{ required: true },
|
|
|
|
|
);
|
|
|
|
|
const paySplitCount = defineModel<number | null>('paySplitCount', {
|
2024-09-27 15:45:24 +07:00
|
|
|
default: 1,
|
|
|
|
|
});
|
2024-09-18 15:38:35 +07:00
|
|
|
const payBank = defineModel<string>('payBank', { required: true });
|
2024-10-04 15:16:28 +07:00
|
|
|
const paySplit = defineModel<
|
|
|
|
|
{ no: number; date: string | Date | null; amount: number }[]
|
|
|
|
|
>('paySplit', { required: true });
|
|
|
|
|
const summaryPrice = defineModel<{
|
|
|
|
|
totalPrice: number;
|
|
|
|
|
totalDiscount: number;
|
|
|
|
|
vat: number;
|
|
|
|
|
finalPrice: number;
|
|
|
|
|
}>('summaryPrice', {
|
|
|
|
|
required: true,
|
|
|
|
|
default: {
|
|
|
|
|
totalPrice: 0,
|
|
|
|
|
totalDiscount: 0,
|
|
|
|
|
vat: 0,
|
|
|
|
|
finalPrice: 0,
|
|
|
|
|
},
|
|
|
|
|
});
|
2024-09-18 15:38:35 +07:00
|
|
|
|
|
|
|
|
const optionStore = useOptionStore();
|
|
|
|
|
|
2024-10-11 11:28:06 +07:00
|
|
|
const finalDiscount = defineModel<number>('finalDiscount', { default: 0 });
|
|
|
|
|
const finalDiscount4Show = ref<string>(finalDiscount.value.toString());
|
|
|
|
|
|
2024-09-27 15:45:24 +07:00
|
|
|
const payTypeOpion = ref([
|
|
|
|
|
{
|
2024-10-04 15:16:28 +07:00
|
|
|
value: 'Full',
|
2024-09-27 15:45:24 +07:00
|
|
|
label: t('quotation.type.fullAmountCash'),
|
|
|
|
|
},
|
|
|
|
|
{
|
2024-10-04 15:16:28 +07:00
|
|
|
value: 'Split',
|
2024-09-27 15:45:24 +07:00
|
|
|
label: t('quotation.type.installmentsCash'),
|
|
|
|
|
},
|
|
|
|
|
{
|
2024-10-04 15:16:28 +07:00
|
|
|
value: 'BillFull',
|
2024-09-27 15:45:24 +07:00
|
|
|
label: t('quotation.type.fullAmountBill'),
|
|
|
|
|
},
|
|
|
|
|
{
|
2024-10-04 15:16:28 +07:00
|
|
|
value: 'BillSplit',
|
2024-09-27 15:45:24 +07:00
|
|
|
label: t('quotation.type.installmentsBill'),
|
|
|
|
|
},
|
|
|
|
|
]);
|
|
|
|
|
|
2024-09-18 15:38:35 +07:00
|
|
|
const bankBookOptions = ref<Record<string, unknown>[]>([]);
|
|
|
|
|
let bankBoookFilter: (
|
|
|
|
|
value: string,
|
|
|
|
|
update: (callbackFn: () => void, afterFn?: (ref: QSelect) => void) => void,
|
|
|
|
|
) => void;
|
|
|
|
|
|
|
|
|
|
onMounted(() => {
|
|
|
|
|
if (optionStore.globalOption) {
|
|
|
|
|
bankBoookFilter = selectFilterOptionRefMod(
|
|
|
|
|
ref(optionStore.globalOption.bankBook),
|
|
|
|
|
bankBookOptions,
|
|
|
|
|
'label',
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
watch(
|
|
|
|
|
() => optionStore.globalOption,
|
|
|
|
|
() => {
|
|
|
|
|
bankBoookFilter = selectFilterOptionRefMod(
|
|
|
|
|
ref(optionStore.globalOption.bankBook),
|
|
|
|
|
bankBookOptions,
|
|
|
|
|
'label',
|
|
|
|
|
);
|
|
|
|
|
},
|
|
|
|
|
);
|
2024-10-04 15:16:28 +07:00
|
|
|
|
|
|
|
|
watch(
|
|
|
|
|
() => payType.value,
|
|
|
|
|
(v) => {
|
|
|
|
|
if (v === 'Split' || v === 'BillSplit') {
|
|
|
|
|
paySplitCount.value = 1;
|
|
|
|
|
} else {
|
|
|
|
|
paySplitCount.value = 0;
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
watch(
|
|
|
|
|
() => paySplitCount.value,
|
|
|
|
|
(newCount, oldCount) => {
|
|
|
|
|
if (newCount !== null && oldCount !== null) {
|
|
|
|
|
const totalAmount = summaryPrice.value.finalPrice;
|
|
|
|
|
|
|
|
|
|
if (newCount > oldCount) {
|
2024-10-11 14:01:36 +07:00
|
|
|
// Calculate the base installment amount for all except the last installment
|
|
|
|
|
const installmentAmount = +(totalAmount / newCount).toFixed(2);
|
2024-10-04 15:16:28 +07:00
|
|
|
|
2024-10-11 14:01:36 +07:00
|
|
|
// Update existing installments
|
|
|
|
|
paySplit.value.forEach((payment) => {
|
2024-10-04 15:16:28 +07:00
|
|
|
payment.amount = installmentAmount;
|
|
|
|
|
});
|
|
|
|
|
|
2024-10-11 14:01:36 +07:00
|
|
|
// Add new installments
|
2024-10-04 15:16:28 +07:00
|
|
|
for (let i = oldCount; i < newCount; i++) {
|
|
|
|
|
paySplit.value.push({
|
|
|
|
|
no: i + 1,
|
|
|
|
|
date: null,
|
|
|
|
|
amount: installmentAmount,
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
} else if (newCount < oldCount) {
|
2024-10-11 14:01:36 +07:00
|
|
|
// Remove extra installments
|
2024-10-04 15:16:28 +07:00
|
|
|
paySplit.value.splice(newCount, oldCount - newCount);
|
|
|
|
|
|
2024-10-11 14:01:36 +07:00
|
|
|
// Recalculate the base installment amount for remaining installments
|
|
|
|
|
const installmentAmount = +(totalAmount / newCount).toFixed(2);
|
2024-10-04 15:16:28 +07:00
|
|
|
paySplit.value.forEach((payment) => {
|
|
|
|
|
payment.amount = installmentAmount;
|
|
|
|
|
});
|
|
|
|
|
}
|
2024-10-11 14:01:36 +07:00
|
|
|
|
|
|
|
|
// Calculate the amount for the last installment
|
|
|
|
|
if (paySplit.value.length > 0) {
|
|
|
|
|
const totalPreviousPayments = paySplit.value
|
|
|
|
|
.slice(0, -1)
|
|
|
|
|
.reduce((sum, payment) => sum + payment.amount, 0);
|
|
|
|
|
|
|
|
|
|
// Set the last installment to cover the remaining balance, rounded to 2 decimal places
|
|
|
|
|
const remainingAmount = totalAmount - totalPreviousPayments;
|
|
|
|
|
paySplit.value[paySplit.value.length - 1].amount =
|
|
|
|
|
+remainingAmount.toFixed(2);
|
|
|
|
|
}
|
2024-10-04 15:16:28 +07:00
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
{ deep: true },
|
|
|
|
|
);
|
2024-09-18 15:38:35 +07:00
|
|
|
</script>
|
|
|
|
|
|
|
|
|
|
<template>
|
|
|
|
|
<AppBox no-padding bordered class="column">
|
|
|
|
|
<div
|
|
|
|
|
class="bordered-b q-px-md q-py-sm row bg-color-orange-light items-center"
|
|
|
|
|
>
|
|
|
|
|
<div class="icon-wrapper bg-color-orange q-mr-sm">
|
|
|
|
|
<q-icon name="mdi-file-outline" />
|
|
|
|
|
</div>
|
|
|
|
|
<span class="text-weight-bold">
|
2024-09-27 15:45:24 +07:00
|
|
|
{{ $t('general.information', { msg: $t('general.attachment') }) }}
|
2024-09-18 15:38:35 +07:00
|
|
|
</span>
|
2024-10-04 15:16:28 +07:00
|
|
|
|
|
|
|
|
<q-checkbox
|
|
|
|
|
v-model="urgent"
|
|
|
|
|
class="q-ml-auto"
|
|
|
|
|
size="xs"
|
|
|
|
|
:label="$t('general.urgent')"
|
2024-10-11 11:28:06 +07:00
|
|
|
:disable="readonly"
|
2024-10-04 15:16:28 +07:00
|
|
|
/>
|
2024-09-18 15:38:35 +07:00
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
<div class="q-pa-sm">
|
|
|
|
|
<div class="row q-col-gutter-sm">
|
|
|
|
|
<q-input
|
2024-09-27 15:45:24 +07:00
|
|
|
for="input-quotation"
|
|
|
|
|
:label="$t('general.itemNo', { msg: $t('quotation.title') })"
|
2024-09-18 17:40:43 +07:00
|
|
|
:readonly
|
2024-10-04 13:23:28 +07:00
|
|
|
:model-value="!quotationNo ? $t('general.generated') : quotationNo"
|
2024-10-11 11:28:06 +07:00
|
|
|
:disable="!readonly"
|
2024-09-18 17:40:43 +07:00
|
|
|
class="col-12"
|
2024-09-18 15:38:35 +07:00
|
|
|
dense
|
|
|
|
|
outlined
|
|
|
|
|
/>
|
|
|
|
|
<q-input
|
2024-09-27 15:45:24 +07:00
|
|
|
for="input-actor"
|
|
|
|
|
:label="$t('quotation.actor')"
|
2024-09-18 17:40:43 +07:00
|
|
|
:readonly
|
2024-09-18 15:38:35 +07:00
|
|
|
v-model="actor"
|
2024-10-11 11:28:06 +07:00
|
|
|
:disable="!readonly"
|
2024-09-18 17:40:43 +07:00
|
|
|
class="col-12"
|
2024-09-18 15:38:35 +07:00
|
|
|
dense
|
|
|
|
|
outlined
|
|
|
|
|
/>
|
|
|
|
|
<q-input
|
2024-09-27 15:45:24 +07:00
|
|
|
for="input-work-name"
|
|
|
|
|
:label="$t('quotation.workName')"
|
2024-09-18 17:40:43 +07:00
|
|
|
:readonly
|
2024-09-18 15:38:35 +07:00
|
|
|
v-model="workName"
|
|
|
|
|
class="col-12"
|
|
|
|
|
dense
|
|
|
|
|
outlined
|
|
|
|
|
/>
|
|
|
|
|
<q-input
|
2024-09-27 15:45:24 +07:00
|
|
|
for="input-contact-name"
|
|
|
|
|
:label="$t('quotation.contactName')"
|
2024-09-18 17:40:43 +07:00
|
|
|
:readonly
|
2024-09-18 15:38:35 +07:00
|
|
|
v-model="contactor"
|
2024-09-18 17:40:43 +07:00
|
|
|
class="col-12"
|
2024-09-18 15:38:35 +07:00
|
|
|
dense
|
|
|
|
|
outlined
|
|
|
|
|
/>
|
|
|
|
|
<q-input
|
2024-09-27 15:45:24 +07:00
|
|
|
for="input-telephone"
|
|
|
|
|
:label="$t('general.telephone')"
|
2024-09-18 15:38:35 +07:00
|
|
|
:readonly="readonly"
|
|
|
|
|
v-model="telephone"
|
2024-09-18 17:40:43 +07:00
|
|
|
class="col-12"
|
2024-09-18 15:38:35 +07:00
|
|
|
dense
|
|
|
|
|
outlined
|
|
|
|
|
/>
|
|
|
|
|
<q-input
|
2024-09-27 15:45:24 +07:00
|
|
|
for="input-docs-receive-point"
|
|
|
|
|
:label="$t('quotation.documentReceivePoint')"
|
2024-09-18 17:40:43 +07:00
|
|
|
:readonly
|
2024-09-18 15:38:35 +07:00
|
|
|
v-model="documentReceivePoint"
|
2024-09-18 17:40:43 +07:00
|
|
|
class="col-12"
|
2024-09-18 15:38:35 +07:00
|
|
|
dense
|
|
|
|
|
outlined
|
|
|
|
|
/>
|
2024-09-27 15:45:24 +07:00
|
|
|
<DatePicker
|
|
|
|
|
id="select-due-date"
|
|
|
|
|
:label="$t('quotation.dueDate')"
|
2024-09-18 17:40:43 +07:00
|
|
|
:readonly
|
2024-09-18 15:38:35 +07:00
|
|
|
v-model="dueDate"
|
2024-09-18 17:40:43 +07:00
|
|
|
class="col-12"
|
2024-09-18 15:38:35 +07:00
|
|
|
/>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
<div
|
|
|
|
|
class="bordered-b q-px-md q-py-sm row bg-color-orange-light items-center"
|
|
|
|
|
>
|
|
|
|
|
<div class="icon-wrapper bg-color-orange q-mr-sm">
|
|
|
|
|
<q-icon name="mdi-bank-outline" />
|
|
|
|
|
</div>
|
|
|
|
|
<span class="text-weight-bold">
|
2024-09-27 15:45:24 +07:00
|
|
|
{{ $t('quotation.paymentCondition') }}
|
2024-09-18 15:38:35 +07:00
|
|
|
</span>
|
|
|
|
|
</div>
|
|
|
|
|
<div class="q-pa-sm">
|
|
|
|
|
<div class="row q-col-gutter-sm">
|
2024-09-27 15:45:24 +07:00
|
|
|
<SelectInput
|
2024-09-18 17:40:43 +07:00
|
|
|
class="col-12"
|
2024-09-27 15:45:24 +07:00
|
|
|
:label="$t('quotation.payType')"
|
|
|
|
|
:option="payTypeOpion"
|
2024-09-18 17:40:43 +07:00
|
|
|
:readonly
|
2024-09-27 15:45:24 +07:00
|
|
|
id="pay-type"
|
2024-09-18 15:38:35 +07:00
|
|
|
v-model="payType"
|
2024-09-27 15:45:24 +07:00
|
|
|
/>
|
|
|
|
|
|
|
|
|
|
<q-field
|
|
|
|
|
dense
|
|
|
|
|
outlined
|
|
|
|
|
class="col-12"
|
2024-10-04 15:16:28 +07:00
|
|
|
v-if="payType === 'Split' || payType === 'BillSplit'"
|
2024-09-27 15:45:24 +07:00
|
|
|
>
|
|
|
|
|
<div class="row full-width items-center justify-between q-py-xs">
|
|
|
|
|
<div class="column">
|
|
|
|
|
<span style="color: var(--foreground)">
|
|
|
|
|
{{ $t('quotation.paySplitCount') }}
|
2024-09-18 17:40:43 +07:00
|
|
|
</span>
|
2024-09-27 15:45:24 +07:00
|
|
|
<span class="app-text-muted text-caption">
|
2024-10-10 17:49:14 +07:00
|
|
|
({{
|
|
|
|
|
$t('quotation.payTotal', {
|
|
|
|
|
msg:
|
|
|
|
|
formatNumberDecimal(
|
|
|
|
|
Math.max(summaryPrice.finalPrice, 0),
|
|
|
|
|
2,
|
|
|
|
|
) || 0,
|
|
|
|
|
})
|
|
|
|
|
}})
|
2024-09-27 15:45:24 +07:00
|
|
|
</span>
|
|
|
|
|
</div>
|
|
|
|
|
<q-input
|
|
|
|
|
v-model="paySplitCount"
|
|
|
|
|
:readonly
|
|
|
|
|
class="col-3"
|
|
|
|
|
type="number"
|
|
|
|
|
dense
|
|
|
|
|
outlined
|
|
|
|
|
min="1"
|
2024-10-04 15:16:28 +07:00
|
|
|
@update:model-value="(i) => (paySplitCount = Number(i))"
|
2024-09-27 15:45:24 +07:00
|
|
|
/>
|
|
|
|
|
</div>
|
|
|
|
|
</q-field>
|
|
|
|
|
<section
|
2024-10-04 15:16:28 +07:00
|
|
|
v-if="payType === 'Split' || payType === 'BillSplit'"
|
2024-09-27 15:45:24 +07:00
|
|
|
class="col-12 text-caption"
|
|
|
|
|
style="padding-left: 20px"
|
|
|
|
|
>
|
2024-10-04 15:16:28 +07:00
|
|
|
<template v-for="(period, i) in paySplit" :key="period.no">
|
2024-09-27 15:45:24 +07:00
|
|
|
<div
|
|
|
|
|
class="row app-text-muted items-center"
|
2024-10-04 15:16:28 +07:00
|
|
|
:class="{ 'q-mb-sm': i !== paySplit.length }"
|
2024-09-27 15:45:24 +07:00
|
|
|
>
|
2024-10-04 15:16:28 +07:00
|
|
|
{{ `${$t('quotation.periodNo')} ${period.no}` }}
|
2024-09-27 15:45:24 +07:00
|
|
|
<q-input
|
|
|
|
|
class="col q-mx-sm"
|
|
|
|
|
:label="$t('quotation.amount')"
|
2024-10-04 15:16:28 +07:00
|
|
|
:model-value="formatNumberDecimal(period.amount, 2)"
|
2024-09-27 15:45:24 +07:00
|
|
|
dense
|
2024-10-04 15:16:28 +07:00
|
|
|
readonly
|
2024-09-27 15:45:24 +07:00
|
|
|
outlined
|
|
|
|
|
bg-color="input-border"
|
|
|
|
|
>
|
|
|
|
|
<template #prepend>
|
|
|
|
|
<q-icon name="mdi-cash" color="primary" />
|
|
|
|
|
</template>
|
|
|
|
|
</q-input>
|
|
|
|
|
<DatePicker
|
2024-10-04 15:16:28 +07:00
|
|
|
v-model="period.date"
|
2024-09-27 15:45:24 +07:00
|
|
|
class="col-5"
|
|
|
|
|
:label="$t('quotation.payDueDate')"
|
|
|
|
|
bg-color="input-border"
|
|
|
|
|
/>
|
|
|
|
|
</div>
|
|
|
|
|
</template>
|
|
|
|
|
</section>
|
|
|
|
|
|
|
|
|
|
<DatePicker
|
2024-10-04 15:16:28 +07:00
|
|
|
v-if="payType === 'BillFull'"
|
2024-09-27 15:45:24 +07:00
|
|
|
class="col-12"
|
|
|
|
|
:label="$t('quotation.callDueDate')"
|
|
|
|
|
/>
|
|
|
|
|
|
2024-10-11 14:01:36 +07:00
|
|
|
<!-- <q-select
|
2024-09-18 15:38:35 +07:00
|
|
|
outlined
|
|
|
|
|
clearable
|
|
|
|
|
use-input
|
|
|
|
|
emit-value
|
|
|
|
|
fill-input
|
|
|
|
|
map-options
|
|
|
|
|
hide-bottom-space
|
|
|
|
|
option-value="value"
|
|
|
|
|
input-debounce="0"
|
|
|
|
|
option-label="label"
|
|
|
|
|
class="col-12"
|
|
|
|
|
autocomplete="off"
|
|
|
|
|
for="select-bankbook"
|
|
|
|
|
dense
|
2024-09-27 15:45:24 +07:00
|
|
|
:label="$t('quotation.bank')"
|
2024-09-18 15:38:35 +07:00
|
|
|
:options="bankBookOptions"
|
2024-09-18 17:40:43 +07:00
|
|
|
:readonly
|
2024-09-18 15:38:35 +07:00
|
|
|
:hide-dropdown-icon="readonly"
|
|
|
|
|
v-model="payBank"
|
|
|
|
|
@filter="bankBoookFilter"
|
|
|
|
|
>
|
|
|
|
|
<template v-slot:option="scope">
|
|
|
|
|
<q-item
|
|
|
|
|
v-if="scope.opt"
|
|
|
|
|
v-bind="scope.itemProps"
|
|
|
|
|
class="row items-center"
|
|
|
|
|
>
|
|
|
|
|
<q-item-section avatar>
|
|
|
|
|
<q-img
|
|
|
|
|
:src="`/img/bank/${scope.opt.value}.png`"
|
|
|
|
|
class="bordered"
|
|
|
|
|
style="
|
|
|
|
|
border-radius: 50%;
|
|
|
|
|
aspect-ratio: 1;
|
|
|
|
|
height: 2rem;
|
|
|
|
|
width: 2rem;
|
|
|
|
|
"
|
|
|
|
|
/>
|
|
|
|
|
</q-item-section>
|
|
|
|
|
<q-item-section>
|
|
|
|
|
{{ scope.opt.label }}
|
|
|
|
|
</q-item-section>
|
|
|
|
|
</q-item>
|
|
|
|
|
</template>
|
|
|
|
|
|
|
|
|
|
<template v-slot:selected-item="scope">
|
|
|
|
|
<q-item-section
|
|
|
|
|
v-if="scope.opt && !!payBank"
|
|
|
|
|
avatar
|
|
|
|
|
class="q-py-sm row"
|
|
|
|
|
>
|
|
|
|
|
<q-img
|
|
|
|
|
:src="`/img/bank/${scope.opt.value}.png`"
|
|
|
|
|
class="bordered"
|
|
|
|
|
style="
|
|
|
|
|
border-radius: 50%;
|
|
|
|
|
aspect-ratio: 1;
|
|
|
|
|
height: 2rem;
|
|
|
|
|
width: 2rem;
|
|
|
|
|
"
|
|
|
|
|
/>
|
|
|
|
|
</q-item-section>
|
|
|
|
|
</template>
|
|
|
|
|
|
|
|
|
|
<template v-slot:no-option>
|
|
|
|
|
<q-item>
|
|
|
|
|
<q-item-section class="text-grey">
|
|
|
|
|
{{ $t('general.noData') }}
|
|
|
|
|
</q-item-section>
|
|
|
|
|
</q-item>
|
|
|
|
|
</template>
|
2024-10-11 14:01:36 +07:00
|
|
|
</q-select> -->
|
2024-09-18 15:38:35 +07:00
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
<div
|
|
|
|
|
class="bordered-b q-px-md q-py-sm row bg-color-orange-light items-center"
|
|
|
|
|
>
|
|
|
|
|
<div class="icon-wrapper bg-color-orange q-mr-sm">
|
|
|
|
|
<Icon icon="iconoir:coins" />
|
|
|
|
|
</div>
|
|
|
|
|
<span class="text-weight-bold">
|
2024-09-27 15:45:24 +07:00
|
|
|
{{ $t('quotation.summary') }}
|
2024-09-18 15:38:35 +07:00
|
|
|
</span>
|
|
|
|
|
</div>
|
|
|
|
|
<div class="q-pa-sm">
|
|
|
|
|
<div class="row">
|
|
|
|
|
{{ $t('general.total') }}
|
2024-10-09 18:09:55 +07:00
|
|
|
<span class="q-ml-auto">
|
|
|
|
|
{{
|
|
|
|
|
formatNumberDecimal(
|
2024-10-10 09:24:02 +07:00
|
|
|
summaryPrice.finalPrice +
|
|
|
|
|
summaryPrice.totalDiscount +
|
|
|
|
|
Number(finalDiscount),
|
2024-10-09 18:09:55 +07:00
|
|
|
2,
|
|
|
|
|
) || 0
|
|
|
|
|
}}
|
|
|
|
|
฿
|
|
|
|
|
</span>
|
2024-09-18 15:38:35 +07:00
|
|
|
</div>
|
|
|
|
|
<div class="row">
|
2024-10-09 18:09:55 +07:00
|
|
|
{{ $t('quotation.discountList') }}
|
|
|
|
|
<span class="q-ml-auto">
|
|
|
|
|
{{ formatNumberDecimal(summaryPrice.totalDiscount, 2) || 0 }} ฿
|
|
|
|
|
</span>
|
2024-09-18 15:38:35 +07:00
|
|
|
</div>
|
|
|
|
|
<div class="row">
|
|
|
|
|
{{ $t('general.totalAfterDiscount') }}
|
2024-10-10 09:24:02 +07:00
|
|
|
<span class="q-ml-auto">
|
|
|
|
|
{{
|
|
|
|
|
formatNumberDecimal(
|
|
|
|
|
summaryPrice.finalPrice + Number(finalDiscount),
|
|
|
|
|
2,
|
|
|
|
|
)
|
|
|
|
|
}}
|
|
|
|
|
฿
|
|
|
|
|
</span>
|
2024-09-18 15:38:35 +07:00
|
|
|
</div>
|
|
|
|
|
<div class="row">
|
|
|
|
|
{{ $t('general.totalVatExcluded') }}
|
2024-10-10 09:24:02 +07:00
|
|
|
<span class="q-ml-auto">
|
|
|
|
|
{{
|
|
|
|
|
formatNumberDecimal(
|
|
|
|
|
summaryPrice.finalPrice +
|
|
|
|
|
Number(finalDiscount) -
|
|
|
|
|
Number(summaryPrice.vat),
|
|
|
|
|
2,
|
|
|
|
|
) || 0
|
|
|
|
|
}}
|
|
|
|
|
฿
|
|
|
|
|
</span>
|
2024-09-18 15:38:35 +07:00
|
|
|
</div>
|
|
|
|
|
<div class="row">
|
2024-10-09 18:09:55 +07:00
|
|
|
{{ $t('general.totalVatIncluded') }}
|
2024-10-10 09:24:02 +07:00
|
|
|
<span class="q-ml-auto">
|
|
|
|
|
{{
|
|
|
|
|
formatNumberDecimal(
|
|
|
|
|
summaryPrice.finalPrice + Number(finalDiscount),
|
|
|
|
|
2,
|
|
|
|
|
) || 0
|
|
|
|
|
}}
|
|
|
|
|
฿
|
|
|
|
|
</span>
|
2024-09-18 15:38:35 +07:00
|
|
|
</div>
|
2024-10-09 18:09:55 +07:00
|
|
|
<div class="row">
|
|
|
|
|
{{
|
|
|
|
|
$t('general.vat', {
|
|
|
|
|
msg: `${config && Math.round(config.vat * 100)}%`,
|
|
|
|
|
})
|
|
|
|
|
}}
|
2024-10-11 10:52:01 +07:00
|
|
|
<span class="q-ml-auto">
|
|
|
|
|
{{ formatNumberDecimal(summaryPrice.vat || 0, 2) }} ฿
|
|
|
|
|
</span>
|
2024-10-09 18:09:55 +07:00
|
|
|
</div>
|
|
|
|
|
<div class="row">
|
|
|
|
|
{{ $t('general.discountAfterVat') }}
|
|
|
|
|
<q-input
|
2024-10-11 11:28:06 +07:00
|
|
|
:readonly
|
2024-10-09 18:09:55 +07:00
|
|
|
dense
|
|
|
|
|
outlined
|
|
|
|
|
class="q-ml-auto price-tag"
|
|
|
|
|
input-class="text-right"
|
2024-10-10 15:05:00 +07:00
|
|
|
debounce="500"
|
2024-10-11 11:28:06 +07:00
|
|
|
:model-value="commaInput(finalDiscount.toString() || '0')"
|
|
|
|
|
@update:model-value="
|
|
|
|
|
(v) => {
|
|
|
|
|
if (typeof v === 'string') finalDiscount4Show = commaInput(v);
|
|
|
|
|
const x = parseFloat(
|
|
|
|
|
finalDiscount4Show && typeof finalDiscount4Show === 'string'
|
|
|
|
|
? finalDiscount4Show.replace(/,/g, '')
|
|
|
|
|
: '',
|
|
|
|
|
);
|
|
|
|
|
finalDiscount = x;
|
|
|
|
|
}
|
|
|
|
|
"
|
2024-10-09 18:09:55 +07:00
|
|
|
/>
|
|
|
|
|
<!-- <span class="q-ml-auto">{{ data?.totalVatIncluded || 0 }} ฿</span> -->
|
|
|
|
|
</div>
|
2024-09-18 15:38:35 +07:00
|
|
|
</div>
|
2024-09-27 15:45:24 +07:00
|
|
|
<div class="q-pa-sm row surface-2 items-center text-weight-bold">
|
|
|
|
|
{{ $t('general.totalAmount') }}
|
|
|
|
|
|
|
|
|
|
<span class="q-ml-auto" style="color: var(--brand-1)">
|
2024-10-09 18:09:55 +07:00
|
|
|
{{ formatNumberDecimal(Math.max(summaryPrice.finalPrice, 0), 2) || 0 }}
|
|
|
|
|
฿
|
2024-09-27 15:45:24 +07:00
|
|
|
</span>
|
|
|
|
|
</div>
|
2024-09-18 15:38:35 +07:00
|
|
|
</AppBox>
|
|
|
|
|
</template>
|
|
|
|
|
|
|
|
|
|
<style scoped>
|
|
|
|
|
.icon-wrapper {
|
|
|
|
|
display: flex;
|
|
|
|
|
align-items: center;
|
|
|
|
|
justify-content: center;
|
|
|
|
|
aspect-ratio: 1/1;
|
|
|
|
|
font-size: 1.5rem;
|
|
|
|
|
padding: var(--size-1);
|
|
|
|
|
border-radius: var(--radius-2);
|
|
|
|
|
}
|
|
|
|
|
|
2024-10-09 18:09:55 +07:00
|
|
|
:deep(.price-tag .q-field__control) {
|
|
|
|
|
display: flex;
|
|
|
|
|
align-items: center;
|
|
|
|
|
width: 90px;
|
|
|
|
|
height: 25px;
|
|
|
|
|
}
|
|
|
|
|
|
2024-09-18 15:38:35 +07:00
|
|
|
.bg-color-orange {
|
|
|
|
|
--_color: var(--yellow-7-hsl);
|
|
|
|
|
color: white;
|
|
|
|
|
background: hsla(var(--_color));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.dark .bg-color-orange {
|
|
|
|
|
--_color: var(--orange-6-hsl);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.bg-color-orange-light {
|
|
|
|
|
--_color: var(--yellow-7-hsl);
|
|
|
|
|
background: hsla(var(--_color) / 0.2);
|
|
|
|
|
}
|
|
|
|
|
.dark .bg-color-orange {
|
|
|
|
|
--_color: var(--orange-6-hsl / 0.2);
|
|
|
|
|
}
|
|
|
|
|
</style>
|