feat: add vat excluded calc

This commit is contained in:
Methapon Metanipat 2024-10-17 15:50:26 +07:00
parent 8749e48178
commit 369a7a406d
4 changed files with 18 additions and 73 deletions

View file

@ -132,7 +132,10 @@ const summaryPrice = computed(() =>
a.totalPrice = precisionRound(a.totalPrice + price);
a.totalDiscount = precisionRound(a.totalDiscount + Number(c.discount));
a.vat = precisionRound(a.vat + vat);
a.vat = c.product.calcVat ? precisionRound(a.vat + vat) : a.vat;
a.vatExcluded = c.product.calcVat
? a.vatExcluded
: precisionRound(a.vat + vat);
a.finalPrice = precisionRound(
a.totalPrice -
a.totalDiscount +
@ -146,6 +149,7 @@ const summaryPrice = computed(() =>
totalPrice: 0,
totalDiscount: 0,
vat: 0,
vatExcluded: 0,
finalPrice: 0,
},
),
@ -759,7 +763,7 @@ async function searchEmployee(text: string) {
<ProductItem
:readonly="readonly"
:agent-price="agentPrice"
:employeeRows="
:employee-rows="
selectedWorker.map((e: Employee) => ({
foreignRefNo: '123456789',
employeeName:
@ -777,7 +781,6 @@ async function searchEmployee(text: string) {
"
@delete="toggleDeleteProduct"
v-model:rows="productServiceList"
v-model:summary-price="summaryPrice"
/>
</div>
</q-expansion-item>

View file

@ -59,6 +59,7 @@ const summaryPrice = defineModel<{
totalPrice: number;
totalDiscount: number;
vat: number;
vatExlucded: number;
finalPrice: number;
}>('summaryPrice', {
required: true,
@ -543,7 +544,7 @@ watch(
<div class="row">
{{ $t('general.totalVatExcluded') }}
<span class="q-ml-auto">
{{ formatNumberDecimal(0, 2) || 0 }}
{{ formatNumberDecimal(summaryPrice.vatExcluded, 2) || 0 }}
฿
</span>
</div>