- 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
- Make docedit_load/doc_input_list/create_doc flows tolerant when doc_format_sub.active is missing\n- Guard master/sub insert/update payloads by existing DB columns to avoid SQL 500 on old dumps\n- Avoid hard dependency on created_at/updated_at/default_print_type print margin columns\n- Keep behavior unchanged on upgraded schemas while restoring compatibility with legacy production data
- Add paper print settings to IPD templates (page size/custom size/margins)\n- Add Header HTML, Footer HTML, and Style (CSS) support\n- Update IPD PDF renderer to honor template paper settings and header/footer\n- Extend IPD placeholders with logo/QR support: {{H_logo}}, {{H_logo_abs}}, {{hospital_logo_html}}, {{qr_content}}, {{qr_code_html}}\n- Improve token rendering with robust curly placeholder parser for body/header/footer\n- Keep legacy sticker forms aligned with custom label dimensions and migrate old default rows
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."