|
- export type FieldType = 'date' | 'text' | 'select' | 'number';
-
- import { NEXT_PUBLIC_API_URL } from "@/config/api";
-
- export interface ReportField {
- label: string;
- name: string;
- type: FieldType;
- placeholder?: string;
- required: boolean;
- options?: { label: string; value: string }[]; // For select types
- multiple?: boolean; // For select types - allow multiple selection
- dynamicOptions?: boolean; // For select types - load options dynamically
- dynamicOptionsEndpoint?: string; // API endpoint to fetch dynamic options
- dynamicOptionsParam?: string; // Parameter name to pass when fetching options
- allowInput?: boolean; // Allow user to input custom values (for select types)
- }
-
- export interface ReportDefinition {
- id: string;
- title: string;
- apiEndpoint: string;
- fields: ReportField[];
- }
-
- export const REPORTS: ReportDefinition[] = [
- //{
- // id: "rep-001",
- // title: "報告 1",
- // apiEndpoint: `${NEXT_PUBLIC_API_URL}/report/print-report1`,
- // fields: [
- // { label: "From Date", name: "fromDate", type: "date", required: true }, // Mandatory
- // { label: "To Date", name: "toDate", type: "date", required: true }, // Mandatory
- // { label: "Item Code", name: "itemCode", type: "text", required: false, placeholder: "e.g. FG"},
- // { label: "Item Type", name: "itemType", type: "select", required: false,
- // options: [
- // { label: "FG", value: "FG" },
- // { label: "Material", value: "Mat" }
- // ] },
- // ]
- //},
- //{
- // id: "rep-002",
- // title: "報告 2",
- // apiEndpoint: `${NEXT_PUBLIC_API_URL}/report/print-report2`,
- // fields: [
- // { label: "Target Date", name: "targetDate", type: "date", required: false },
- // { label: "Item Code", name: "itemCode", type: "text", required: false },
- // { label: "Shift", name: "shift", type: "select", options: [
- // { label: "Day", value: "D" },
- // { label: "Night", value: "N" }
- // ], required: false}
- // ]
- //},
- //{
- // id: "rep-003",
- // title: "報告 3",
- // apiEndpoint: `${NEXT_PUBLIC_API_URL}/report/print-report3`,
- // fields: [
- // { label: "From Date", name: "fromDate", type: "date", required: true }, // Mandatory
- // { label: "To Date", name: "toDate", type: "date", required: true }, // Mandatory
- // { label: "Item Code", name: "itemCode", type: "text", required: false, placeholder: "e.g. FG"},
- // { label: "Item Type", name: "itemType", type: "select", required: false,
- // options: [
- // { label: "FG", value: "FG" },
- // { label: "Material", value: "Mat" }
- // ] },
- // ]
- //},
- {
- id: "rep-004",
- title: "入倉追蹤報告",
- apiEndpoint: `${NEXT_PUBLIC_API_URL}/report/print-stock-in-traceability`,
- fields: [
-
- { label: "入倉日期:由 Last In Date Start", name: "lastInDateStart", type: "date", required: true },
- { label: "入倉日期:至 Last In Date End", name: "lastInDateEnd", type: "date", required: true },
- { label: "物料編號 Item Code", name: "itemCode", type: "text", required: false},
- ]
- },
- {
- id: "rep-008",
- title: "成品出倉報告",
- apiEndpoint: `${NEXT_PUBLIC_API_URL}/report/print-fg-delivery-report`,
- fields: [
- { label: "出貨日期:由 Last Out Date Start", name: "lastOutDateStart", type: "date", required: false },
- { label: "出貨日期:至 Last Out Date End", name: "lastOutDateEnd", type: "date", required: false },
- { label: "年份 Year", name: "year", type: "text", required: false, placeholder: "e.g. 2026" },
- { label: "物料編號 Item Code", name: "itemCode", type: "text", required: false},
- ]
- },
-
- { id: "rep-012",
- title: "庫存盤點報告",
- apiEndpoint: `${NEXT_PUBLIC_API_URL}/report/print-stock-take-variance`,
- fields: [
- { label: "庫存日期:由 Last In Date Start", name: "lastInDateStart", type: "date", required: false },
- { label: "庫存日期:至 Last In Date End", name: "lastInDateEnd", type: "date", required: false },
- { label: "物料編號 Item Code", name: "itemCode", type: "text", required: false},
- ]
- },
-
- { id: "rep-011",
- title: "庫存明細報告",
- apiEndpoint: `${NEXT_PUBLIC_API_URL}/report/print-stock-ledger`,
- fields: [
- { label: "庫存日期:由 Last In Date Start", name: "lastInDateStart", type: "date", required: false },
- { label: "庫存日期:至 Last In Date End", name: "lastInDateEnd", type: "date", required: false },
- { label: "物料編號 Item Code", name: "itemCode", type: "text", required: false},
- ]
- },
-
- {
- id: "rep-007",
- title: "庫存結餘報告",
- apiEndpoint: `${NEXT_PUBLIC_API_URL}/report/print-stock-balance`,
- fields: [
- { label: "物料編號 Item Code", name: "itemCode", type: "text", required: false},
- ]
- },
-
- { id: "rep-009",
- title: "成品出倉追蹤報告",
- apiEndpoint: `${NEXT_PUBLIC_API_URL}/report/print-fg-stock-out-traceability`,
- fields: [
- { label: "出貨日期:由 Last Out Date Start", name: "lastOutDateStart", type: "date", required: false },
- { label: "出貨日期:至 Last Out Date End", name: "lastOutDateEnd", type: "date", required: false },
- { label: "物料編號 Item Code", name: "itemCode", type: "text", required: false},
- { label: "提料人 Handler", name: "handler", type: "select", required: false,
- multiple: true,
- dynamicOptions: true,
- dynamicOptionsEndpoint: `${NEXT_PUBLIC_API_URL}/report/fg-stock-out-traceability-handlers`,
- options: [] },
- ]
- },
-
- { id: "rep-010",
- title: "庫存品質檢測報告",
- apiEndpoint: `${NEXT_PUBLIC_API_URL}/report/print-item-qc-fail`,
- fields: [
-
- { label: "QC 不合格日期:由 Last In Date Start", name: "lastInDateStart", type: "date", required: false },
- { label: "QC 不合格日期:至 Last In Date End", name: "lastInDateEnd", type: "date", required: false },
- { label: "物料編號 Item Code", name: "itemCode", type: "text", required: false},
- ]
- },
- { id: "rep-013",
- title: "物料出倉追蹤報告",
- apiEndpoint: `${NEXT_PUBLIC_API_URL}/report/print-material-stock-out-traceability`,
- fields: [
- { label: "庫存日期:由 Last In Date Start", name: "lastInDateStart", type: "date", required: false },
- { label: "庫存日期:至 Last In Date End", name: "lastInDateEnd", type: "date", required: false },
- { label: "物料編號 Item Code", name: "itemCode", type: "text", required: false},
- { label: "提料人 Handler", name: "handler", type: "select", required: false,
- multiple: true,
- dynamicOptions: true,
- dynamicOptionsEndpoint: `${NEXT_PUBLIC_API_URL}/report/material-stock-out-traceability-handlers`,
- options: [] },
- ]
- },
- {
- id: "rep-006",
- title: "庫存材料消耗趨勢報告",
- apiEndpoint: `${NEXT_PUBLIC_API_URL}/report/print-stock-item-consumption-trend`,
- fields: [
- { label: "材料消耗日期:由 Last Out Date Start", name: "lastOutDateStart", type: "date", required: false },
- { label: "材料消耗日期:至 Last Out Date End", name: "lastOutDateEnd", type: "date", required: false },
- { label: "年份 Year", name: "year", type: "text", required: false, placeholder: "e.g. 2026" },
- { label: "類別 Category", name: "stockCategory", type: "select", required: false,
- multiple: true,
- options: [
- { label: "All", value: "All" },
- { label: "MAT", value: "MAT" },
- { label: "WIP", value: "WIP" },
- { label: "NM", value: "NM" },
- { label: "FG", value: "FG" },
- { label: "CMB", value: "CMB" }
- ] },
- { label: "物料編號 Item Code", name: "itemCode", type: "select", required: false,
- multiple: true,
- allowInput: true,
- dynamicOptions: true,
- dynamicOptionsEndpoint: `${NEXT_PUBLIC_API_URL}/report/stock-item-code-prefixes`,
- dynamicOptionsParam: "stockCategory",
- options: [] },
- ]
- },
-
- {
- id: "rep-005",
- title: "成品/半成品生產分析報告",
- apiEndpoint: `${NEXT_PUBLIC_API_URL}/report/print-semi-fg-production-analysis`,
- fields: [
- { label: "完成生產日期:由 Last Out Date Start", name: "lastOutDateStart", type: "date", required: false, placeholder: "dd/mm/yyyy" },
- { label: "完成生產日期:至 Last Out Date End", name: "lastOutDateEnd", type: "date", required: false, placeholder: "dd/mm/yyyy" },
- { label: "年份 Year", name: "year", type: "text", required: false, placeholder: "e.g. 2026" },
- { label: "類別 Category", name: "stockCategory", type: "select", required: false,
- multiple: true,
- options: [
- { label: "All", value: "All" },
- { label: "WIP", value: "WIP" },
- { label: "FG", value: "FG" },
- ] },
- { label: "物料編號 Item Code", name: "itemCode", type: "select", required: false,
- multiple: true,
- allowInput: true,
- dynamicOptions: true,
- dynamicOptionsEndpoint: `${NEXT_PUBLIC_API_URL}/report/semi-fg-item-codes`,
- dynamicOptionsParam: "stockCategory",
- options: [] },
- ]
- }
- ]
|