Commit Graph

39 Commits

Author SHA1 Message Date
b1846696a4 Prevent stale cached IPD bill PDF responses 2026-08-01 16:28:27 +05:30
2bd52532a0 Add ABDM M3 fetch option to Ayushman claim sheet 2026-07-19 01:19:56 +05:30
60d708c7b8 Fix Orgcase table 500 and prevent duplicate DataTable init 2026-07-10 00:34:49 +05:30
a4e6f69728 Fix IpdModel method call in toggleStatus endpoint
- Change getById() to find() - IpdBillingModel doesn't have getById method
- Use ipdEditModel (IpdModel extends Model) which has standard find() method
- Fixes 500 error: Call to undefined method IpdBillingModel::getById
2026-06-10 13:14:27 +05:30
54d120e2bb Fix IPD status toggle route registration
- Rename toggleIpdStatus() to updateDischargeToggleStatus() to match naming pattern
- Add route mapping for /billing/ipd/panel/{id}/discharge/toggle-status endpoint
- Fixes 404 error when clicking toggle button in discharge panel
- Follows same pattern as other discharge operations (discount, charge, update)
2026-06-10 13:10:03 +05:30
c437652b79 Add IPD status management with strict ipd_status check
- Update isIpdDischargedInvoice to check ONLY ipd_status field (remove fallback checks)
- Add IPD status toggle UI in discharge panel (Active/Discharged control)
- Create toggleIpdStatus controller method with permission check
- Add billing.ipd.status.manage permission for controlling bill edit lock
- Allows editing bills when needed by toggling status independently of discharge_date
- Auto-releases bed when setting status to discharged
2026-06-10 12:55:47 +05:30
d722714ef1 feat: Complete bed management system with transfer and time tracking
- Implemented automatic bed release on patient discharge
- Added bed transfer functionality in nursing workspace
- Added date/time tracking for bed assignments with duration calculation
- Fixed bed_master.current_ipd_id as source of truth for occupancy
- Created data fix scripts for existing records
- Added bed assignment history with duration display (hours/minutes)
- Fixed display issues in bed assignment tab
- Added route for bed transfer endpoint
- Supports custom assignment datetime for backdated entries
- Automatically marks previous bed as released on transfer
2026-06-09 08:39:48 +05:30
52f5041c5c Add dynamic margin system for letterhead printing - 5cm top, 2cm bottom when header hidden 2026-06-08 17:21:54 +05:30
0568851783 Add Print Header checkbox for IPD bill printing - allows printing on letterhead 2026-06-08 17:18:02 +05:30
aa812354a6 Change mPDF default font from thin dejavusans to medium-weight freeserif for better Hindi/Devanagari rendering
- Updated all controllers: Opd, Diagnosis, Billing\Charges, Billing\Ipd, Storestock, AbdmGateway
- freeserif provides better Unicode coverage and more readable font weight
- Ipd_discharge and DoctorDocument already used good fonts (freeserif/freesans)
- Added comprehensive font configuration documentation
2026-06-06 11:19:35 +05:30
a572bbabae Simplify org-case queries to match CI3 pattern
Changed from complex string comparisons to simple integer comparisons matching legacy CI3 code:

OPD query (CI3 pattern):
- OLD: o.insurance_case_id = cast(c.id as char) OR o.insurance_case_id = c.case_id_code
- NEW: o.insurance_case_id = c.id (integer comparison)

Invoice query (CI3 pattern):
- OLD: i.insurance_case_id = c.id OR i.insurance_case_id = c.case_id_code (with NULL/0 checks)
- NEW: i.insurance_case_id = c.id (integer comparison)

Schema notes:
- opd_master.insurance_case_id: int(11)
- invoice_master.insurance_case_id: varchar(50) (but stores numeric IDs)

MySQL varchar→int conversion handles this correctly:
- '4997' → 4997 (matches)
- '0' → 0 (doesn't match 4997)
- 'C26060004997' → 0 (doesn't match 4997)

Applied to:
- getOrganizationCaseInvoiceRows() union query
- updateOrgTotals() aggregate queries
- search() case list query
2026-06-05 14:14:22 +05:30
ba9d17d5e6 Fix org-case invoice query: exclude empty insurance_case_id
Root cause: 50k+ invoices had insurance_case_id='0', and MySQL string comparison '0'='C26060004997' matched (both convert to numeric 0).

Fix: Exclude NULL/empty/'0' insurance_case_id before comparison in:
- getOrganizationCaseInvoiceRows() union query
- updateOrgTotals() aggregate queries

Result: Case C26060004997 now returns 9 rows instead of 56,786 (memory crash fixed)
2026-06-05 14:09:26 +05:30
4c5e0748bb Revert patient ID fallback - use insurance_case_id only 2026-06-05 13:55:50 +05:30
e80e18600d Fix org-case invoice scoping 2026-06-05 13:49:58 +05:30
6e3a355e03 Fix org case invoice and discharge PDF rendering 2026-06-05 13:43:19 +05:30
499a9bea31 fix(orgcase): fallback invoice linkage by patient and case 2026-06-05 11:45:01 +05:30
bd820a7939 fix(orgcase): use insurance amount1 in union invoice query 2026-06-05 11:37:23 +05:30
e7d6dd88d2 fix(orgcase): avoid missing discount column in union query 2026-06-05 11:34:52 +05:30
9f1d5b93e6 fix(orgcase): restore legacy union invoice rows 2026-06-05 11:32:01 +05:30
48222bb689 fix(orgcase): include OPD rows linked by case code 2026-06-05 11:27:24 +05:30
700741ab9b Fix billing case creation reusing old records 2026-06-04 15:55:08 +05:30
d16a363a92 fix: recalculate IPD billing on panel open, bill-details, and print 2026-04-10 21:11:24 +05:30
90ac310cf0 Port CI3 vitals chart and treatment chart forms to CI4 IPD form print (form_no 6 and 7) 2026-04-09 04:26:09 +05:30
935d6edd0b Keep IPD charges visible when optional tab queries fail 2026-04-08 11:52:27 +05:30
cbe861ad53 Guard IPD tab panel-data load to prevent remote ipd-charges 500 2026-04-08 11:48:48 +05:30
d003c67b1e Harden IPD charges tab render to avoid Whoops on remote 2026-04-08 11:45:25 +05:30
2977192017 Make IPD forms dynamic and stop stale OPD refresh polling 2026-04-08 11:41:33 +05:30
1a2dbf5366 feat: upgrade IPD Document Master to OPD-style print builder
- 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
2026-04-08 07:56:43 +05:30
2fc4fbd82c fix: use Unicode-compatible Hindi fonts for IPD form PDF rendering 2026-04-06 09:17:48 +05:30
062fc7ab32 feat: Add ABDM Task Board module with ABHA workflow
- Add ABDM sidebar heading and Task Board nav link
- Create migration 000040: abdm_work_tasks table
- Add AbdmTaskBoard controller with backfill methods
- Add AbdmWorkTaskService for task creation/deduplication
- Add AbdmGateway controller for ABDM API integration
- Separate task types: patient_abha_create vs patient_abha_update
- Add lab_report_publish and radiology_report_publish task types
- Patient.php: auto-create ABDM tasks on registration
- Diagnosis.php: auto-create tasks on report verify/finalize
- Task board UI: 7 filter buttons with default Unupdated ABHA view
- Fix SQL crash in backfillLabRadiologyTasks (dynamic column detection)
- Improve load_form AJAX error display with HTTP status + response text
- Add ABDM routes in Routes.php
- Add FHIR R4 builder library updates
- Add bridge sync service updates
2026-04-05 23:42:24 +05:30
fd28d6a01e IPD cash balance: fix date range picker submission and parser 2026-04-03 14:13:05 +05:30
435192f81a IPD payment receipt: fix modal loader, add PDF print route, and bank mode details 2026-04-03 13:29:03 +05:30
fe1156b68a Fix billing invoice balance/payment flow and deduction UI 2026-04-01 07:23:29 +05:30
911e7b50a7 Add Ayushman package import, billing claim sheet, and reporting dashboards 2026-03-26 15:42:40 +05:30
99ec71677a Restore legacy HMS flows and add IPD document master templates 2026-03-24 04:24:19 +05:30
38093da3b9 Implement IPD admission/discharge editing, bill PDF modes, and invoice list view action 2026-03-21 15:47:18 +05:30
addef91468 Fix legacy billing prints and pathology template compatibility 2026-03-21 02:23:31 +05:30
aa845ac5ff Add report panel updates and related billing/discharge enhancements 2026-03-10 02:43:35 +05:30
614713f76b Implement OPD template builder, doctor template selection, and OPD print integration fixes 2026-02-27 19:44:36 +05:30