Commit Graph

79 Commits

Author SHA1 Message Date
a14011e11c Improve pain scale visual indicator for better clarity
- Change checkmark to down arrow (▼) for better visibility in PDFs
- Increase arrow size to 20px and make it bold
- Use white background for non-selected boxes for stronger contrast
- Add thick black border (3px) on selected level for emphasis
- Selected box shows colored background with white text
- Increase selected label text size and make it bold black
- Clear visual distinction between selected (value 2 vs 4) levels now
2026-06-06 03:54:51 +05:30
5e929c858e Fix H_logo placeholder not being replaced in OPD print
- Add fallback to 'logo.png' when H_logo is not set in database or constants
- Prevents {{H_logo}} placeholder from appearing as literal text in print/PDF
- Resolves 400 Bad Request error when browser tries to load unreplaced placeholder
- Ensures prescription templates always have a valid logo path
2026-06-06 03:43:31 +05:30
a5ccd71714 Enhance pain scale image with visual tick indicator
- Add checkmark (✓) above the selected pain intensity level
- Use color gradient from green (No Pain) to red (Worst) for better visual clarity
- Highlight selected level with colored background and white text
- Thicker border on selected level for better emphasis
- Bold label text for selected intensity
- Makes pain scale selection immediately visible in printed/PDF prescriptions
2026-06-06 03:11:25 +05:30
6314bafa29 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)
2026-06-05 16:04:01 +05:30
a1fbf50f3f Change {{Tadvise_test_list}} to comma-separated format (not bullet list)
Changed placeholder behavior to match user requirements:
- {{investigation}} = textarea content (advise_investigation_notes) only
- {{Tadvise_test_list}} = comma-separated test names from table

Removed HTML bullet list formatting. Now outputs plain comma-separated text.

Example output:
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)

Both placeholders are independent and can show content simultaneously.
2026-06-05 15:59:16 +05:30
0b865f41cd Add textarea fallback for {{Tadvise_test_list}} placeholder
When opd_prescription_investigation table is empty but investigation
textarea has content, parse textarea content (split by newlines) to
populate the test list.

This handles cases where tests are entered as free-text in the
"Advise Investigation" textarea instead of selecting from master list.

Parsing logic:
- Try rx_investigations table first
- If empty, split investigation textarea by newlines
- Filter out empty lines and 'null' values
- Build HTML bullet list from either source

Example textarea content:
USG WHOLE ABDOMEN
CECT ABDOMEN
PAC
COMPLETE CARDIAC CHECK UP
PAP SMEAR

Will render as:
• USG WHOLE ABDOMEN
• CECT ABDOMEN
• PAC
• COMPLETE CARDIAC CHECK UP
• PAP SMEAR
2026-06-05 15:55:34 +05:30
1ca2dbce4c Add error handling and debug mode for OPD PDF rendering
Added try-catch around mPDF WriteHTML to catch rendering errors.
Changed debug_html mode to output as text/html for better preview.
Logs mPDF errors and returns user-friendly error message.

This will help diagnose blank page issues with {{Tadvise_test_list}} placeholder.
2026-06-05 15:38:26 +05:30
a540581bf9 Fix {{Tadvise_test_list}} to always populate from rx_investigations
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>
2026-06-05 15:28:01 +05:30
6f6286f427 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>
2026-06-05 15:15:15 +05:30
b6a2e956d8 Remove heading from combined NABH panel placeholder 2026-06-05 06:05:06 +05:30
806044ff93 Add single conditional NABH panel placeholder 2026-06-05 06:00:43 +05:30
c4a6e95933 Add explicit OPD NABH allergy raw and block placeholders 2026-06-05 05:47:16 +05:30
14fb1fd400 Fix OPD placeholder collisions for vitals and allergy blocks 2026-06-05 05:29:58 +05:30
51daaa989a Fix OPD pain/allergy placeholders and hide No Pain block 2026-06-05 04:51:05 +05:30
dc2a0da1ee Use mPDF-safe mm spacer blocks for OPD section gaps 2026-06-05 04:26:23 +05:30
dbda578d68 Harden OPD block spacing and add debug_html output mode 2026-06-05 04:18:48 +05:30
f358bbd66c More spacing between OPD print blocks; add margin around medicine table 2026-06-05 04:13:21 +05:30
3a06c32dc5 Increase spacing between OPD print placeholder blocks 2026-06-05 04:08:20 +05:30
6bdef9bb9d Improve OPD print block typography for professional output 2026-06-05 03:54:52 +05:30
a1ba8f0e6b Enhance OPD template placeholders and list rendering 2026-06-05 03:48:24 +05:30
4ed366ccb2 feat: commit all pending page and ABDM gateway updates 2026-05-26 06:04:34 +05:30
f311d50745 OPD consult: add women history fields, persist in history, update print sections 2026-05-12 12:52:13 +05:30
be6f0cd6d0 Set OPD appointment list default order to descending 2026-05-05 22:56:57 +05:30
0aa0edbbce Fix OPD confirm payment flow and DataTable initialization
- Opd.php: mode-0 (zero amount) no longer inserts payment_history row
  and skips HealthPlix sync for faster confirm
- Opd.php: added spid-based idempotency for cash/card to prevent
  duplicate payment_history rows on retry
- Opd.php: invoice view hides 0-amount payment_history rows
- opd_appointment_list.php: fix isDataTable call (DataTable -> dataTable)
- jquery.dataTables.min.js: replace non-functional shim with real
  DataTables 1.13.8 (supports ext.search, isDataTable, rows() API)
2026-04-28 12:01:53 +05:30
5226fde8a0 Fix OPD appointment datetime display and date filtering 2026-04-28 10:59:04 +05:30
bd274a3fc3 Add OPD appointment time capture and storage with date+time display 2026-04-28 07:59:47 +05:30
6ae9a3516f feat: add HealthPlix OPD sync flow with settings, diagnostics, and sync ID persistence 2026-04-27 08:32:51 +05:30
1cea1495fc Fix OPD scan delete button for direct file-list page and AJAX modal 2026-04-17 04:41:45 +05:30
a0b724e30d Fix serve_legacy_upload to also check public/uploads/ (FCPATH) 2026-04-17 04:20:49 +05:30
58ddd77d42 Add fallback route to serve legacy CI3 uploads from project-root uploads/ 2026-04-17 04:16:08 +05:30
1084ef8875 Fix: {{advice}} prints as-is (no Hindi/AI conversion); fix Schema Diff truncation 2026-04-16 12:31:42 +05:30
57397d80e1 Fix OPD print remarks leaking NABH allergy lines 2026-04-14 08:34:46 +05:30
5801b5d276 Refine {{medical}} table widths and instruction row styling 2026-04-14 07:50:50 +05:30
b97bb74a5d Reformat {{medical}} rows with wide instruction line 2026-04-14 07:43:07 +05:30
f99f48b62f fix: restrict scan delete to 24h or same date 2026-04-11 04:49:59 +05:30
7233f5979e feat: auto visit-done on scan save and add scan delete actions 2026-04-11 04:45:45 +05:30
f748224cd0 fix: count OPD visits up to printed opd date 2026-04-10 21:30:47 +05:30
920f1033c0 fix: compute print total_no_visit from opd_master records 2026-04-10 21:28:15 +05:30
2c3552ac07 fix: include medicine qty in {{medical}} consult print placeholder 2026-04-10 14:27:35 +05:30
385183fbe2 feat: Add Print Cont. Paper template selection to Doctor Master 2026-04-10 13:19:47 +05:30
910f46b06c feat: add Doctor Master OPD validity editing with hospital fallback
- 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
2026-04-10 12:58:17 +05:30
eec0642466 fix: OPD running validity period no longer extends per running visit
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
2026-04-10 12:48:28 +05:30
21ddeefe40 fix: Running OPD zero-value validity, update_doc_field HTTP 500, PDF Unicode font (Devanagari)
- Opd.php showfee(): exclude zero-amount OPD from validity window query
- Opd.php confirm_opd(): anchor last_opdvisit_date to most recent paid OPD for zero-value running
- Opd.php buildOpdLetterPrintData(): use paid OPD start date for expiry on zero-value entries
- OpdModel.php insertOpd(): exclude fee_type=3/zero-amount from running_opd_id lookup; anchor visit count to paid OPD start when isZeroValueRunning
- DoctorDocument.php update_doc_field(): wrap in try/catch, schema-safe payload via filterPayloadByExistingColumns, structured JSON errors
- DoctorDocument.php create_final(): configure mPDF with FreeSans/FreeSerif (GNU FreeFont), useOTL=0xFF, autoScriptToLang=true for Devanagari/Hindi rendering
- doc_letterhead_print.php: add body/p/td/th font-family freesans for PDF Unicode output
2026-04-10 12:30:15 +05:30
6a0660cad7 Show patient age and gender in OPD list 2026-04-10 03:55:00 +05:30
c534a83ad2 Normalize OPD queue display per doctor day 2026-04-10 03:44:32 +05:30
7f131aeae8 Add OPD doctor/date update endpoint and invoice validation feedback 2026-04-09 19:47:57 +05:30
bca95f14e6 fix: {{medical}} prints Generic Name instead of Substitute in OPD consult print
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"
2026-04-07 11:34:57 +05:30
2958f2e9b6 fix: queue no per-doctor-per-day isolation and stop auto-refresh on digest poll
- 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."
2026-04-07 11:23:20 +05:30
16f3c95053 Fix OPD template builder sync and formulation formatting 2026-04-07 03:55:53 +05:30
19db43762d Enhance OPD and patient workflows with live updates and UX improvements 2026-04-07 03:27:39 +05:30