Files
2026-09-16 23:20:08 +07:00

58 lines
2.8 KiB
PHP

<?php
require_once 'config.php';
include 'header.php';
$stmt = $pdo->prepare("SELECT * FROM procurement_items WHERE budget_year = ? ORDER BY id ASC LIMIT 50");
$stmt->execute([$active_year]);
$items = $stmt->fetchAll();
?>
<div class="card p-4">
<div class="d-flex justify-content-between align-items-center mb-3">
<h5 class="fw-bold"><i class="bi bi-bar-chart-steps me-2"></i>Gantt Chart & Timeline แผนจัดซื้อปี <?= $active_year ?></h5>
<div>
<span class="badge bg-success me-1">ตรงเวลา</span>
<span class="badge bg-warning text-dark me-1">ใกล้กำหนด (<=15 วัน)</span>
<span class="badge bg-danger">เกินกำหนด/ล่าช้า</span>
</div>
</div>
<div class="table-responsive">
<table class="table table-hover align-middle">
<thead class="table-light">
<tr>
<th>รหัส</th>
<th style="width: 25%;">รายการครุภัณฑ์</th>
<th>หน่วยงาน</th>
<th>งบประมาณ</th>
<th>เปอร์เซ็นต์</th>
<th>Timeline สถานะ</th>
<th>การดำเนินการ</th>
</tr>
</thead>
<tbody>
<?php foreach ($items as $row): ?>
<tr>
<td><code><?= $row['item_code'] ?? '-' ?></code></td>
<td class="fw-bold"><?= htmlspecialchars($row['item_name']) ?></td>
<td><?= $row['department'] ?></td>
<td>฿<?= number_format($row['total_price'], 2) ?></td>
<td style="width: 120px;">
<div class="progress" style="height: 18px;">
<div class="progress-bar bg-info" style="width: <?= $row['progress'] ?>%"><?= $row['progress'] ?>%</div>
</div>
</td>
<td><?= getTimelineBadge($row['due_date'], $row['status']) ?></td>
<td>
<a href="qr_view.php?id=<?= $row['id'] ?>" target="_blank" class="btn btn-sm btn-outline-dark"><i class="bi bi-qr-code"></i> QR</a>
<button class="btn btn-sm btn-primary" onclick="openApprovalModal(<?= $row['id'] ?>)"><i class="bi bi-pen"></i> อนุมัติ</button>
</td>
</tr>
<?php endforeach; ?>
</tbody>
</table>
</div>
</div>
</body>
</html>