Respect formulation in duplicate medicine report groups

This commit is contained in:
DevSoftTech Server 2026-04-17 09:53:02 +05:30
parent 07916f3baf
commit 058debb593

View File

@ -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' => [],
];
}