39 lines
1.7 KiB
PHP
39 lines
1.7 KiB
PHP
<?php
|
|
session_start();
|
|
require_once '../includes/db.php';
|
|
if (!isset($_SESSION['cid'])) { header("Location: register.php"); exit; }
|
|
|
|
$stmt = $pdo->prepare("SELECT * FROM attendances WHERE cid = ? ORDER BY work_date DESC LIMIT 30");
|
|
$stmt->execute([$_SESSION['cid']]);
|
|
$attendances = $stmt->fetchAll();
|
|
?>
|
|
<!DOCTYPE html>
|
|
<html lang="th">
|
|
<head>
|
|
<meta charset="UTF-8">
|
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
<title>ข้อมูลเวลาเข้า-ออกงาน</title>
|
|
<link href="https://fonts.googleapis.com/css2?family=Prompt:wght@300;400;600&display=swap" rel="stylesheet">
|
|
<link rel="stylesheet" href="../assets/css/style.css">
|
|
</head>
|
|
<body>
|
|
<div class="header">
|
|
<h2>เวลาเข้า-ออกงาน (30 วันล่าสุด)</h2>
|
|
</div>
|
|
<div class="card" style="margin: 20px;">
|
|
<?php if (count($attendances) > 0): ?>
|
|
<?php foreach ($attendances as $att): ?>
|
|
<div style="border-bottom: 1px solid #eee; padding: 10px 0; display:flex; justify-content: space-between;">
|
|
<div><strong>วันที่:</strong> <?= $att['work_date'] ?></div>
|
|
<div><strong>เข้า:</strong> <?= $att['time_in'] ?: '-' ?> <strong>ออก:</strong> <?= $att['time_out'] ?: '-' ?></div>
|
|
</div>
|
|
<?php endforeach; ?>
|
|
<?php else: ?>
|
|
<p style="text-align:center;">ไม่มีข้อมูลการลงเวลา</p>
|
|
<?php endif; ?>
|
|
<br>
|
|
<a href="index.php" class="btn-magic" style="background: #ccc; color: #333;">กลับสู่เมนูหลัก</a>
|
|
</div>
|
|
</body>
|
|
</html>
|