prepare("SELECT DISTINCT category_code, category FROM procurement_items WHERE category IS NOT NULL AND budget_year = ? ORDER BY category_code, category"); $stmtCategories->execute([$active_year]); $categories = $stmtCategories->fetchAll(); $stmtDepartments = $pdo->prepare("SELECT DISTINCT department FROM procurement_items WHERE department IS NOT NULL AND budget_year = ? ORDER BY department"); $stmtDepartments->execute([$active_year]); $departments = $stmtDepartments->fetchAll(PDO::FETCH_COLUMN); $stmtStatuses = $pdo->prepare("SELECT DISTINCT status FROM procurement_items WHERE status IS NOT NULL AND budget_year = ? ORDER BY status"); $stmtStatuses->execute([$active_year]); $statuses = $stmtStatuses->fetchAll(PDO::FETCH_COLUMN); // ดึงรายการจัดซื้อทั้งหมด $stmt = $pdo->prepare("SELECT * FROM procurement_items WHERE budget_year = ? ORDER BY id ASC"); $stmt->execute([$active_year]); $items = $stmt->fetchAll(); ?>
| ลำดับ | รหัส | รายการครุภัณฑ์ | หมวดหมู่ | หน่วยงาน | งบตั้งต้น | จัดซื้อจริง | ความคืบหน้า | สถานะปัจจุบัน | Timeline | จัดการ |
|---|---|---|---|---|---|---|---|---|---|---|
| = $row['seq_no'] ?> | = $row['item_code'] ?: '-' ?> |
= htmlspecialchars($row['item_name']) ?>
= $row['quantity'] ?> = $row['unit'] ?> (= $row['plan_type'] ?>)
|
= $row['category_code'] ? '[' . $row['category_code'] . '] ' : '' ?>= htmlspecialchars($row['category']) ?> | = htmlspecialchars($row['department']) ?> | = number_format($row['total_price'], 0) ?> | = $row['procured_price'] > 0 ? number_format($row['procured_price'], 0) : '-' ?> |
|
'bg-warning text-dark', 'อยู่ระหว่างดำเนินการ' => 'bg-primary text-white', 'ใบส่งซื้อ/ทำสัญญา' => 'bg-info text-dark', 'ดำเนินการเสร็จสิ้น' => 'bg-success text-white', default => 'bg-secondary text-white' }; ?> |
= htmlspecialchars($row['confirm_period']) ?>
= getTimelineBadge($row['due_date'], $row['status']) ?>
|