From 32459b4a1d02db1f9313bc89da293499fe09154d Mon Sep 17 00:00:00 2001 From: leoho2fi Date: Fri, 26 Apr 2024 14:21:59 +0800 Subject: [PATCH] add test data --- .../Report/ReportSearchBox/SearchBox.tsx | 11 +++++++++++ .../Report/ReportSearchBox2/SearchBox2.tsx | 11 +++++++++++ .../Report/ReportSearchBox3/SearchBox3.tsx | 11 +++++++++++ .../Report/ReportSearchBox4/SearchBox4.tsx | 11 +++++++++++ .../Report/ReportSearchBox5/SearchBox5.tsx | 11 +++++++++++ .../Report/ReportSearchBox6/SearchBox6.tsx | 14 ++++++++++++++ 6 files changed, 69 insertions(+) diff --git a/src/components/Report/ReportSearchBox/SearchBox.tsx b/src/components/Report/ReportSearchBox/SearchBox.tsx index 83e3aab..26a5016 100644 --- a/src/components/Report/ReportSearchBox/SearchBox.tsx +++ b/src/components/Report/ReportSearchBox/SearchBox.tsx @@ -192,6 +192,17 @@ function SearchBox({ } } + const firstTableData = [ + ['Column1', 'Column2', 'Column3'], // Row 1 + ['Data1', 'Data2', 'Data3'], // Row 2 + // ... more rows as needed + ]; + // Find the last row of the first table + let lastRowOfFirstTable = 6; // Starting row for data in the first table + while (worksheet[XLSX.utils.encode_cell({ c: 0, r: lastRowOfFirstTable })]) { + lastRowOfFirstTable++; + } + // Format filename with date const today = new Date().toISOString().split('T')[0].replace(/-/g, '_'); // Get current date and format as YYYY_MM_DD const filename = `AR01_Late_Start_Report_${today}.xlsx`; // Append formatted date to the filename diff --git a/src/components/Report/ReportSearchBox2/SearchBox2.tsx b/src/components/Report/ReportSearchBox2/SearchBox2.tsx index d9436a4..39364dd 100644 --- a/src/components/Report/ReportSearchBox2/SearchBox2.tsx +++ b/src/components/Report/ReportSearchBox2/SearchBox2.tsx @@ -192,6 +192,17 @@ function SearchBox({ } } + const firstTableData = [ + ['Column1', 'Column2', 'Column3'], // Row 1 + ['Data1', 'Data2', 'Data3'], // Row 2 + // ... more rows as needed + ]; + // Find the last row of the first table + let lastRowOfFirstTable = 6; // Starting row for data in the first table + while (worksheet[XLSX.utils.encode_cell({ c: 0, r: lastRowOfFirstTable })]) { + lastRowOfFirstTable++; + } + // Format filename with date const today = new Date().toISOString().split('T')[0].replace(/-/g, '_'); // Get current date and format as YYYY_MM_DD const filename = `AR02_Delay_Report_${today}.xlsx`; // Append formatted date to the filename diff --git a/src/components/Report/ReportSearchBox3/SearchBox3.tsx b/src/components/Report/ReportSearchBox3/SearchBox3.tsx index 5fe1867..bd524b2 100644 --- a/src/components/Report/ReportSearchBox3/SearchBox3.tsx +++ b/src/components/Report/ReportSearchBox3/SearchBox3.tsx @@ -192,6 +192,17 @@ function SearchBox({ } } + const firstTableData = [ + ['Column1', 'Column2', 'Column3'], // Row 1 + ['Data1', 'Data2', 'Data3'], // Row 2 + // ... more rows as needed + ]; + // Find the last row of the first table + let lastRowOfFirstTable = 6; // Starting row for data in the first table + while (worksheet[XLSX.utils.encode_cell({ c: 0, r: lastRowOfFirstTable })]) { + lastRowOfFirstTable++; + } + // Format filename with date const today = new Date().toISOString().split('T')[0].replace(/-/g, '_'); // Get current date and format as YYYY_MM_DD const filename = `AR03_Resource_Overconsumption_${today}.xlsx`; // Append formatted date to the filename diff --git a/src/components/Report/ReportSearchBox4/SearchBox4.tsx b/src/components/Report/ReportSearchBox4/SearchBox4.tsx index a0df1a3..2f57320 100644 --- a/src/components/Report/ReportSearchBox4/SearchBox4.tsx +++ b/src/components/Report/ReportSearchBox4/SearchBox4.tsx @@ -192,6 +192,17 @@ function SearchBox({ } } + const firstTableData = [ + ['Column1', 'Column2', 'Column3'], // Row 1 + ['Data1', 'Data2', 'Data3'], // Row 2 + // ... more rows as needed + ]; + // Find the last row of the first table + let lastRowOfFirstTable = 6; // Starting row for data in the first table + while (worksheet[XLSX.utils.encode_cell({ c: 0, r: lastRowOfFirstTable })]) { + lastRowOfFirstTable++; + } + // Format filename with date const today = new Date().toISOString().split('T')[0].replace(/-/g, '_'); // Get current date and format as YYYY_MM_DD const filename = `AR04_Cost_and_Expense_Report_${today}.xlsx`; // Append formatted date to the filename diff --git a/src/components/Report/ReportSearchBox5/SearchBox5.tsx b/src/components/Report/ReportSearchBox5/SearchBox5.tsx index b252103..207e5ff 100644 --- a/src/components/Report/ReportSearchBox5/SearchBox5.tsx +++ b/src/components/Report/ReportSearchBox5/SearchBox5.tsx @@ -192,6 +192,17 @@ function SearchBox({ } } + const firstTableData = [ + ['Column1', 'Column2', 'Column3'], // Row 1 + ['Data1', 'Data2', 'Data3'], // Row 2 + // ... more rows as needed + ]; + // Find the last row of the first table + let lastRowOfFirstTable = 5; // Starting row for data in the first table + while (worksheet[XLSX.utils.encode_cell({ c: 0, r: lastRowOfFirstTable })]) { + lastRowOfFirstTable++; + } + // Format filename with date const today = new Date().toISOString().split('T')[0].replace(/-/g, '_'); // Get current date and format as YYYY_MM_DD const filename = `AR05_Project_Completion_Report_${today}.xlsx`; // Append formatted date to the filename diff --git a/src/components/Report/ReportSearchBox6/SearchBox6.tsx b/src/components/Report/ReportSearchBox6/SearchBox6.tsx index 1f201b1..82d5df4 100644 --- a/src/components/Report/ReportSearchBox6/SearchBox6.tsx +++ b/src/components/Report/ReportSearchBox6/SearchBox6.tsx @@ -192,6 +192,20 @@ function SearchBox({ } } + const firstTableData = [ + ['Column1', 'Column2', 'Column3'], // Row 1 + ['Data1', 'Data2', 'Data3'], // Row 2 + // ... more rows as needed + ]; + // Find the last row of the first table + let lastRowOfFirstTable = 5; // Starting row for data in the first table + while (worksheet[XLSX.utils.encode_cell({ c: 0, r: lastRowOfFirstTable })]) { + lastRowOfFirstTable++; + } + + // Insert the first data form into the worksheet at the desired location + XLSX.utils.sheet_add_aoa(worksheet, firstTableData, { origin: { c: 0, r: lastRowOfFirstTable } }); + // Format filename with date const today = new Date().toISOString().split('T')[0].replace(/-/g, '_'); // Get current date and format as YYYY_MM_DD const filename = `AR06_Project_Completion_Report_with_Outstanding_Un-billed_Hours_${today}.xlsx`; // Append formatted date to the filename