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 salaries WHERE cid = ? ORDER BY year DESC, month DESC LIMIT 12");
|
|
$stmt->execute([$_SESSION['cid']]);
|
|
$salaries = $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>สลิปเงินเดือน</h2>
|
|
</div>
|
|
<div class="card" style="margin: 20px;">
|
|
<?php if (count($salaries) > 0): ?>
|
|
<?php foreach ($salaries as $sal): ?>
|
|
<div style="border-bottom: 1px solid #eee; padding: 10px 0; display:flex; justify-content: space-between; align-items:center;">
|
|
<div><strong>เดือน/ปี:</strong> <?= str_pad($sal['month'], 2, '0', STR_PAD_LEFT) ?>/<?= $sal['year'] ?></div>
|
|
<div><strong style="color: #0072ff;"><?= number_format($sal['net_salary'], 2) ?> ฿</strong></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>
|