This commit expands report generation capabilities to Customer Service (CS) role
and refactors the report system for better maintainability and PDF support.
Changes Summary:
Access Control:
- Extended report access from Lab, Admin, Superuser to include CS role (filter: 0,1,2,4)
- Removed separate CS-only print routes, consolidated into unified report routes
- Routes now support /report/:num, /report/:num/eng, /report/:num/print, /report/:num/print/eng
Controller Refactoring (ReportController):
- Refactored generate() and print() methods to share common renderReport() logic
- Removed separate preview() method - preview now handled via preview parameter
- Added ispdf parameter support for PDF generation mode
- Print functionality now logs audit events to AUDIT_REQUESTS table
Database Queries (ReportHelper):
- Improved SQL queries with explicit aliases for better readability and maintainability
- Fixed date formatting issue: changed date_format() to date() with strtotime()
- Added getValData() method to retrieve validation user information (VAL1USER, VAL2USER)
- Added null coalescing operators (?? '') for safer array access
View Updates (report/template.php):
- Conditional CSS loading: uses pdf.css when ispdf=1, otherwise style.css
- Removed "PREVIEW ONLY - DO NOT PRINT" watermark
- Conditional header/footer images - only display when generating PDF
- Added validation user display: "Val1 By : {user} | Val2 By : {user}"
- Replaced signature placeholder with "This result is valid without signature" statement
- Improved footer layout spacing
Styling Adjustments (public/assets/report/style.css):
- Adjusted margins for better print layout: dinfo (2cm), dresult (17.5cm), footer (2cm)
- Increased footer width from 17cm to 18cm
- Added responsive image classes: .img and .img-footer with max-width: 100%
- Set footer image max-height to 2.5cm
Security:
- Maintained role-based access control with proper authentication checks
- All database queries use parameterized statements (no interpolation)
- Print actions still logged to AUDIT_REQUESTS for audit trail
31 lines
1.2 KiB
CSS
31 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.5pt; margin:0;}
|
|
body { -webkit-print-color-adjust:exact; }
|
|
#page { z-index:1; background: white; display: block; margin: 0; page-break-after:always;
|
|
/*width: 210mm; height: 297mm;*/
|
|
width: 210mm; height: 297mm;
|
|
}
|
|
#dinfo { float:right; margin:2cm 0.8cm 0 0; }
|
|
#dresult { float:left; margin: 0.2cm 0.8cm 0 1.5cm; height: 17.5cm; }
|
|
#footer { float:left; margin:0cm 2cm 0 1.5cm; height:2cm; }
|
|
|
|
table {border-collapse:collapse;}
|
|
td {vertical-align:top;}
|
|
th,td { line-height:1.3;}
|
|
|
|
.result tr:nth-child(even), th { background: #f2f2f2; }
|
|
.info { border:solid 1px black; 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 : 18cm; }
|
|
.footer td {vertical-align:bottom;}
|
|
td.right { text-align: right; }
|
|
|
|
#notes { margin: 5mm 0 0 10mm; }
|
|
|
|
.footer-img { visibility:hidden; }
|
|
.img { max-width: 100%; height: auto; }
|
|
.img-footer { max-width: 100%; height: auto; max-height: 2.5cm; }
|
|
|
|
pre.small {font-size:6pt;} |