prepare(" SELECT start_date, end_date FROM edu_contents WHERE category_code = 'CA10003' AND base_year = ? GROUP BY start_date, end_date LIMIT 1 "); $stmt->execute([$current_year]); $period = $stmt->fetch(PDO::FETCH_ASSOC); if ($period && !empty($period['start_date']) && !empty($period['end_date'])) { $start = date('Y.m.d', strtotime($period['start_date'])); $end = date('Y.m.d', strtotime($period['end_date'])); $legal_edu_period = "{$start} ~ {$end}"; } // 전체 학습자 수 (퇴사자 제외) - 법정교육 기간 유무와 무관하게 항상 조회 $stmt_qty = $pdo->prepare(" SELECT COUNT(member_id) FROM edu_users WHERE (end_date IS NULL OR end_date > CURDATE()) AND sys_comp_code = working_comp "); $stmt_qty->execute(); $user_qty = (int) $stmt_qty->fetchColumn(); // 관리자명 (이름 + 아이디) $stmt_user_name = $pdo->prepare(" SELECT CONCAT(name, ' (', member_id, ')') FROM edu_users WHERE sys_comp_code = ? AND member_id = ? LIMIT 1 "); $stmt_user_name->execute([$sys_comp_code, $member_id]); $user_name = $stmt_user_name->fetchColumn() ?: $member_id; // 법인명 $stmt_comp_name = $pdo->prepare(" SELECT code_name FROM edu_codes WHERE group_code = 'CO100' AND code = ? LIMIT 1 "); $stmt_comp_name->execute([$sys_comp_code]); $comp_name = $stmt_comp_name->fetchColumn() ?: $sys_comp_code; } catch (Exception $e) { // 오류 무시 } ?>