From 302f779ea229221b8a0b53b4aa3a8e984bd29d48 Mon Sep 17 00:00:00 2001 From: DevSoftTech Server Date: Sat, 1 Aug 2026 02:29:55 +0530 Subject: [PATCH] fix(discharge): show in-hospital lab only for explicitly selected dates --- app/Controllers/Ipd_discharge.php | 21 ++++----------------- 1 file changed, 4 insertions(+), 17 deletions(-) diff --git a/app/Controllers/Ipd_discharge.php b/app/Controllers/Ipd_discharge.php index 4f44d69..7f36ba6 100644 --- a/app/Controllers/Ipd_discharge.php +++ b/app/Controllers/Ipd_discharge.php @@ -2466,30 +2466,17 @@ class Ipd_discharge extends BaseController $savedClinicalDates = $this->getSavedClinicalLabDates($ipdId); $clinicalLabRows = $this->getClinicalInvestigationLabRows($patientId, $admitDate, $dischargeDate, $savedClinicalDates); + // Strict selection mode: in-hospital lab should print only when user + // explicitly selected one or more investigation dates. $effectiveClinicalDates = $savedClinicalDates; - if (empty($effectiveClinicalDates)) { - foreach ($clinicalLabRows as $row) { - $dt = $this->normalizeDateValue((string) ($row['inv_date'] ?? '')); - if ($dt !== null) { - $effectiveClinicalDates[$dt] = $dt; - } - } - $effectiveClinicalDates = array_values($effectiveClinicalDates); - } $pathologyMatrix = $this->getClinicalPathologyMatrixRows($patientId, $effectiveClinicalDates); $selectedLabRows = []; foreach ($clinicalLabRows as $row) { - if (! empty($savedClinicalDates)) { - if (! empty($row['checked'])) { - $selectedLabRows[] = $row; - } - continue; + if (! empty($row['checked'])) { + $selectedLabRows[] = $row; } - - // No saved selection yet: include all available pathology dates as fallback. - $selectedLabRows[] = $row; } $otherExamRow = [];