<?php
require_once('includes/load.php');
page_require_level(4);

// Ambil ID dari URL
$employee_id = (int)$_GET['id'];
if (!$employee_id) {
    $session->msg("d", "ID karyawan tidak ada.");
    redirect('employees_harian.php');
}

// Cari data karyawan sebelum menghapus
$employee = find_by_id('employees_harian', $employee_id);
if (!$employee) {
    $session->msg("d", "ID karyawan tidak ditemukan.");
    redirect('employees_harian.php');
}

// Hapus data dari database
$delete_id = delete_by_id('employees_harian', $employee_id);

if ($delete_id) {
    $session->msg("s", "Data karyawan harian berhasil dihapus.");
    redirect('employees_harian.php');
} else {
    $session->msg("d", "Gagal menghapus data karyawan harian.");
    redirect('employees_harian.php');
}
?>