From 058debb59307677c29a7bd675113c60fcee37dcf Mon Sep 17 00:00:00 2001 From: DevSoftTech Server Date: Fri, 17 Apr 2026 09:53:02 +0530 Subject: [PATCH] Respect formulation in duplicate medicine report groups --- app/Models/OpdMedicineModel.php | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/app/Models/OpdMedicineModel.php b/app/Models/OpdMedicineModel.php index 41f35c8..0c22170 100644 --- a/app/Models/OpdMedicineModel.php +++ b/app/Models/OpdMedicineModel.php @@ -116,6 +116,11 @@ class OpdMedicineModel return ''; } + $normalizedFormulation = $this->normalizeMedicineName($formulation); + if ($normalizedFormulation !== '') { + $base .= '::f:' . $normalizedFormulation; + } + $strength = $this->extractStrengthSignature($name, $formulation); if ($strength === '') { return $base; @@ -184,9 +189,15 @@ class OpdMedicineModel } if (! isset($groups[$norm])) { + $displayName = trim((string) ($row['item_name'] ?? '')); + $displayFormulation = trim((string) ($row['formulation'] ?? '')); + if ($displayFormulation !== '') { + $displayName .= ' (' . $displayFormulation . ')'; + } + $groups[$norm] = [ 'normalized_name' => $norm, - 'display_name' => (string) ($row['item_name'] ?? ''), + 'display_name' => $displayName, 'rows' => [], ]; }