Previous implementation only built test list when investigation textarea
was empty, preventing {{Tadvise_test_list}} from showing when textarea
had content.
Changes:
- Separated test list building from textarea population logic
- {{Tadvise_test_list}} now always populates when rx_investigations exists
- {{investigation}} still gets comma-separated fallback when textarea empty
- Both placeholders now work independently
Test list HTML output format:
<ul style="margin:3px 0 0 16px;padding:0;list-style-type:disc;">
<li>CBC (Complete Blood Count)</li>
<li>ECG (Electrocardiogram)</li>
<li>HBA1C</li>
</ul>
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>
- Add OPD Validity (Days) field in Doctor add/edit forms\n- Save/update doctor_master.opd_valid_no_days from Doctor module\n- Use hospital_setting fallback keys when doctor validity is blank/zero\n- Apply fallback consistently in OPD showfee, print expiry, and running_opd lookup window\n- Supports hospital-wide defaults while preserving doctor-specific overrides
OpdModel.php:
- running_opd_id lookup now uses doctor's configured opd_valid_no_days
instead of hardcoded 4 days (resolveRunningLookupDate helper)
- Doctors with validity > 5 days now correctly link running OPD back
to the original paid OPD even on days 5..N of the window
Opd.php (buildOpdLetterPrintData):
- For running OPD entries (running_opd=1 or opd_fee_type=3), expiry
display now shows "OPD Start Date: [paid visit] | Valid Upto: [paid
visit + validity]" using old_opd record — mirrors Opd_print_1 legacy
behavior and prevents validity window from advancing with each visit
Root cause: the fallback lookup from opd_med_master used
$labelField = $masterSaltField ?? $masterGenericField
which preferred salt_name (the Substitute / other brand names field) over
genericname (the actual Generic Name / composition). If a prescription row's
inline genericname was empty, the Substitute string was written into it and
then printed as \"Salt/Generic\" in the {{medical}} block.
Fixes applied in three places:
1. Opd.php buildOpdLetterPrintData - master lookup now prefers genericname
2. Opd.php buildOpdLetterPrintData second loop - removed inline salt_name
fallback that overwrote genericname with Substitute value
3. Opd.php buildLegacyDashboardTemplateVars - removed salt_name from the
generic resolution chain used when rendering the medicine table HTML
4. Opd_prescription.php medicine list function - same preferGenericname fix
and removed inline salt_name -> genericname overwrite"
- Queue No (Opd.php::autoCreateOpdQueue, Opd_prescription.php::opd_prescription_save
and ::ensurePrescriptionSession): changed MAX(queue_no) query to JOIN through
opd_master.doc_id instead of trusting opd_prescription.doc_id, ensuring queue
numbering is strictly per-doctor per-day regardless of stale doc_id values in
opd_prescription rows.
- OPD appointment list: replaced auto-reload-on-digest-change with a manual
'Refresh' button. When the 8s digest poll detects new data the button turns
yellow with a 'New' badge; the page only reloads when the user explicitly clicks
it, preventing disruptive mid-session reloads."