Add {{Tadvise_test_list}} placeholder for investigation test names

Created new OPD template placeholder to display investigation test names
as a formatted HTML list, separate from the textarea {{investigation}}.

Changes:
- app/Controllers/Opd.php:
  * Added $rxInvestigationTestList variable in buildLegacyDashboardTemplateVars()
  * Builds HTML <ul> list from rx_investigations test names
  * Added 'Tadvise_test_list' token to return array

- app/Views/billing/opd_template_builder.php:
  * Added 'Tadvise_test_list' to $opdConsultSet placeholder list
  * Now appears in "OPD Consult" group in template builder

Usage in OPD templates:
- {{investigation}} = comma-separated test names (for textarea)
- {{Tadvise_test_list}} = formatted HTML bullet list of test names (for print/display)

Example output:
<ul style="margin:3px 0 0 16px;padding:0;list-style-type:disc;">
  <li>CBC (Complete Blood Count)</li>
  <li>USG WHOLE ABDOMEN</li>
  <li>ECG (Electrocardiogram)</li>
</ul>
This commit is contained in:
DevSoftTech Server 2026-06-05 15:15:15 +05:30
parent a572bbabae
commit 6f6286f427
2 changed files with 14 additions and 1 deletions

View File

@ -2796,15 +2796,27 @@ class Opd extends BaseController
};
$rxInvestigation = $rxRead($rx, ['investigation', 'Investigations', 'investigations', 'Investigation']);
$rxInvestigationTestList = '';
if ($rxInvestigation === '' && !empty($data['rx_investigations']) && is_array($data['rx_investigations'])) {
$parts = [];
$testNames = [];
foreach ($data['rx_investigations'] as $inv) {
$txt = trim((string) ($inv['investigation_name'] ?? $inv['investigation'] ?? ''));
if ($txt !== '') {
$parts[] = $txt;
$testNames[] = $txt;
}
}
$rxInvestigation = implode(', ', $parts);
// Build formatted test list for {{Tadvise_test_list}} placeholder
if (!empty($testNames)) {
$rxInvestigationTestList = '<ul style="margin:3px 0 0 16px;padding:0;list-style-type:disc;">';
foreach ($testNames as $testName) {
$rxInvestigationTestList .= '<li style="margin-bottom:3px;font-weight:400;line-height:1.5;color:#111;">' . htmlspecialchars($testName, ENT_QUOTES, 'UTF-8') . '</li>';
}
$rxInvestigationTestList .= '</ul>';
}
}
$rxAdvice = $rxRead($rx, ['advice', 'Advice', 'prescription_advice', 'advice_notes', 'advice_note']);
@ -3045,6 +3057,7 @@ class Opd extends BaseController
'provisional_diagnosis_snomed_source' => $provisionalDiagnosisSnomedSource,
'investigation' => $rxInvestigation,
'investigation_local' => $investigationLocal,
'Tadvise_test_list' => $rxInvestigationTestList,
'medical' => $medicalHtml,
'doctor' => '<p style="text-align:right;">Dr. ' . esc((string) ($opd->doc_name ?? '')) . '</p>',
'top_content' => '',

View File

@ -70,7 +70,7 @@ $opdConsultSet = [
'diagnosis_snomed_id', 'diagnosis_snomed_term', 'diagnosis_snomed_source',
'provisional_diagnosis_snomed_id', 'provisional_diagnosis_snomed_term', 'provisional_diagnosis_snomed_source',
'complaint_list', 'diagnosis_list', 'provisional_diagnosis_list',
'medical', 'investigation', 'prescriber_remarks', 'advice', 'next_visit', 'refer_to',
'medical', 'investigation', 'Tadvise_test_list', 'prescriber_remarks', 'advice', 'next_visit', 'refer_to',
'rx', 'rxtable', 'rxfullblock',
'vitalsblock', 'complaintblock', 'diagnosisblock', 'investigationblock',
'remarksblock', 'adviceblock', 'nextvisitblock',