diff --git a/apps/wr/app/stats/rainStat/page.tsx b/apps/wr/app/stats/rainStat/page.tsx index 8e9722dd7..08990028f 100644 --- a/apps/wr/app/stats/rainStat/page.tsx +++ b/apps/wr/app/stats/rainStat/page.tsx @@ -144,8 +144,19 @@ export default function RainStat() { }); const sidoSummaryList = Array.from(sidoDataMap.values()); + const sidoTotalSummary = [['전체', '', '합계', 0, '', '', 0, '', '', 0, 0, 0, 0, 0, 0, '', 0]]; + sidoSummaryList.forEach((item: (string | number)[]) => { + item.forEach((value: string | number, index: number) => { + if(typeof value === 'number') { + if (sidoTotalSummary[0] && index < sidoTotalSummary[0].length) { + sidoTotalSummary[0][index] = Number(sidoTotalSummary[0][index]) + Number(value); + } + } + }); + }); + // sidoSummaryList와 rainDetailList를 합쳐서 엑셀 데이터 생성 - const excelData = [...sidoSummaryList, ...summaryExcelData]; + const excelData = [...sidoTotalSummary, ...sidoSummaryList, ...summaryExcelData]; excelDownload( excelData as unknown as [][], diff --git a/apps/wr/app/stats/rswtStat/page.tsx b/apps/wr/app/stats/rswtStat/page.tsx index 427df07fb..c0741433c 100644 --- a/apps/wr/app/stats/rswtStat/page.tsx +++ b/apps/wr/app/stats/rswtStat/page.tsx @@ -113,7 +113,7 @@ export default function RswtStat() { } sidoDetailMap.get(sidoText)!.push(item as unknown as (string | number)[]); } - + // 시도별 합계 데이터 수집 if (sidoText && !sidoList.has(sidoText)) { sidoList.add(sidoText); @@ -197,8 +197,19 @@ export default function RswtStat() { }); const sidoSummaryList = Array.from(sidoDataMap.values()); + const sidoTotalSummary = [['전체', '', '합계', 0, '', '', 0, '', '', 0, 0, 0, 0, 0, 0, '', 0]]; + sidoSummaryList.forEach((item: (string | number)[]) => { + item.forEach((value: string | number, index: number) => { + if(typeof value === 'number') { + if (sidoTotalSummary[0] && index < sidoTotalSummary[0].length) { + sidoTotalSummary[0][index] = Number(sidoTotalSummary[0][index]) + Number(value); + } + } + }); + }); + // sidoSummaryList와 rainDetailList를 합쳐서 엑셀 데이터 생성 - const excelData = [...sidoSummaryList, ...summaryExcelData]; + const excelData = [...sidoTotalSummary,...sidoSummaryList, ...summaryExcelData]; excelDownload( excelData as unknown as [][],