From ca4b4195aac4e82676aadd558f74500ba64df31d Mon Sep 17 00:00:00 2001 From: DevSoftTech Server Date: Mon, 6 Apr 2026 12:51:11 +0530 Subject: [PATCH] fix: keep new OPD appointments in booked list --- app/Controllers/Opd.php | 34 ------------------- app/Views/billing/opd_appointment_list.php | 8 ++--- .../billing/opd_appointment_list_table.php | 23 +++---------- 3 files changed, 8 insertions(+), 57 deletions(-) diff --git a/app/Controllers/Opd.php b/app/Controllers/Opd.php index 1eba0f0..47f7ab1 100644 --- a/app/Controllers/Opd.php +++ b/app/Controllers/Opd.php @@ -845,7 +845,6 @@ class Opd extends BaseController $opdList0 = []; $opdList1 = []; - $opdListWaitingAll = []; $opdList2 = []; $opdList3 = []; @@ -864,13 +863,11 @@ class Opd extends BaseController if ($status === 1 && ! $hasPrescription) { $opdList0[] = $row; - $opdListWaitingAll[] = $row; continue; } if ($status === 1 && $hasPrescription) { $opdList1[] = $row; - $opdListWaitingAll[] = $row; continue; } @@ -906,36 +903,6 @@ class Opd extends BaseController return ((int) ($left->opd_id ?? 0)) <=> ((int) ($right->opd_id ?? 0)); }); - usort($opdListWaitingAll, static function ($left, $right): int { - $leftHasPrescription = (int) ($left->has_prescription ?? 0); - $rightHasPrescription = (int) ($right->has_prescription ?? 0); - if ($leftHasPrescription !== $rightHasPrescription) { - return $rightHasPrescription <=> $leftHasPrescription; - } - - if ($leftHasPrescription === 1) { - $leftVitals = (int) ($left->has_vitals ?? 0); - $rightVitals = (int) ($right->has_vitals ?? 0); - if ($leftVitals !== $rightVitals) { - return $leftVitals <=> $rightVitals; - } - - $leftQueue = (int) ($left->queue_no ?? 0); - $rightQueue = (int) ($right->queue_no ?? 0); - if ($leftQueue !== $rightQueue) { - return $leftQueue <=> $rightQueue; - } - } - - $leftConfirmed = (int) ($left->is_confirmed_for_queue ?? 0); - $rightConfirmed = (int) ($right->is_confirmed_for_queue ?? 0); - if ($leftConfirmed !== $rightConfirmed) { - return $rightConfirmed <=> $leftConfirmed; - } - - return ((int) ($left->opd_id ?? 0)) <=> ((int) ($right->opd_id ?? 0)); - }); - usort($opdList2, static function ($left, $right): int { return ((int) ($left->opd_id ?? 0)) <=> ((int) ($right->opd_id ?? 0)); }); @@ -956,7 +923,6 @@ class Opd extends BaseController 'doc_master' => $docMaster, 'opd_list_0' => $opdList0, 'opd_list_1' => $opdList1, - 'opd_list_waiting_all' => $opdListWaitingAll, 'opd_list_2' => $opdList2, 'opd_list_3' => $opdList3, ]); diff --git a/app/Views/billing/opd_appointment_list.php b/app/Views/billing/opd_appointment_list.php index fb95369..6f71ea3 100644 --- a/app/Views/billing/opd_appointment_list.php +++ b/app/Views/billing/opd_appointment_list.php @@ -33,7 +33,7 @@ - $opd_list_waiting_all ?? $opd_list_1, 'showQueue' => true, 'tabType' => 'waiting', 'opd_date' => $opd_date, 'doc_id' => $doc_id]) ?> + $opd_list_1, 'showQueue' => true, 'tabType' => 'waiting', 'opd_date' => $opd_date, 'doc_id' => $doc_id]) ?>
All waiting patients already have vitals.
@@ -158,8 +158,7 @@ $rows.each(function() { var hasVitals = parseInt($(this).attr('data-has-vitals') || '0', 10) === 1; - var hasPrescription = parseInt($(this).attr('data-has-prescription') || '0', 10) === 1; - var show = !onlyMissing || (hasPrescription && !hasVitals); + var show = !onlyMissing || !hasVitals; $(this).toggle(show); if (show) { visibleCount++; @@ -174,8 +173,7 @@ var missingCount = 0; $('#tab_waiting tbody tr[data-opd-id]').each(function() { var hasVitals = parseInt($(this).attr('data-has-vitals') || '0', 10) === 1; - var hasPrescription = parseInt($(this).attr('data-has-prescription') || '0', 10) === 1; - if (hasPrescription && !hasVitals) { + if (!hasVitals) { missingCount++; } }); diff --git a/app/Views/billing/opd_appointment_list_table.php b/app/Views/billing/opd_appointment_list_table.php index b732802..fa3dba6 100644 --- a/app/Views/billing/opd_appointment_list_table.php +++ b/app/Views/billing/opd_appointment_list_table.php @@ -22,20 +22,19 @@ if ($authUser) { - + opd_code ?? '') ?> P_name ?? '') . ' { ' . ($row->p_rname ?? '') . ' }') ?> - has_prescription ?? 0) === 1 ? esc((int) ($row->queue_no ?? 0)) : '-' ?> + queue_no ?? 0)) ?> p_code ?? '') ?> opd_type ?? '') ?> / Amt: opd_fee_amount ?? '') ?> has_vitals) && (int) $row->has_vitals === 1; ?> - is_confirmed_for_queue ?? 0) === 1; ?> has_prescription ?? 0) === 1; ?> - + - - - - - +