feat: 년 판매현황 엑셀 최상단에 지역/범위·단위·출력일 제목 블록 추가

- export_excel_2003_xml 에 헤더 위 제목행(topRows) 옵션 추가(하위호환)
- 년판매 export: '시도 구군 / 범위', '(단위 : 매/원)', '연도 판매현황 · 대행소', '출력일' 표기

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
taekyoungc
2026-06-25 14:59:53 +09:00
parent 9f16942366
commit 4fef5556ca
2 changed files with 37 additions and 2 deletions

View File

@@ -1284,6 +1284,30 @@ class SalesReport extends BaseController
if ($export) {
$headers = array_merge(['품목', '구분'], array_map(static fn (array $c): string => (string) ($c['label'] ?? ''), $built['colSpec']));
$colCount = count($headers);
// 최상단 제목 블록: (지역/범위) ……… (단위 : 매/원) / (제목) ……… 출력일
$region = trim(
(string) ($lgRow->lg_sido ?? '') . ' ' . (string) ($lgRow->lg_gugun ?? '')
);
if ($region === '') {
$region = $lgName;
}
$makeTopRow = static function (string $left, string $right) use ($colCount): array {
$row = array_fill(0, max($colCount, 1), '');
$row[0] = $left;
if ($right !== '') {
$row[max($colCount - 1, 0)] = $right;
}
return $row;
};
$topRows = [
$makeTopRow($region . ' / ' . $gugunLabel, '(단위 : 매/원)'),
$makeTopRow($year . '년 판매현황 · 대행소: ' . $agencyLabel, '출력일: ' . date('Y-m-d')),
array_fill(0, max($colCount, 1), ''), // 구분용 빈 줄
];
$exportRows = [];
foreach ($built['itemBlocks'] as $block) {
foreach ($block['lines'] as $li) {
@@ -1306,7 +1330,8 @@ class SalesReport extends BaseController
'년판매현황_' . $year . '_' . $exportStamp,
$year . '년판매',
$headers,
$exportRows
$exportRows,
$topRows
);
}