Files
edu/admin/bbs/legal_edu_report_excel.php

615 lines
28 KiB
PHP

<?php
require_once __DIR__ . '/../../bbs/auth.php';
edu_require_login();
require_once __DIR__ . '/../../bbs/db_conn.php';
$search_comp = $_GET['comp'] ?? '';
if (empty($search_comp) && !isset($_GET['comp'])) {
$search_comp = $sys_comp_code;
}
$search_year = $_GET['year'] ?? date('Y');
// 권한에 따른 법인 제한
if ($auth_level === 'LE10002') {
$search_comp = $sys_comp_code;
}
try {
$pdo = db_conn();
// 1) proc_get_legal_total_report 호출
$stmt_total = $pdo->prepare("CALL proc_get_legal_total_report(?, '', ?)");
$stmt_total->execute([$search_comp, $search_year]);
$total_data = $stmt_total->fetch(PDO::FETCH_ASSOC);
while ($stmt_total->nextRowset()) {}
unset($stmt_total);
// 만약 전체조회 등 데이터가 없을 경우 기본값 세팅
if (!$total_data) {
$total_data = [
'title01' => $search_year . '년 법정의무교육',
'title02' => '교육결과보고서',
'edu_purpose' => '',
'corp_name' => '',
'edu_term' => '',
'edu_category' => '',
'all_user_qty' => 0,
'all_completed_qty' => 0,
'rmks' => ''
];
}
// 2) proc_get_legal_report_by_year_category_sum 호출
$stmt_sum = $pdo->prepare("CALL proc_get_legal_report_by_year_category_sum(?, '', ?)");
$stmt_sum->execute([$search_comp, $search_year]);
$sum_rows = $stmt_sum->fetchAll(PDO::FETCH_ASSOC);
while ($stmt_sum->nextRowset()) {}
unset($stmt_sum);
// 3) proc_get_legal_report 호출 (과정별 시트 데이터)
$stmt_detail = $pdo->prepare("CALL proc_get_legal_report(?, '', ?)");
$stmt_detail->execute([$search_comp, $search_year]);
$detail_rows = $stmt_detail->fetchAll(PDO::FETCH_ASSOC);
while ($stmt_detail->nextRowset()) {}
unset($stmt_detail);
} catch (Exception $e) {
die("DB Error: " . $e->getMessage());
}
// HTTP Header 설정 - Excel 파일 다운로드 유도
$safe_corp_name = preg_replace('/[\/\\:*?"<>|]/', '', $total_data['corp_name'] ?? '');
$safe_corp_name = trim($safe_corp_name);
if (empty($safe_corp_name)) {
$safe_corp_name = '법정의무교육';
}
$download_filename = $safe_corp_name . "_교육결과보고서_" . date('Ymd') . ".xls";
header("Content-Type: application/vnd.ms-excel; charset=utf-8");
header("Content-Disposition: attachment; filename=\"" . $download_filename . "\"; filename*=UTF-8''" . rawurlencode($download_filename));
header("Expires: 0");
header("Cache-Control: must-revalidate, post-check=0, pre-check=0");
header("Pragma: public");
// XML Spreadsheet 2003 양식 작성 시작
echo '<?xml version="1.0" encoding="utf-8"?>' . "\n";
echo '<?mso-application progid="Excel.Sheet"?>' . "\n";
?>
<Workbook xmlns="urn:schemas-microsoft-com:office:spreadsheet"
xmlns:o="urn:schemas-microsoft-com:office:office"
xmlns:x="urn:schemas-microsoft-com:office:excel"
xmlns:ss="urn:schemas-microsoft-com:office:spreadsheet"
xmlns:html="http://www.w3.org/TR/REC-html40">
<DocumentProperties xmlns="urn:schemas-microsoft-com:office:office">
<Author>Baron Consultant</Author>
<LastAuthor>Baron Consultant</LastAuthor>
<Created><?php echo date('Y-m-d\TH:i:s\Z'); ?></Created>
<Version>16.00</Version>
</DocumentProperties>
<OfficeDocumentSettings xmlns="urn:schemas-microsoft-com:office:office">
<AllowPNG/>
</OfficeDocumentSettings>
<ExcelWorkbook xmlns="urn:schemas-microsoft-com:office:excel">
<WindowHeight>9000</WindowHeight>
<WindowWidth>13600</WindowWidth>
<WindowTopX>0</WindowTopX>
<WindowTopY>0</WindowTopY>
<ProtectStructure>False</ProtectStructure>
<ProtectWindows>False</ProtectWindows>
</ExcelWorkbook>
<Styles>
<!-- 기본 폰트 및 정렬 -->
<Style ss:ID="Default" ss:Name="Normal">
<Alignment ss:Vertical="Center"/>
<Borders/>
<Font ss:FontName="맑은 고딕" x:CharSet="129" ss:Size="10" ss:Color="#000000"/>
<Interior/>
<NumberFormat/>
<Protection/>
</Style>
<!-- 메인 대제목 -->
<Style ss:ID="sMainTitle">
<Alignment ss:Horizontal="Center" ss:Vertical="Center" ss:WrapText="1"/>
<Font ss:FontName="맑은 고딕" ss:Size="18" ss:Bold="1" ss:Color="#111111"/>
</Style>
<!-- 소제목 (1. 교육목적 등) -->
<Style ss:ID="sSecTitle">
<Alignment ss:Horizontal="Left" ss:Vertical="Center"/>
<Font ss:FontName="맑은 고딕" ss:Size="11" ss:Bold="1" ss:Color="#114b3d"/>
</Style>
<!-- 교육목적 단락용 스타일 (자동 줄바꿈, 옅은 회색 배경) -->
<Style ss:ID="sPurposeText">
<Alignment ss:Horizontal="Left" ss:Vertical="Top" ss:WrapText="1"/>
<Borders>
<Border ss:Position="Top" ss:LineStyle="Continuous" ss:Weight="1" ss:Color="#cccccc"/>
<Border ss:Position="Bottom" ss:LineStyle="Continuous" ss:Weight="1" ss:Color="#cccccc"/>
<Border ss:Position="Left" ss:LineStyle="Continuous" ss:Weight="1" ss:Color="#cccccc"/>
<Border ss:Position="Right" ss:LineStyle="Continuous" ss:Weight="1" ss:Color="#cccccc"/>
</Borders>
<Font ss:FontName="맑은 고딕" ss:Size="9.5" ss:Color="#333333"/>
<Interior ss:Color="#fafafa" ss:Pattern="Solid"/>
</Style>
<!-- 테이블 헤더 (진회색 배경) -->
<Style ss:ID="sTblHeader">
<Alignment ss:Horizontal="Center" ss:Vertical="Center" ss:WrapText="1"/>
<Borders>
<Border ss:Position="Top" ss:LineStyle="Continuous" ss:Weight="1" ss:Color="#b2b2b2"/>
<Border ss:Position="Bottom" ss:LineStyle="Continuous" ss:Weight="1" ss:Color="#b2b2b2"/>
<Border ss:Position="Left" ss:LineStyle="Continuous" ss:Weight="1" ss:Color="#b2b2b2"/>
<Border ss:Position="Right" ss:LineStyle="Continuous" ss:Weight="1" ss:Color="#b2b2b2"/>
</Borders>
<Font ss:FontName="맑은 고딕" ss:Size="10" ss:Bold="1" ss:Color="#333333"/>
<Interior ss:Color="#e8ecef" ss:Pattern="Solid"/>
</Style>
<!-- 테이블 헤더 (종합시트용 민트/그린 계열) -->
<Style ss:ID="sTblHeaderTeal">
<Alignment ss:Horizontal="Center" ss:Vertical="Center" ss:WrapText="1"/>
<Borders>
<Border ss:Position="Top" ss:LineStyle="Continuous" ss:Weight="1" ss:Color="#cccccc"/>
<Border ss:Position="Bottom" ss:LineStyle="Continuous" ss:Weight="2" ss:Color="#114b3d"/>
<Border ss:Position="Left" ss:LineStyle="Continuous" ss:Weight="1" ss:Color="#cccccc"/>
<Border ss:Position="Right" ss:LineStyle="Continuous" ss:Weight="1" ss:Color="#cccccc"/>
</Borders>
<Font ss:FontName="맑은 고딕" ss:Size="10" ss:Bold="1" ss:Color="#333333"/>
<Interior ss:Color="#f0f5f4" ss:Pattern="Solid"/>
</Style>
<!-- 테이블 셀 (가운데 정렬, 얇은 테두리) -->
<Style ss:ID="sCellCenter">
<Alignment ss:Horizontal="Center" ss:Vertical="Center" ss:WrapText="1"/>
<Borders>
<Border ss:Position="Top" ss:LineStyle="Continuous" ss:Weight="1" ss:Color="#dddddd"/>
<Border ss:Position="Bottom" ss:LineStyle="Continuous" ss:Weight="1" ss:Color="#dddddd"/>
<Border ss:Position="Left" ss:LineStyle="Continuous" ss:Weight="1" ss:Color="#dddddd"/>
<Border ss:Position="Right" ss:LineStyle="Continuous" ss:Weight="1" ss:Color="#dddddd"/>
</Borders>
<Font ss:FontName="맑은 고딕" ss:Size="10" ss:Color="#333333"/>
</Style>
<!-- 테이블 셀 (좌측 정렬, 얇은 테두리) -->
<Style ss:ID="sCellLeft">
<Alignment ss:Horizontal="Left" ss:Vertical="Center" ss:WrapText="1"/>
<Borders>
<Border ss:Position="Top" ss:LineStyle="Continuous" ss:Weight="1" ss:Color="#dddddd"/>
<Border ss:Position="Bottom" ss:LineStyle="Continuous" ss:Weight="1" ss:Color="#dddddd"/>
<Border ss:Position="Left" ss:LineStyle="Continuous" ss:Weight="1" ss:Color="#dddddd"/>
<Border ss:Position="Right" ss:LineStyle="Continuous" ss:Weight="1" ss:Color="#dddddd"/>
</Borders>
<Font ss:FontName="맑은 고딕" ss:Size="10" ss:Color="#333333"/>
</Style>
<!-- 상세 시트 - 교육내용 박스용 스타일 -->
<Style ss:ID="sDescContent">
<Alignment ss:Horizontal="Left" ss:Vertical="Top" ss:WrapText="1"/>
<Borders>
<Border ss:Position="Top" ss:LineStyle="Continuous" ss:Weight="1" ss:Color="#b2b2b2"/>
<Border ss:Position="Bottom" ss:LineStyle="Continuous" ss:Weight="1" ss:Color="#b2b2b2"/>
<Border ss:Position="Left" ss:LineStyle="Continuous" ss:Weight="1" ss:Color="#b2b2b2"/>
<Border ss:Position="Right" ss:LineStyle="Continuous" ss:Weight="1" ss:Color="#b2b2b2"/>
</Borders>
<Font ss:FontName="맑은 고딕" ss:Size="9.5" ss:Color="#444444"/>
<Interior ss:Color="#fafafa" ss:Pattern="Solid"/>
</Style>
<!-- 하단 팩스/주소 표시용 소형 폰트 -->
<Style ss:ID="sFooter">
<Alignment ss:Horizontal="Center" ss:Vertical="Center"/>
<Font ss:FontName="맑은 고딕" ss:Size="8.5" ss:Color="#666666"/>
</Style>
<!-- "위와 같이 제출합니다" 문장용 -->
<Style ss:ID="sSubmitText">
<Alignment ss:Horizontal="Center" ss:Vertical="Center"/>
<Font ss:FontName="맑은 고딕" ss:Size="11" ss:Bold="1" ss:Color="#111111"/>
</Style>
<!-- 회사명 하단 푸터 -->
<Style ss:ID="sCompanyFooter">
<Alignment ss:Horizontal="Center" ss:Vertical="Center"/>
<Font ss:FontName="맑은 고딕" ss:Size="14" ss:Bold="1" ss:Color="#114b3d"/>
</Style>
<!-- 결재박스 헤더 스타일 -->
<Style ss:ID="sApprHeader">
<Alignment ss:Horizontal="Center" ss:Vertical="Center" ss:WrapText="1"/>
<Borders>
<Border ss:Position="Top" ss:LineStyle="Continuous" ss:Weight="1" ss:Color="#b2b2b2"/>
<Border ss:Position="Bottom" ss:LineStyle="Continuous" ss:Weight="1" ss:Color="#b2b2b2"/>
<Border ss:Position="Left" ss:LineStyle="Continuous" ss:Weight="1" ss:Color="#b2b2b2"/>
<Border ss:Position="Right" ss:LineStyle="Continuous" ss:Weight="1" ss:Color="#b2b2b2"/>
</Borders>
<Font ss:FontName="맑은 고딕" ss:Size="9.5" ss:Color="#333333"/>
<Interior ss:Color="#f5f7f8" ss:Pattern="Solid"/>
</Style>
<!-- 결재박스 세로 병합 "결재" 스타일 -->
<Style ss:ID="sApprVertical">
<Alignment ss:Horizontal="Center" ss:Vertical="Center" ss:WrapText="1"/>
<Borders>
<Border ss:Position="Top" ss:LineStyle="Continuous" ss:Weight="1" ss:Color="#b2b2b2"/>
<Border ss:Position="Bottom" ss:LineStyle="Continuous" ss:Weight="1" ss:Color="#b2b2b2"/>
<Border ss:Position="Left" ss:LineStyle="Continuous" ss:Weight="1" ss:Color="#b2b2b2"/>
<Border ss:Position="Right" ss:LineStyle="Continuous" ss:Weight="1" ss:Color="#b2b2b2"/>
</Borders>
<Font ss:FontName="맑은 고딕" ss:Size="9.5" ss:Bold="1" ss:Color="#333333"/>
<Interior ss:Color="#f5f7f8" ss:Pattern="Solid"/>
</Style>
<!-- 상세시트 결재 및 제목 박스용 세부 스타일 -->
<Style ss:ID="sCourseTitleBlock">
<Alignment ss:Horizontal="Center" ss:Vertical="Center" ss:WrapText="1"/>
<Borders>
<Border ss:Position="Top" ss:LineStyle="Continuous" ss:Weight="1" ss:Color="#b2b2b2"/>
<Border ss:Position="Bottom" ss:LineStyle="Continuous" ss:Weight="1" ss:Color="#b2b2b2"/>
<Border ss:Position="Left" ss:LineStyle="Continuous" ss:Weight="1" ss:Color="#b2b2b2"/>
<Border ss:Position="Right" ss:LineStyle="Continuous" ss:Weight="1" ss:Color="#b2b2b2"/>
</Borders>
<Font ss:FontName="맑은 고딕" ss:Size="14" ss:Bold="1" ss:Color="#111111"/>
<Interior ss:Color="#f5f7f8" ss:Pattern="Solid"/>
</Style>
</Styles>
<!-- ========================================================================= -->
<!-- [시트 1 : 교육결과보고서(종합)] 시작 -->
<!-- ========================================================================= -->
<Worksheet ss:Name="교육결과보고서(종합)">
<Table ss:ExpandedColumnCount="9" ss:ExpandedRowCount="40" x:FullColumns="1" x:FullRows="1" ss:DefaultColumnWidth="54" ss:DefaultRowHeight="20">
<!-- 열 너비 설정 (A: Spacer, B: 헤더/과정명, C-H: 데이터 및 요약) -->
<Column ss:Width="20"/> <!-- A: Spacer -->
<Column ss:Width="130"/> <!-- B -->
<Column ss:Width="100"/> <!-- C -->
<Column ss:Width="80"/> <!-- D -->
<Column ss:Width="80"/> <!-- E -->
<Column ss:Width="80"/> <!-- F -->
<Column ss:Width="80"/> <!-- G -->
<Column ss:Width="80"/> <!-- H -->
<Row ss:Height="10"/> <!-- spacer row -->
<!-- 대제목 -->
<Row ss:Height="25">
<Cell ss:Index="2" ss:MergeAcross="6" ss:StyleID="sMainTitle">
<Data ss:Type="String"><?php echo htmlspecialchars($total_data['title01'] ?? '', ENT_QUOTES, 'UTF-8'); ?></Data>
</Cell>
</Row>
<Row ss:Height="25">
<Cell ss:Index="2" ss:MergeAcross="6" ss:StyleID="sMainTitle">
<Data ss:Type="String"><?php echo htmlspecialchars($total_data['title02'] ?? '', ENT_QUOTES, 'UTF-8'); ?></Data>
</Cell>
</Row>
<Row ss:Height="15"/> <!-- spacer row -->
<!-- 1. 교육목적 -->
<Row ss:Height="20">
<Cell ss:Index="2" ss:MergeAcross="6" ss:StyleID="sSecTitle">
<Data ss:Type="String">1. 교육목적</Data>
</Cell>
</Row>
<Row ss:Height="70">
<Cell ss:Index="2" ss:MergeAcross="6" ss:StyleID="sPurposeText">
<Data ss:Type="String"><?php echo str_replace(["\r\n", "\r", "\n"], "&#10;", htmlspecialchars($total_data['edu_purpose'] ?? '', ENT_QUOTES, 'UTF-8')); ?></Data>
</Cell>
</Row>
<Row ss:Height="15"/> <!-- spacer row -->
<!-- 2. 교육 운영 개요 -->
<Row ss:Height="20">
<Cell ss:Index="2" ss:MergeAcross="6" ss:StyleID="sSecTitle">
<Data ss:Type="String">2. 교육 운영 개요</Data>
</Cell>
</Row>
<Row ss:Height="22">
<Cell ss:Index="2" ss:StyleID="sTblHeader"><Data ss:Type="String">사업장명</Data></Cell>
<Cell ss:MergeAcross="5" ss:StyleID="sCellCenter">
<Data ss:Type="String"><?php echo htmlspecialchars($total_data['corp_name'] ?? '', ENT_QUOTES, 'UTF-8'); ?></Data>
</Cell>
</Row>
<Row ss:Height="22">
<Cell ss:Index="2" ss:StyleID="sTblHeader"><Data ss:Type="String">교육일시</Data></Cell>
<Cell ss:MergeAcross="5" ss:StyleID="sCellCenter">
<Data ss:Type="String"><?php echo htmlspecialchars($total_data['edu_term'] ?? '', ENT_QUOTES, 'UTF-8'); ?></Data>
</Cell>
</Row>
<Row ss:Height="22">
<Cell ss:Index="2" ss:StyleID="sTblHeader"><Data ss:Type="String">교육구분</Data></Cell>
<Cell ss:MergeAcross="5" ss:StyleID="sCellCenter">
<Data ss:Type="String"><?php echo htmlspecialchars($total_data['edu_category'] ?? '', ENT_QUOTES, 'UTF-8'); ?></Data>
</Cell>
</Row>
<Row ss:Height="22">
<Cell ss:Index="2" ss:MergeDown="1" ss:StyleID="sTblHeader"><Data ss:Type="String">참석인원</Data></Cell>
<Cell ss:Index="3" ss:MergeAcross="1" ss:StyleID="sTblHeader"><Data ss:Type="String">대상인원</Data></Cell>
<Cell ss:Index="5" ss:MergeAcross="1" ss:StyleID="sTblHeader"><Data ss:Type="String">실시인원</Data></Cell>
<Cell ss:Index="7" ss:MergeAcross="1" ss:StyleID="sTblHeader"><Data ss:Type="String">미실시인원</Data></Cell>
</Row>
<Row ss:Height="22">
<?php
$all_qty = (int)($total_data['all_user_qty'] ?? 0);
$comp_qty = (int)($total_data['all_completed_qty'] ?? 0);
$incomp_qty = max(0, $all_qty - $comp_qty);
?>
<Cell ss:Index="3" ss:MergeAcross="1" ss:StyleID="sCellCenter"><Data ss:Type="String"><?php echo $all_qty; ?>명</Data></Cell>
<Cell ss:Index="5" ss:MergeAcross="1" ss:StyleID="sCellCenter"><Data ss:Type="String"><?php echo $comp_qty; ?>명</Data></Cell>
<Cell ss:Index="7" ss:MergeAcross="1" ss:StyleID="sCellCenter"><Data ss:Type="String"><?php echo $incomp_qty; ?>명</Data></Cell>
</Row>
<Row ss:Height="22">
<Cell ss:Index="2" ss:StyleID="sTblHeader"><Data ss:Type="String">비고</Data></Cell>
<Cell ss:MergeAcross="5" ss:StyleID="sCellCenter">
<Data ss:Type="String"><?php echo htmlspecialchars($total_data['rmks'] ?? '', ENT_QUOTES, 'UTF-8'); ?></Data>
</Cell>
</Row>
<Row ss:Height="15"/> <!-- spacer row -->
<!-- 3. 과정별 교육 이수 현황 -->
<Row ss:Height="20">
<Cell ss:Index="2" ss:MergeAcross="6" ss:StyleID="sSecTitle">
<Data ss:Type="String">3. 과정별 교육 이수 현황</Data>
</Cell>
</Row>
<Row ss:Height="22">
<Cell ss:Index="2" ss:MergeAcross="1" ss:StyleID="sTblHeaderTeal"><Data ss:Type="String">과정별</Data></Cell>
<Cell ss:Index="4" ss:MergeAcross="1" ss:StyleID="sTblHeaderTeal"><Data ss:Type="String">교육인원</Data></Cell>
<Cell ss:Index="6" ss:StyleID="sTblHeaderTeal"><Data ss:Type="String">수료인원</Data></Cell>
<Cell ss:Index="7" ss:MergeAcross="1" ss:StyleID="sTblHeaderTeal"><Data ss:Type="String">수료율</Data></Cell>
</Row>
<?php if (empty($sum_rows)): ?>
<Row ss:Height="22">
<Cell ss:Index="2" ss:MergeAcross="6" ss:StyleID="sCellCenter"><Data ss:Type="String">데이터가 없습니다.</Data></Cell>
</Row>
<?php else: ?>
<?php foreach ($sum_rows as $row): ?>
<Row ss:Height="22">
<Cell ss:Index="2" ss:MergeAcross="1" ss:StyleID="sCellLeft">
<Data ss:Type="String"><?php echo htmlspecialchars($row['edu_name'] ?? '', ENT_QUOTES, 'UTF-8'); ?></Data>
</Cell>
<Cell ss:Index="4" ss:MergeAcross="1" ss:StyleID="sCellCenter">
<Data ss:Type="String"><?php echo (int)($row['all_user_qty'] ?? 0); ?>명</Data>
</Cell>
<Cell ss:Index="6" ss:StyleID="sCellCenter">
<Data ss:Type="String"><?php echo (int)($row['completed_qty'] ?? 0); ?>명</Data>
</Cell>
<Cell ss:Index="7" ss:MergeAcross="1" ss:StyleID="sCellCenter">
<?php
$rate = $row['completed_rate'] ?? '0';
if (is_numeric($rate)) {
$rate = number_format((float)$rate, 1);
}
?>
<Data ss:Type="String"><?php echo $rate; ?>%</Data>
</Cell>
</Row>
<?php endforeach; ?>
<?php endif; ?>
<Row ss:Height="30"/> <!-- spacer row -->
<!-- 최하단 주소 및 연락처 푸터 -->
<Row ss:Height="20">
<Cell ss:Index="2" ss:MergeAcross="6" ss:StyleID="sFooter">
<Data ss:Type="String">서울시 송파구 오금로 554 한맥B/D TEL | 02-1234-5600 FAX | 02-1234-5600</Data>
</Cell>
</Row>
</Table>
<WorksheetOptions xmlns="urn:schemas-microsoft-com:office:excel">
<PageSetup>
<Layout x:Orientation="Portrait"/>
<Header x:Margin="0.3"/>
<Footer x:Margin="0.3"/>
<PageMargins x:Bottom="0.75" x:Left="0.7" x:Right="0.7" x:Top="0.75"/>
</PageSetup>
<FitToPage/>
<Print>
<FitWidth>1</FitWidth>
<FitHeight>1</FitHeight>
<PaperSizeIndex>9</PaperSizeIndex>
</Print>
</WorksheetOptions>
</Worksheet>
<!-- ========================================================================= -->
<!-- [시트 2~ : 교육과정별 결과보고서] 시작 -->
<!-- ========================================================================= -->
<?php foreach ($detail_rows as $dIdx => $dRow): ?>
<?php
$rawName = $dRow['edu_name'] ?? '교육과정';
// 특수문자 제거
$cleanName = str_replace([':', '\\', '/', '?', '*', '[', ']'], '', $rawName);
// 인덱스를 붙여 유일성 보장 및 31글자 제한 내 절단
$sheetName = ($dIdx + 1) . '. ' . $cleanName;
$sheetName = mb_strimwidth($sheetName, 0, 31, "");
?>
<Worksheet ss:Name="<?php echo htmlspecialchars($sheetName, ENT_QUOTES, 'UTF-8'); ?>">
<Table ss:ExpandedColumnCount="11" ss:ExpandedRowCount="40" x:FullColumns="1" x:FullRows="1" ss:DefaultColumnWidth="54" ss:DefaultRowHeight="20">
<!-- 열 너비 설정 (상세 시트 최적화) -->
<Column ss:Width="20"/> <!-- A: Spacer -->
<Column ss:Width="50"/> <!-- B -->
<Column ss:Width="50"/> <!-- C -->
<Column ss:Width="50"/> <!-- D -->
<Column ss:Width="50"/> <!-- E -->
<Column ss:Width="70"/> <!-- F -->
<Column ss:Width="70"/> <!-- G -->
<Column ss:Width="70"/> <!-- H -->
<Column ss:Width="70"/> <!-- I -->
<Column ss:Width="100"/> <!-- J -->
<Row ss:Height="10"/> <!-- spacer row -->
<!-- 타이틀 블록 & 결재란 병합 영역 -->
<Row ss:Height="22">
<!-- 타이틀 (B2~D4 세로 가로 병합) -->
<?php
$titleText = $search_year . "년\n" . ($dRow['edu_name'] ?? '') . "\n결과보고서";
?>
<Cell ss:Index="2" ss:MergeAcross="2" ss:MergeDown="2" ss:StyleID="sCourseTitleBlock">
<Data ss:Type="String"><?php echo str_replace("\n", "&#10;", htmlspecialchars($titleText, ENT_QUOTES, 'UTF-8')); ?></Data>
</Cell>
<!-- 결재 세로 병합 (E2~E4) -->
<Cell ss:Index="5" ss:MergeDown="2" ss:StyleID="sApprVertical">
<Data ss:Type="String">결&#10;재</Data>
</Cell>
<!-- 작성, 검토, 승인 헤더 -->
<Cell ss:Index="6" ss:StyleID="sApprHeader"><Data ss:Type="String">작성</Data></Cell>
<Cell ss:Index="7" ss:StyleID="sApprHeader"><Data ss:Type="String">검토</Data></Cell>
<Cell ss:Index="8" ss:StyleID="sApprHeader"><Data ss:Type="String">승인</Data></Cell>
<!-- 담당자 및 정성호 -->
<Cell ss:Index="9" ss:StyleID="sApprHeader"><Data ss:Type="String">담당자</Data></Cell>
<Cell ss:Index="10" ss:StyleID="sCellCenter"><Data ss:Type="String">정성호</Data></Cell>
</Row>
<Row ss:Height="25">
<!-- F3, G3, H3 결재란 사인/도장 공간 (MergeDown으로 세로 2개 셀 병합 영역) -->
<Cell ss:Index="6" ss:MergeDown="1" ss:StyleID="sCellCenter"/>
<Cell ss:Index="7" ss:MergeDown="1" ss:StyleID="sCellCenter"/>
<Cell ss:Index="8" ss:MergeDown="1" ss:StyleID="sCellCenter"/>
<!-- 작성일자 -->
<Cell ss:Index="9" ss:StyleID="sApprHeader"><Data ss:Type="String">작성일자</Data></Cell>
<Cell ss:Index="10" ss:StyleID="sCellCenter">
<Data ss:Type="String"><?php echo date('Y. m. d'); ?></Data>
</Cell>
</Row>
<Row ss:Height="25">
<!-- 보존기간 -->
<Cell ss:Index="9" ss:StyleID="sApprHeader"><Data ss:Type="String">보존기간</Data></Cell>
<Cell ss:Index="10" ss:StyleID="sCellCenter"><Data ss:Type="String">3년</Data></Cell>
</Row>
<Row ss:Height="15"/> <!-- spacer row -->
<!-- 1. 과정개요 -->
<Row ss:Height="20">
<Cell ss:Index="2" ss:MergeAcross="8" ss:StyleID="sSecTitle">
<Data ss:Type="String">1. 과정개요</Data>
</Cell>
</Row>
<Row ss:Height="22">
<Cell ss:Index="2" ss:MergeAcross="2" ss:StyleID="sTblHeader"><Data ss:Type="String">교 육 명</Data></Cell>
<Cell ss:Index="5" ss:MergeAcross="5" ss:StyleID="sCellCenter">
<Data ss:Type="String"><?php echo htmlspecialchars($dRow['edu_name'] ?? '', ENT_QUOTES, 'UTF-8'); ?></Data>
</Cell>
</Row>
<Row ss:Height="22">
<Cell ss:Index="2" ss:MergeAcross="2" ss:StyleID="sTblHeader"><Data ss:Type="String">교육기간</Data></Cell>
<Cell ss:Index="5" ss:MergeAcross="5" ss:StyleID="sCellCenter">
<Data ss:Type="String"><?php echo htmlspecialchars($dRow['edu_term'] ?? '', ENT_QUOTES, 'UTF-8'); ?></Data>
</Cell>
</Row>
<Row ss:Height="22">
<Cell ss:Index="2" ss:MergeAcross="2" ss:StyleID="sTblHeader"><Data ss:Type="String">교육방법</Data></Cell>
<Cell ss:Index="5" ss:MergeAcross="5" ss:StyleID="sCellCenter">
<Data ss:Type="String"><?php echo htmlspecialchars($dRow['edu_category'] ?? '', ENT_QUOTES, 'UTF-8'); ?></Data>
</Cell>
</Row>
<Row ss:Height="22">
<Cell ss:Index="2" ss:MergeAcross="2" ss:StyleID="sTblHeader"><Data ss:Type="String">교육인원</Data></Cell>
<Cell ss:Index="5" ss:MergeAcross="5" ss:StyleID="sCellCenter">
<Data ss:Type="String"><?php echo (int)($dRow['all_user_qty'] ?? 0); ?> 명</Data>
</Cell>
</Row>
<Row ss:Height="22">
<Cell ss:Index="2" ss:MergeAcross="2" ss:StyleID="sTblHeader"><Data ss:Type="String">이수기준</Data></Cell>
<Cell ss:Index="5" ss:MergeAcross="5" ss:StyleID="sCellCenter">
<Data ss:Type="String">진도율 100% 달성 및 교육기간 내 수강 완료</Data>
</Cell>
</Row>
<Row ss:Height="15"/> <!-- spacer row -->
<!-- 2. 교육결과 -->
<Row ss:Height="20">
<Cell ss:Index="2" ss:MergeAcross="8" ss:StyleID="sSecTitle">
<Data ss:Type="String">2. 교육결과</Data>
</Cell>
</Row>
<Row ss:Height="22">
<Cell ss:Index="2" ss:MergeAcross="2" ss:StyleID="sTblHeader"><Data ss:Type="String">교육기간</Data></Cell>
<Cell ss:Index="5" ss:MergeAcross="5" ss:StyleID="sCellCenter">
<Data ss:Type="String"><?php echo htmlspecialchars($dRow['edu_term'] ?? '', ENT_QUOTES, 'UTF-8'); ?></Data>
</Cell>
</Row>
<Row ss:Height="22">
<Cell ss:Index="2" ss:MergeAcross="2" ss:StyleID="sTblHeader"><Data ss:Type="String">교육대상자</Data></Cell>
<Cell ss:Index="5" ss:MergeAcross="5" ss:StyleID="sCellCenter">
<Data ss:Type="String"><?php echo (int)($dRow['all_user_qty'] ?? 0); ?>명</Data>
</Cell>
</Row>
<Row ss:Height="22">
<Cell ss:Index="2" ss:MergeAcross="2" ss:StyleID="sTblHeader"><Data ss:Type="String">수료자</Data></Cell>
<Cell ss:Index="5" ss:MergeAcross="5" ss:StyleID="sCellCenter">
<Data ss:Type="String"><?php echo (int)($dRow['completed_qty'] ?? 0); ?>명</Data>
</Cell>
</Row>
<Row ss:Height="22">
<Cell ss:Index="2" ss:MergeAcross="2" ss:StyleID="sTblHeader"><Data ss:Type="String">미수료자</Data></Cell>
<Cell ss:Index="5" ss:MergeAcross="5" ss:StyleID="sCellCenter">
<Data ss:Type="String"><?php echo (int)($dRow['incomplete_qty'] ?? 0); ?>명</Data>
</Cell>
</Row>
<Row ss:Height="22">
<Cell ss:Index="2" ss:MergeAcross="2" ss:StyleID="sTblHeader"><Data ss:Type="String">수료율</Data></Cell>
<Cell ss:Index="5" ss:MergeAcross="5" ss:StyleID="sCellCenter">
<?php
$cRate = $dRow['completed_rate'] ?? '0';
if (is_numeric($cRate)) {
$cRate = number_format((float)$cRate, 1);
}
?>
<Data ss:Type="String"><?php echo $cRate; ?>%</Data>
</Cell>
</Row>
<Row ss:Height="15"/> <!-- spacer row -->
<!-- 3. 교육내용 -->
<Row ss:Height="20">
<Cell ss:Index="2" ss:MergeAcross="8" ss:StyleID="sSecTitle">
<Data ss:Type="String">3. 교육내용</Data>
</Cell>
</Row>
<Row ss:Height="22">
<Cell ss:Index="2" ss:MergeAcross="8" ss:StyleID="sTblHeader"><Data ss:Type="String">교육내용</Data></Cell>
</Row>
<Row ss:Height="120">
<Cell ss:Index="2" ss:MergeAcross="8" ss:MergeDown="4" ss:StyleID="sDescContent">
<Data ss:Type="String"><?php echo str_replace(["\r\n", "\r", "\n"], "&#10;", htmlspecialchars($dRow['edu_desc'] ?? '', ENT_QUOTES, 'UTF-8')); ?></Data>
</Cell>
</Row>
<!-- MergedDown rows (height spacers) -->
<Row ss:Height="22"/>
<Row ss:Height="22"/>
<Row ss:Height="22"/>
<Row ss:Height="22"/>
<Row ss:Height="25"/> <!-- spacer row -->
<!-- 제출 문구 -->
<Row ss:Height="25">
<Cell ss:Index="2" ss:MergeAcross="8" ss:StyleID="sSubmitText">
<Data ss:Type="String">위와 같이 <?php echo $search_year; ?>년 <?php echo htmlspecialchars($dRow['edu_name'] ?? '', ENT_QUOTES, 'UTF-8'); ?> 결과보고서를 제출합니다.</Data>
</Cell>
</Row>
<Row ss:Height="20"/> <!-- spacer row -->
<!-- 회사 푸터 -->
<Row ss:Height="30">
<Cell ss:Index="2" ss:MergeAcross="8" ss:StyleID="sCompanyFooter">
<Data ss:Type="String"><?php echo htmlspecialchars($total_data['corp_name'] ?? '', ENT_QUOTES, 'UTF-8'); ?></Data>
</Cell>
</Row>
</Table>
<WorksheetOptions xmlns="urn:schemas-microsoft-com:office:excel">
<PageSetup>
<Layout x:Orientation="Portrait"/>
<Header x:Margin="0.3"/>
<Footer x:Margin="0.3"/>
<PageMargins x:Bottom="0.75" x:Left="0.7" x:Right="0.7" x:Top="0.75"/>
</PageSetup>
<FitToPage/>
<Print>
<FitWidth>1</FitWidth>
<FitHeight>1</FitHeight>
<PaperSizeIndex>9</PaperSizeIndex>
</Print>
</WorksheetOptions>
</Worksheet>
<?php endforeach; ?>
</Workbook>