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 '

Discharge Summary

' + // Get discharge status header + $statusHeader = $this->getDischargeStatusText($ipd); + + return '

' . esc($statusHeader) . '

' . '
' . '' . '' @@ -1683,12 +1692,13 @@ class Ipd_discharge extends BaseController if ($admitDate !== '') { $dischargeSummaryParts[] = 'Date of Admission: ' . esc($admitDate); } - if ($dischargeDate !== '') { - $dischargeSummaryParts[] = 'Date of Discharge: ' . esc($dischargeDate); - } + // NOTE: Date of Discharge removed per user request if (! empty($dischargeSummaryParts)) { - $sections[] = '

Discharge Summary

' + // Get discharge status text based on ipd_status + $dischargeStatusHeader = $this->getDischargeStatusText($ipd); + + $sections[] = '

' . esc($dischargeStatusHeader) . '

' . '
' . implode('
', $dischargeSummaryParts) . '
'; }
Name' . esc($patientName) . 'UHID' . esc($patientCode) . '