mahdahar 31acb6bf33 feat: Implement comprehensive report generation system with role-based access control
Add native CodeIgniter 4 report generation functionality replacing legacy spooler_db system.
Provides centralized report generation with audit logging and multi-language support.

New Features:
- Report generation with Indonesian and English language support
- Role-based access control (Lab, Admin, Superuser: generate; CS: print only)
- Preview mode for validation workflow
- Print audit logging to AUDIT_REQUESTS table
- Multi-page report support with proper pagination
- Dual unit system (Conventional and International units)

Controllers:
- ReportController: Main controller for report generation, preview, and print
  - generate(): Full report with audit logging
  - preview(): Preview mode without audit logging
  - print(): Print-only access for CS role
- Home::printReport(): Route handler redirecting based on user role

Libraries:
- ReportHelper: Comprehensive report data retrieval
  - Patient information (name, MR number, demographics, referral)
  - Test results with reference ranges and unit conversions
  - Collection and reception data with timestamps
  - Validation status and validator information
  - Special handling for pending samples and Chinese translations

Routes:
- /report/(:num) - Generate report (Lab, Admin, Superuser)
- /report/(:num)/preview - Preview without audit logging
- /report/(:num)/eng - English language report
- /report/print/(:num) - Print-only access (CS role)
- /print/(:num) - Redirect based on role (all roles)

Views:
- report/template.php: Professional lab report template with Gleneagles branding
  - Header and footer images
  - Patient information table
  - Test results with dual unit columns
  - Collection and reception timestamps
  - Authorization signature area
  - Preview watermark

Role Index Views:
- Removed dialog_preview.php inclusion from all role dashboards
- Consolidated print button directly linking to new report routes

Assets:
- Report-specific CSS files (normalize.min.css, style.css, pdf.css, style_qr.css)
- Gleneagles header and footer images
- Legacy spooler_db files preserved in public/spooler_db/ for reference

Tests:
- ReportTest.php: Unit tests for report generation functionality

Database:
- Uses existing tables: REQUESTS, TESTS, DICT_TESTS, SP_REQUESTS, PATIENTS
- Inserts print audit records into AUDIT_REQUESTS table

Security:
- Parameterized queries throughout (SQL injection prevention)
- Role-based access control enforced at route level
- Proper output escaping with esc() in views
2026-02-02 16:54:22 +07:00

34 lines
1.2 KiB
CSS

/*html,pre,th,table { font-family:'Courier New', Courier, monospace; font-size:7.8pt; margin:0;}*/
html,pre,th,table { font-family:'Lucida Console', Monaco, monospace; font-size:7.7pt; margin:0;}
#page { background: white; display: block; margin: 0 auto; page-break-after:always; width: 210mm; height: 295mm; }
#dinfo { float:left; width:200mm;
background-size: 100% auto; background-repeat: no-repeat;
margin-left:0.5cm;
}
#dresult { float:left; margin: 0.2cm 0.8cm 0 1.5cm; height: 18cm; }
#footer { float:left; margin:0cm 2cm 0 1cm; height:1.5cm; }
table {border-collapse:collapse;}
td {vertical-align:top;}
th,td { line-height:1.3;}
.result tr:nth-child(even), th { background: #DDD !important; }
.info { border:solid 1px black; margin:-1cm 0 0 8.5cm; width:11cm;}
.flag { float:right; top:0; font-weight:bold; }
.result { table-layout:fixed; border:solid 1px black; width:100%; }
.textC { font-size:7pt; }
.footer {width : 17cm; }
.footer td {vertical-align:bottom;}
td.right { text-align: right; }
#notes { margin: 5mm 0 0 10mm; }
.img { width:200mm; margin-left:0.5cm }
.img-footer { margin-bottom:7.5mm }
pre.small {font-size:6pt;}
@media print {
@page { margin:0; size:210mm 297mm; }
}