prepare("INSERT INTO attendance (employee_id, date, check_in) VALUES (?, ?, ?) ON DUPLICATE KEY UPDATE check_in = ?"); if ($stmt->execute([$emp_id, $today, date('H:i:s'), date('H:i:s')])) { $msg = 'تم تسجيل الحضور بنجاح!'; } } elseif ($action === 'check_out') { $stmt = $db->prepare("UPDATE attendance SET check_out = ? WHERE employee_id = ? AND date = ?"); if ($stmt->execute([date('H:i:s'), $emp_id, $today])) { $msg = 'تم تسجيل الانصراف بنجاح!'; } } } // Fetch all employees and their today's attendance $employees = $db->query("SELECT e.*, a.check_in, a.check_out FROM employees e LEFT JOIN attendance a ON e.id = a.employee_id AND a.date = '$today' ORDER BY e.id DESC")->fetchAll(); $project_name = $_SERVER['PROJECT_NAME'] ?? 'نظام الموارد البشرية'; ?> تسجيل الحضور - <?php echo htmlspecialchars($project_name); ?>

سجل الحضور والغياب

تاريخ اليوم:

الموظف وقت الحضور وقت الانصراف إجراءات
لا يوجد موظفين مسجلين حالياً
--:-- --:--