feat: add calc vat into product (will be calc in quotation)

This commit is contained in:
Methapon Metanipat 2024-10-16 16:22:45 +07:00
parent 08254d1b9f
commit 6c10c82fcc
5 changed files with 27 additions and 0 deletions

View file

@ -6,6 +6,7 @@ const serviceCharge = defineModel<number>('serviceCharge');
const agentPrice = defineModel<number>('agentPrice');
const price = defineModel<number>('price');
const vatIncluded = defineModel<boolean>('vatIncluded');
const calcVat = defineModel<boolean>('calcVat');
const price4Show = ref('');
const agentPrice4Show = ref('');
@ -154,6 +155,22 @@ withDefaults(
}
"
/>
<section class="q-px-md q-mx-xs">
<input
id="input-calc-vat"
type="checkbox"
v-model="calcVat"
:disabled="readonly"
/>
<label
class="q-pl-sm"
for="input-calc-vat"
:style="{ opacity: readonly ? '.5' : undefined }"
>
{{ $t('general.calculateVat') }}
</label>
</section>
</div>
</div>
</template>

View file

@ -75,6 +75,7 @@ export default {
about: 'About',
total: 'Total',
discount: 'Discount (Baht)',
calculateVat: 'Calculate VAT',
discountAfterVat: 'Discount after vat',
totalAfterDiscount: 'Total after discount',
totalVatExcluded: 'Tax exemption amount',

View file

@ -76,6 +76,7 @@ export default {
total: 'ยอดรวม',
discount: 'ส่วนลด (บาท)',
discountAfterVat: 'ส่วนลดหลังคำนวณภาษี',
calculateVat: 'คำนวณภาษี',
totalAfterDiscount: 'จำนวนเงินหลังหักส่วนลด',
totalVatExcluded: 'จำนวนเงินยกเว้นภาษี',
totalVatIncluded: 'จำนวนเงินที่คำนวณภาษี',

View file

@ -252,6 +252,7 @@ const formDataProduct = ref<ProductCreate>({
productGroupId: '',
remark: '',
serviceCharge: 0,
calcVat: true,
agentPrice: 0,
price: 0,
process: 0,
@ -982,12 +983,14 @@ async function assignFormDataProduct(data: Product) {
detail: data.detail,
name: data.name,
code: data.code,
calcVat: data.calcVat,
image: undefined,
status: data.status,
expenseType: data.expenseType,
vatIncluded: data.vatIncluded,
selectedImage: data.selectedImage,
};
console.log(data.calcVat);
formDataProduct.value = { ...prevProduct.value };
}
@ -3519,6 +3522,7 @@ watch(
v-model:agent-price="formDataProduct.agentPrice"
v-model:service-charge="formDataProduct.serviceCharge"
v-model:vat-included="formDataProduct.vatIncluded"
v-model:calc-vat="formDataProduct.calcVat"
dense
/>
</div>
@ -3702,6 +3706,7 @@ watch(
v-model:agent-price="formDataProduct.agentPrice"
v-model:service-charge="formDataProduct.serviceCharge"
v-model:vat-included="formDataProduct.vatIncluded"
v-model:calc-vat="formDataProduct.calcVat"
dense
:priceDisplay="priceDisplay"
/>

View file

@ -136,6 +136,7 @@ export interface WorkItems {
export interface Product {
selectedImage?: string;
calcVat: boolean;
expenseType: string;
vatIncluded: boolean;
remark: string;
@ -164,6 +165,7 @@ export interface ProductCreate {
productGroupId: string;
remark: string;
serviceCharge: number;
calcVat?: boolean;
agentPrice: number;
price: number;
process: number;
@ -181,6 +183,7 @@ export interface ProductUpdate {
serviceCharge: number;
agentPrice: number;
price: number;
calcVat?: boolean;
process: string;
detail: string;
name: string;