From 2e32ad28d79ab5543e1f43d9a26b3c89e56cecbf Mon Sep 17 00:00:00 2001 From: Thanaphon Frappet Date: Wed, 5 Mar 2025 16:36:54 +0700 Subject: [PATCH 1/4] feat: add i18n --- src/i18n/eng.ts | 40 ++++++++++++++++++++++++++++++++++++++++ src/i18n/tha.ts | 39 +++++++++++++++++++++++++++++++++++++++ 2 files changed, 79 insertions(+) diff --git a/src/i18n/eng.ts b/src/i18n/eng.ts index c822240c..3b7d494a 100644 --- a/src/i18n/eng.ts +++ b/src/i18n/eng.ts @@ -1336,4 +1336,44 @@ export default { Succeed: 'Completed', }, }, + + report: { + report: { + title: 'Report', + view: { + Document: 'Document Status Report', + Invoice: 'Payment Report', + Product: 'Product and Service Report', + admin: { + Product: 'Product Movement Report', + Sale: 'Sales Summary Report', + }, + }, + document: { + code: 'Code', + status: 'Quotation Status', + createAt: 'Created Date', + updateAt: 'Updated Date', + }, + table: { + code: 'Code', + status: 'Status', + createAt: 'Created Date', + }, + product: { + did: 'Processed Quantity', + sale: 'Sold Quantity', + name: 'Product Name', + code: 'Product Code', + }, + sale: { + byCustomer: 'Sales by Branch', + byProductGroup: 'Sales by Product Category', + bySale: 'Sales by Salesperson', + code: 'Code', + name: 'Name', + count: 'Sold Quantity', + }, + }, + }, }; diff --git a/src/i18n/tha.ts b/src/i18n/tha.ts index c3205cbc..8657680f 100644 --- a/src/i18n/tha.ts +++ b/src/i18n/tha.ts @@ -1315,4 +1315,43 @@ export default { Succeed: 'เสร็จสิ้น', }, }, + + report: { + title: 'รายงาน', + view: { + Document: 'รายงานสถานะเอกสาร', + Invoice: 'รายงานการชำระเงิน', + Product: 'รายงานสินค้าและบริการ', + admin: { + Product: 'รายงานการเคลื่อนไหวของสินค้า', + Sale: 'รายงานสรุปยอดขาย', + }, + }, + document: { + code: 'รหัส', + status: 'สถานะใบเสนอราคา', + createAt: 'วันที่สร้าง', + updateAt: 'วันที่แก้ไข', + }, + table: { + code: 'รหัส', + status: 'สถานะ', + createAt: 'วันที่สร้าง', + }, + product: { + did: 'จำนวนที่ออกไปดำเนินการ', + sale: 'จำนวนที่ขายออกไป', + name: 'ชื่อสินค้า', + code: 'รหัสสินค้า', + }, + + sale: { + byCustomer: 'ยอดขายตามสาขา', + byProductGroup: 'ยอดขายตามประเภทสินค้า', + bySale: 'ยอดขายตามพนักงานขาย', + code: 'รหัส', + name: 'ชื่อ', + count: 'จำนวนที่ขาย', + }, + }, }; From ba10fc960932860f594ebc9969654b462443c657 Mon Sep 17 00:00:00 2001 From: Thanaphon Frappet Date: Wed, 5 Mar 2025 16:37:53 +0700 Subject: [PATCH 2/4] feat: set constant variable --- src/pages/14_report/constants.ts | 153 +++++++++++++++++++++++++++++++ 1 file changed, 153 insertions(+) create mode 100644 src/pages/14_report/constants.ts diff --git a/src/pages/14_report/constants.ts b/src/pages/14_report/constants.ts new file mode 100644 index 00000000..fc2b9883 --- /dev/null +++ b/src/pages/14_report/constants.ts @@ -0,0 +1,153 @@ +import { QTableProps } from 'quasar'; +import { Invoice, Receipt } from 'src/stores/payment/types'; +import { + Report, + ReportProduct, + ReportQuotation, +} from 'src/stores/report/types'; +import { formatNumberDecimal } from 'src/stores/utils'; +import { dateFormatJS } from 'src/utils/datetime'; + +export enum ViewMode { + Document = 'document', + Invoice = 'invoice', + Receipt = 'receipt', + Product = 'product', + Sale = 'sale', +} + +type ColumnsSale = { + code: string; + name: string; + _count: number; +}; + +type ColumnsBySale = ColumnsSale & { + url?: string; + id?: string; + gender?: string; +}; + +export const colReportQuotation = [ + { + name: 'code', + align: 'center', + label: 'report.document.code', + field: (data: ReportQuotation) => data.code, + }, + { + name: '#status', + align: 'center', + label: 'report.document.status', + field: '', + }, + { + name: 'createAt', + align: 'center', + label: 'report.document.createAt', + field: (data: ReportQuotation) => dateFormatJS({ date: data.createdAt }), + }, + { + name: 'updateAt', + align: 'center', + label: 'report.document.updateAt', + field: (data: ReportQuotation) => dateFormatJS({ date: data.updatedAt }), + }, +] as const satisfies QTableProps['columns']; + +export const colReport = [ + { + name: 'code', + align: 'center', + label: 'report.table.code', + field: (data: Report) => data.code, + }, + { + name: '#status', + align: 'center', + label: 'report.table.status', + field: '', + }, + { + name: 'createAt', + align: 'center', + label: 'report.table.createAt', + field: (data: Report) => dateFormatJS({ date: data.createdAt }), + }, +] as const satisfies QTableProps['columns']; + +export const colReportProduct = [ + { + name: 'code', + align: 'center', + label: 'report.product.code', + field: (data: ReportProduct) => data.code, + }, + { + name: 'name', + align: 'center', + label: 'report.product.name', + field: (data: ReportProduct) => data.name, + }, + { + name: 'sale', + align: 'center', + label: 'report.product.sale', + field: (data: ReportProduct) => data.sale, + }, + { + name: 'did', + align: 'center', + label: 'report.product.did', + field: (data: ReportProduct) => data.did, + }, +] as const satisfies QTableProps['columns']; + +export const colReportSale = [ + { + name: 'code', + align: 'left', + label: 'report.sale.code', + field: (data: ColumnsSale) => data.code, + }, + { + name: '#name', + align: 'left', + label: 'report.sale.name', + field: '', + }, + { + name: 'count', + align: 'center', + label: 'report.sale.count', + field: (data: ColumnsSale) => data._count, + }, +] as const satisfies QTableProps['columns']; + +export const colReportBySale = [ + { + name: 'code', + align: 'left', + label: 'report.sale.code', + field: (data: ColumnsBySale) => data.code, + }, + { + name: '#name', + align: 'left', + label: 'report.sale.name', + field: '', + }, + { + name: 'count', + align: 'center', + label: 'report.sale.count', + field: (data: ColumnsBySale) => data._count, + }, +] as const satisfies QTableProps['columns']; + +export const pageTabs = [ + { label: 'Document', value: ViewMode.Document, by: ['user'] }, + { label: 'Invoice', value: ViewMode.Invoice, by: ['user'] }, + { label: 'Product', value: ViewMode.Product, by: ['user', 'admin'] }, + { label: 'Sale', value: ViewMode.Sale, by: ['admin'] }, +]; From 7f14e6be46316f726324fd75643b8ea6c2288b19 Mon Sep 17 00:00:00 2001 From: Thanaphon Frappet Date: Wed, 5 Mar 2025 16:39:20 +0700 Subject: [PATCH 3/4] feat: new Table and expansion --- src/components/14_report/Expansion.vue | 29 ++++++++++ src/pages/14_report/Table/TableReport.vue | 64 +++++++++++++++++++++++ 2 files changed, 93 insertions(+) create mode 100644 src/components/14_report/Expansion.vue create mode 100644 src/pages/14_report/Table/TableReport.vue diff --git a/src/components/14_report/Expansion.vue b/src/components/14_report/Expansion.vue new file mode 100644 index 00000000..581c677b --- /dev/null +++ b/src/components/14_report/Expansion.vue @@ -0,0 +1,29 @@ + + + + + diff --git a/src/pages/14_report/Table/TableReport.vue b/src/pages/14_report/Table/TableReport.vue new file mode 100644 index 00000000..29214126 --- /dev/null +++ b/src/pages/14_report/Table/TableReport.vue @@ -0,0 +1,64 @@ + + From 724f71ae4f2a5ab6fb1f4314a030210e8081b1fa Mon Sep 17 00:00:00 2001 From: Thanaphon Frappet Date: Wed, 5 Mar 2025 16:40:47 +0700 Subject: [PATCH 4/4] refactor: import and bind value --- src/pages/14_report/MainPage.vue | 346 ++++++++++++++++++++++++++++++- 1 file changed, 342 insertions(+), 4 deletions(-) diff --git a/src/pages/14_report/MainPage.vue b/src/pages/14_report/MainPage.vue index 7f3a32b7..b8464197 100644 --- a/src/pages/14_report/MainPage.vue +++ b/src/pages/14_report/MainPage.vue @@ -1,24 +1,362 @@