diff --git a/app/Controllers/Ipd_discharge.php b/app/Controllers/Ipd_discharge.php index 213ffeb..04ee3e8 100644 --- a/app/Controllers/Ipd_discharge.php +++ b/app/Controllers/Ipd_discharge.php @@ -1054,6 +1054,11 @@ class Ipd_discharge extends BaseController $ipdStatus = (int) ($ipd->ipd_status ?? 0); + // If status is 0 (Status Pending), show "Discharge Summary" only + if ($ipdStatus === 0) { + return 'Discharge Summary'; + } + // Check if ipd_discharge_status table exists if (! $this->db->tableExists('ipd_discharge_status')) { return 'Discharge Summary'; @@ -1069,9 +1074,10 @@ class Ipd_discharge extends BaseController return 'Discharge Summary'; } - // Prefer status_details if available, otherwise use status_desc + // Use status_details field (e.g., "Discharge Summary", "Leave Against Medical Advice", "Dead Summary") $statusText = trim((string) ($row['status_details'] ?? '')); if ($statusText === '') { + // Fallback to status_desc if status_details is empty $statusText = trim((string) ($row['status_desc'] ?? '')); } @@ -1532,7 +1538,10 @@ class Ipd_discharge extends BaseController $admitDate = $this->safeDate((string) ($ipd->str_register_date ?? $ipd->register_date ?? '')); $dischargeDate = $this->safeDate((string) ($ipd->str_discharge_date ?? $ipd->discharge_date ?? '')); - return '
| Name | ' . esc($patientName) . ' | UHID | ' . esc($patientCode) . ' |