feat: add more field
Some checks failed
Spell Check / Spell Check with Typos (push) Failing after 5s

This commit is contained in:
Methapon2001 2025-03-06 17:33:09 +07:00
parent 5278f4952e
commit 35fd79634a
6 changed files with 133 additions and 39 deletions

View file

@ -1350,39 +1350,39 @@ export default {
}, },
}, },
report: { report: {
report: { title: 'Report',
title: 'Report', value: 'Value',
view: { customerName: 'Customer Name',
Document: 'Document Status Report', view: {
Invoice: 'Payment Report', Document: 'Document Status Report',
Product: 'Product and Service Report', Invoice: 'Payment Report',
Sale: 'Sales Summary Report', Product: 'Product and Service Report',
}, Sale: 'Sales Summary Report',
document: { },
code: 'Code', document: {
status: 'Quotation Status', code: 'Code',
createAt: 'Created Date', status: 'Quotation Status',
updateAt: 'Updated Date', createAt: 'Created Date',
}, updateAt: 'Updated Date',
table: { },
code: 'Code', table: {
status: 'Status', code: 'Code',
createAt: 'Created Date', status: 'Status',
}, createAt: 'Created Date',
product: { },
did: 'Processed Quantity', product: {
sale: 'Sold Quantity', did: 'Processed Quantity',
name: 'Product Name', sale: 'Sold Quantity',
code: 'Product Code', name: 'Product Name',
}, code: 'Product Code',
sale: { },
byCustomer: 'Sales by Branch', sale: {
byProductGroup: 'Sales by Product Category', byCustomer: 'Sales by Branch',
bySale: 'Sales by Salesperson', byProductGroup: 'Sales by Product Category',
code: 'Code', bySale: 'Sales by Salesperson',
name: 'Name', code: 'Code',
count: 'Sold Quantity', name: 'Name',
}, count: 'Sold Quantity',
}, },
}, },
dashboard: { dashboard: {

View file

@ -1331,6 +1331,8 @@ export default {
report: { report: {
title: 'รายงาน', title: 'รายงาน',
customerName: 'ชื่อลูกค้า',
value: 'มูลค่า',
view: { view: {
Document: 'รายงานสถานะเอกสาร', Document: 'รายงานสถานะเอกสาร',
Invoice: 'รายงานการชำระเงิน', Invoice: 'รายงานการชำระเงิน',

View file

@ -181,7 +181,19 @@ watch([() => pageState.currentTab], async () => {
<template #main> <template #main>
<TableReport <TableReport
:row="dataReportQuotation" :row="
dataReportQuotation.map((v) => ({
...v,
name:
v.customerBranch.customer.customerType === 'CORP'
? $i18n.locale === 'eng'
? v.customerBranch.registerNameEN
: v.customerBranch.registerName
: $i18n.locale === 'eng'
? `${v.customerBranch.firstNameEN} ${v.customerBranch.lastNameEN}`
: `${v.customerBranch.firstName} ${v.customerBranch.lastName}`,
}))
"
:columns="colReportQuotation" :columns="colReportQuotation"
> >
<template #status="{ item }"> <template #status="{ item }">
@ -208,7 +220,22 @@ watch([() => pageState.currentTab], async () => {
</div> </div>
</template> </template>
<template #main> <template #main>
<TableReport :row="dataReportInvoice" :columns="colReport"> <TableReport
:row="
dataReportInvoice.map((v) => ({
...v,
name:
v.customerBranch.customer.customerType === 'CORP'
? $i18n.locale === 'eng'
? v.customerBranch.registerNameEN
: v.customerBranch.registerName
: $i18n.locale === 'eng'
? `${v.customerBranch.firstNameEN} ${v.customerBranch.lastNameEN}`
: `${v.customerBranch.firstName} ${v.customerBranch.lastName}`,
}))
"
:columns="colReport"
>
<template #status="{ item }"> <template #status="{ item }">
<BadgeComponent <BadgeComponent
:title="$t(`invoice.status.${item.row.status}`)" :title="$t(`invoice.status.${item.row.status}`)"
@ -233,7 +260,22 @@ watch([() => pageState.currentTab], async () => {
</div> </div>
</template> </template>
<template #main> <template #main>
<TableReport :row="dataReportReceipt" :columns="colReport"> <TableReport
:row="
dataReportReceipt.map((v) => ({
...v,
name:
v.customerBranch.customer.customerType === 'CORP'
? $i18n.locale === 'eng'
? v.customerBranch.registerNameEN
: v.customerBranch.registerName
: $i18n.locale === 'eng'
? `${v.customerBranch.firstNameEN} ${v.customerBranch.lastNameEN}`
: `${v.customerBranch.firstName} ${v.customerBranch.lastName}`,
}))
"
:columns="colReport"
>
<template #status="{ item }"> <template #status="{ item }">
<BadgeComponent <BadgeComponent
:title="$t(`invoice.status.${item.row.status}`)" :title="$t(`invoice.status.${item.row.status}`)"
@ -260,7 +302,22 @@ watch([() => pageState.currentTab], async () => {
</div> </div>
</template> </template>
<template #main> <template #main>
<TableReport :row="dataReportInvoice" :columns="colReport"> <TableReport
:row="
dataReportInvoice.map((v) => ({
...v,
name:
v.customerBranch.customer.customerType === 'CORP'
? $i18n.locale === 'eng'
? v.customerBranch.registerNameEN
: v.customerBranch.registerName
: $i18n.locale === 'eng'
? `${v.customerBranch.firstNameEN} ${v.customerBranch.lastNameEN}`
: `${v.customerBranch.firstName} ${v.customerBranch.lastName}`,
}))
"
:columns="colReport"
>
<template #status="{ item }"> <template #status="{ item }">
<BadgeComponent <BadgeComponent
:title="$t(`invoice.status.${item.row.status}`)" :title="$t(`invoice.status.${item.row.status}`)"
@ -317,7 +374,9 @@ watch([() => pageState.currentTab], async () => {
code: v.code, code: v.code,
name: name:
v.customer.customerType === 'CORP' v.customer.customerType === 'CORP'
? v.customerName ? $i18n.locale === 'eng'
? v.registerNameEN
: v.registerName
: $i18n.locale === 'eng' : $i18n.locale === 'eng'
? `${v.firstNameEN} ${v.lastNameEN}` ? `${v.firstNameEN} ${v.lastNameEN}`
: `${v.firstName} ${v.lastName}`, : `${v.firstName} ${v.lastName}`,

View file

@ -32,7 +32,12 @@ const prop = withDefaults(
style="background-color: hsla(var(--info-bg) / 0.07)" style="background-color: hsla(var(--info-bg) / 0.07)"
:props="props" :props="props"
> >
<q-th v-for="col in columns" :key="col.name" :props="props"> <q-th
v-for="col in columns"
style="text-align: center"
:key="col.name"
:props="props"
>
{{ $t(col.label) }} {{ $t(col.label) }}
</q-th> </q-th>
</q-tr> </q-tr>

View file

@ -41,6 +41,18 @@ export const colReportQuotation = [
label: 'report.document.status', label: 'report.document.status',
field: '', field: '',
}, },
{
name: 'customer',
align: 'left',
label: 'report.customerName',
field: 'name',
},
{
name: 'amount',
align: 'left',
label: 'report.value',
field: (data: ReportQuotation) => formatNumberDecimal(data.amount, 2),
},
{ {
name: 'createAt', name: 'createAt',
align: 'center', align: 'center',
@ -68,6 +80,18 @@ export const colReport = [
label: 'report.table.status', label: 'report.table.status',
field: '', field: '',
}, },
{
name: 'customer',
align: 'left',
label: 'report.customerName',
field: 'name',
},
{
name: 'amount',
align: 'left',
label: 'report.value',
field: (data: Report) => formatNumberDecimal(data.amount, 2),
},
{ {
name: 'createAt', name: 'createAt',
align: 'center', align: 'center',

View file

@ -5,8 +5,10 @@ import { CustomerBranch } from '../customer';
import { PaymentDataStatus } from '../payment/types'; import { PaymentDataStatus } from '../payment/types';
export type ReportQuotation = { export type ReportQuotation = {
customerBranch: CustomerBranch;
updatedAt: Date | null; updatedAt: Date | null;
createdAt: Date | null; createdAt: Date | null;
amount: number;
status: QuotationStatus; status: QuotationStatus;
code: string; code: string;
}; };
@ -20,7 +22,9 @@ export enum Status {
// use with Invoice and Receipt // use with Invoice and Receipt
export type Report = { export type Report = {
customerBranch: CustomerBranch;
createdAt: Date | null; createdAt: Date | null;
amount: number;
status: Status; status: Status;
code: string; code: string;
}; };