Combine textarea notes and test list into single {{investigation}} placeholder

Modified {{investigation}} to show both:
1. Textarea content (advise_investigation_notes) if present
2. Comma-separated test list from opd_prescription_investigation table

Both sources combined with newline separator when both exist.
{{Tadvise_test_list}} still available separately for backward compatibility.

Example combined output:
USG WHOLE ABDOMEN
CECT ABDOMEN
PAC
COMPLETE CARDIAC CHECK UP
PAP SMEAR
CBC (Complete Blood Count), ECG (Electrocardiogram), HBA1C, HBSAG, HCV, HIV I & II (Elisa), Liver Function Test (LFT), PT/INR, Renal Function Test (RFT), Urine Routine & Microscopy, X-Ray Chest (PA View)
This commit is contained in:
DevSoftTech Server 2026-06-05 16:04:01 +05:30
parent a1fbf50f3f
commit 6314bafa29

View File

@ -2804,7 +2804,7 @@ class Opd extends BaseController
$rxInvestigation = $rxRead($rx, ['investigation', 'Investigations', 'investigations', 'Investigation']);
// Build test list from table (comma-separated, not bullet list)
// Build test list from table (comma-separated)
$rxInvestigationTestList = '';
$testNames = [];
@ -2818,11 +2818,26 @@ class Opd extends BaseController
}
}
// Build comma-separated test list for {{Tadvise_test_list}} placeholder
// This is independent from {{investigation}} textarea content
// Build comma-separated test list
if (!empty($testNames)) {
$rxInvestigationTestList = implode(', ', $testNames);
}
// Combine textarea content and test list into {{investigation}} placeholder
$combinedInvestigation = [];
if ($rxInvestigation !== '' && $rxInvestigation !== 'null') {
$combinedInvestigation[] = $rxInvestigation;
}
if ($rxInvestigationTestList !== '') {
$combinedInvestigation[] = $rxInvestigationTestList;
}
// Join with line break if both exist, otherwise use whichever is available
if (count($combinedInvestigation) > 1) {
$rxInvestigation = implode("\n", $combinedInvestigation);
} elseif (!empty($combinedInvestigation)) {
$rxInvestigation = $combinedInvestigation[0];
}
$rxAdvice = $rxRead($rx, ['advice', 'Advice', 'prescription_advice', 'advice_notes', 'advice_note']);
$rxAdviceLocal = '';