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 agentPrice = defineModel<number>('agentPrice');
const price = defineModel<number>('price'); const price = defineModel<number>('price');
const vatIncluded = defineModel<boolean>('vatIncluded'); const vatIncluded = defineModel<boolean>('vatIncluded');
const calcVat = defineModel<boolean>('calcVat');
const price4Show = ref(''); const price4Show = ref('');
const agentPrice4Show = 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>
</div> </div>
</template> </template>

View file

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

View file

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

View file

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

View file

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