From 0a48fa6d2c9adc489cc9423f066135a5d5c768c4 Mon Sep 17 00:00:00 2001 From: DevSoftTech Server Date: Thu, 2 Jul 2026 18:24:33 +0530 Subject: [PATCH] OPD investigation list: order by id instead of name --- app/Controllers/Opd_prescription.php | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/app/Controllers/Opd_prescription.php b/app/Controllers/Opd_prescription.php index 50cda10..0dcbcd9 100644 --- a/app/Controllers/Opd_prescription.php +++ b/app/Controllers/Opd_prescription.php @@ -7366,10 +7366,11 @@ class Opd_prescription extends BaseController return $this->response->setJSON(['rows' => []]); } - if (in_array('investigation_name', $fields, true)) { + // Keep investigation panel order stable by record id (not alphabetical name). + if (in_array('id', $fields, true)) { + $builder->orderBy('id', 'ASC'); + } elseif (in_array('investigation_name', $fields, true)) { $builder->orderBy('investigation_name', 'ASC'); - } elseif (in_array('id', $fields, true)) { - $builder->orderBy('id', 'DESC'); } $rows = $builder->get()->getResultArray();