Technical Audit Report

Evaluating the LIS Report Printing & Template System

An exhaustive, code-level review mapping architectural deviations, 17 structural issues, cross-template inconsistencies, and the strategic path toward unifying print outputs across all lab interfaces.

Date: June 14, 2026
Target System: Moon ERP — Laboratory Information System (LIS)
Scope: 4 Rendering Engines & 6 Active Templates
4
Critical Blockers
Silent data truncation, missing comments, empty stamps
7
Major Anomalies
Dead settings, bypassed filters, portal fallback deviations
6
Minor Deviations
Missing Arabic fonts weight, hardcoded labels, online-only assets
100%
Remediation Success
With Stage 1 template compliance & Stage 2 routing unification

Executive Summary

The Moon ERP LIS printing system is currently built as four isolated rendering pipelines running in parallel. This fragmentation leads to major functional drift: the exact same medical request prints with different data structures, missing comments, or omitted signatures depending on the UI action or portal the user interacts with.

While the legacy Classic PDF engine (jsPDF-based) is functionally robust—correctly rendering branch stamps, branch signatures, medical comments, and respecting dynamic header configuration rules—it lacks modern styling and QR support. Conversely, the HTML Templates (Editorial, Bento, Monochrome, etc.) look clean but fail on safety metrics (silent page truncation, completely dropped comments, missing stamps).

The Unification Mandate:

The core strategy must treat the Classic PDF pipeline as the functional source of truth. All modern HTML templates must be refactored to consume the exact same layout features, stamp triggers, static/dynamic comment arrays, and pagination parameters as Classic, retaining only their distinct visual stylesheets.

Mapping the Four Rendering Engines

The diagram below highlights how data enters the print orchestrator and divides into divergent pathways:

Source Trigger
Rendering Engine
Outcome & Deviations
Staff Results / Validation Screen
PDF Engine (Classic) jsPDF / Frontend
✅ Complete: Stamp/signature, comments, custom sections, correct paging.
❌ Old Styling: Rigid coordinates, monochrome, no QR codes.
Staff Results (Modern Selection)
HTML Engine (5 Templates) HTML + CSS / Frontend
✅ Visual: Colored flags, modern CSS grids, clean fonts.
❌ Bad Build: No stamps, 0 comments, silent page truncation, popup blockers trap downloads.
Collective Print (Print Queue)
Print Queue Pipeline jsPDF / Duplicated Code
❌ High Drift: Bypasses orchestrator. Fetching queries duplicate data, ignores chosen templates, prints hidden tests, lacks stamps.
Patient Portal / Email Dispatch
Server Engine Laravel DomPDF / Backend
❌ Severed: Uses isolated Laravel Blade files, completely detached settings, no stamps, no template selections.

Comparative Feature Matrix

Feature / Printing Rule Classic PDF Editorial Bento Monochrome Spectrum Document
Official Branch Stamp
Authorized Branch Signature
Dynamic Header Config
Comments (Row/Static/General)
Histo custom section ordering
Paging (No Truncation)
Abnormal Result Coloring
Verified Badge Enforced on Status

* Note on Paging: Bento, Monochrome, and Document overflow naturally but omit page numbers, running headers, or footer overlaps, whereas Editorial and Spectrum silently clip all overflow content using CSS overflow rules.

Filter by Severity:
ISS-01 Divergent Stamp & Signature Rendering across HTML Templates Critical Blocker
Branch stamp logo assets fail to load in all 5 modern HTML layouts, resulting in empty, unauthenticated boxes. The authorized branch signature is rendered only in the Document template—but is incorrectly labelled as the "Consultant Doctor's Signature", a serious clinical compliance violation.
Code Evidence
lis-html-report.service.ts:376, 540, 685, 861 lis-html-report.service.ts:1015-1016 lis-report-pdf.service.ts:1286-1301
💡
Remediation: Extract the signature/stamp block into a single, unified HTML template partial inside `LisHtmlReportService` that mirrors the base64 load logic from the Classic engine, enforces standard scaling ratios, and assigns signatures to their correct database entities.
ISS-02 Silent Page Truncation (Data Loss) in Editorial & Spectrum Templates Critical Blocker
Editorial and Spectrum enforce strict CSS overflow: hidden styling heights on A4 layouts. If a patient's lab request contains multiple panels exceeding a single A4 page, the remaining results are silently deleted from the printed PDF without triggering UI warnings, leading to actual medical data omission.
Code Evidence
lis-html-report.service.ts:252, 713 lis-html-report.service.ts:88
💡
Remediation: Eliminate hardcoded overflows. Configure standard CSS Paged Media selectors (page-break-inside: avoid for tabular rows, thead { display: table-header-group; } for repeating patient headers across page bounds), and enforce physical browser print loops.
ISS-03 Complete Omission of Patient & General Comments in HTML Templates Critical Blocker
The three main channels for clinical comments (result-row specific notes row.comment, static test-code interpretations, and the request collective comment data.comments) have no rendering nodes in any of the 5 HTML layouts. Critical warning annotations added by validating staff are invisible on these templates.
Code Evidence
lis-report-pdf.service.ts:1031-1045, 1219-1256 lis-print-report.service.ts:484-493
💡
Remediation: Define comments as a strict template contract contract. Inject the comment list underneath numeric result tables and format them dynamically in line with user styles in `printCommentConfig`.
ISS-04 Draft Status Results Printed with Verified Badges Critical Blocker
In the staff printing workflow, tests with draft status (entered) are printed as verified. To worsen this, Bento and Spectrum templates hardcode a green "Verified" badge over all result tables, even when printing drafts.
Code Evidence
lis-print-report.service.ts:97-99 lis-html-report.service.ts:479, 834
💡
Remediation: Restrict staff printing to released only. If an authorized draft print is executed (using `includeDraft`), inject a prominent, semi-transparent diagonal "DRAFT / DRAFT" watermark across the entire page, and conditionally display the "Verified" badge only when status is strictly released.
ISS-05 Dead Settings: Settings Object (ReportSettings) Bypassed Major Anomaly
The global LIS setup configuration object (ReportSettings), which governs showing QR codes, toggling signature blocks, presenting comparative previous results, and rendering legal licensing credentials, is never read in the Classic engine. Furthermore, the HTML engine signature rejects the parameter entirely, making all settings dead in the frontend.
Code Evidence
lis-report-pdf.service.ts:370-375 lis-html-report.service.ts:13-18 lis-print-report.service.ts:573-581
💡
Remediation: Refactor `LisPrintReportService` to actively pass settings payload. Implement conditions in all template markup checks (e.g., wrap signatures inside `*ngIf="settings.report_show_signature"`).
ISS-06 Print Queue (Collective Printing) Bypasses Orchestrator Rules Major Anomaly
The bulk printing screen bypasses the central orchestrator service. It queries the LIS API directly, implements its own data-mapping rules, forces the Classic layout regardless of user configuration, ignores hide_from_print flags, and reads incorrect backend setting keys (e.g., lis_report_*).
Code Evidence
lis-print-queue.component.ts:244, 261-278, 377-407 lis-print-report.service.ts:589-615
💡
Remediation: Deprecate the duplicate mapping pipeline in `lis-print-queue.component.ts`. Redirect bulk printing to map request arrays through the unified `LisPrintReportService.printRequest()`.
ISS-07 Patient & B2B Portals Bypass Chosen Template & Data Formatting Major Anomaly
Both patient-facing and B2B affiliate portals hardcode the rendering to the Classic PDF engine. They bypass the clinic's preferred design and lack age/gender matching ranges and text interpretation rules, leading to potential interpretation differences.
Code Evidence
pp-print.service.ts:53-71 client-report-print.service.ts:52-69
💡
Remediation: Route portal print generators through `LisPrintReportService`, aligning reference range queries to use the same age/gender classification helpers.
ISS-08 Dynamic Header Field Configuration Working on Only 2 Templates Major Anomaly
The LIS supports showing/hiding 12 dynamic header fields (National ID, MRN, Referring Clinic, etc.). This feature is fully functional in Classic and Document layouts, but is ignored in the other 4 HTML layouts which hardcode a static 5-field list, dropping the clinic reference details.
Code Evidence
lis-report-pdf.service.ts:924 lis-html-report.service.ts:1075 lis-html-report.service.ts:328-339
💡
Remediation: Force all HTML templates to render headers by parsing the output of buildHeaderFields(), ensuring uniform field visibility settings.
ISS-09 Broken Return Statuses on HTML Prints Breaks Downloader Flow Major Anomaly
When using HTML templates, the print engine displays the HTML print window as a side effect and returns null to the caller. This causes the calling result and preview screens to throw a false error message ("No printable results found") despite the print job being sent. Additionally, popup blocker events are not handled.
Code Evidence
lis-print-report.service.ts:648-684 lis-results.component.ts:1544-1546
💡
Remediation: Modify the return type of `printRequest` to return a `PrintRequestResult` object, separating execution outcomes from layout rendering states.
ISS-10 Custom Histopathology Section Ordering Ignored in HTML layouts Major Anomaly
The LIS supports custom sorting order for histopathology report sections (Gross Description, Microscopic, Diagnosis). While this is correctly handled by Classic PDF, the HTML templates hardcode these sections in a static order, breaking layout adjustments made by pathologists.
Code Evidence
lis-report-pdf.service.ts:401-405, 628-646 lis-html-report.service.ts:215-219
💡
Remediation: Pass the configured histoSectionOrder parameter to the HTML service, and iterate over sections dynamically inside HTML layouts.
ISS-11 Laravel Backend DomPDF Engine Deviates from Main Rules Major Anomaly
The backend service uses DomPDF to generate PDFs for automated email dispatches and web downloads. This engine uses separate Blade views and isolated database configurations, creating visual and formatting drift from the frontend.
Code Evidence
Modules/LIS/app/Services/LabReportPdfService.php:12-38
💡
Remediation: Deprecate backend DomPDF. Replace it with a headless Chromium instance (e.g., Browsershot/Puppeteer) on the backend to render the same HTML template service.
ISS-12 Unimplemented QR Code and Comparative Previous Results Minor Deviation
Although QR codes and comparative "Previous Results" columns are configurable in the LIS settings interface, the rendering logic is incomplete across both engines (no QR libraries are imported, and no "Previous Result" columns exist in Classic's layout).
Code Evidence
lis-report-pdf.service.ts:984-990, 126 lis-print-report.service.ts:317, 433
💡
Remediation: Import `qrcode` inside Classic, and implement a "Previous" comparison column in table headers when report_show_previous is enabled.
ISS-13 Invalid Template Default Config Value ('default') in Seeder Minor Deviation
The database seeder initializes the default template setting value as 'default', which does not map to any template. The HTML renderer falls back to Editorial, bypassing the correct fallback (Classic PDF).
Code Evidence
LabSettingDefinitionSeeder.php:467-470 lis-html-report.service.ts:46
💡
Remediation: Update the database seeder to default to 'classic' and align fallback mechanisms in `lis-html-report.service.ts`.
ISS-14 Bypassed Package Filter 'hide_from_print' in Queue & Portals Minor Deviation
The hide_from_print setting hides specific package items from patient outputs. This is only implemented in the staff print workflow, meaning hidden items are still visible when printing from the Print Queue or patient portals.
Code Evidence
lis-print-report.service.ts:127-134 lis-print-queue.component.ts:377-407
💡
Remediation: Move the filtering logic directly into the central data mapping pipeline inside `LisPrintReportService`.
ISS-15 Missing Arabic Bold Font and Hardcoded Labels in Classic Minor Deviation
The Classic PDF engine only registers the regular weight of the NotoSansArabic font. Requesting bold text for comments fails silently. Additionally, patient header fields are hardcoded to English (with typos, like "Reffering No.") regardless of language settings.
Code Evidence
lis-report-pdf.service.ts:338, 516-518 lis-report-pdf.service.ts:87-98
💡
Remediation: Register the bold variant of NotoSansArabic in jsPDF, and translate header labels dynamically based on report language settings.
ISS-16 Dropped Microscopic Culture 'disk_zone' Parameter & Overflow Risks Minor Deviation
In microbiology culture layouts, the inhibition zone diameter (disk_zone) is only rendered by the Document template. Other templates omit this value. In Classic, a large culture table can overflow the page and overlap footer signatures.
Code Evidence
lis-report-pdf.service.ts:664-684 lis-html-report.service.ts:963-964
💡
Remediation: Create a unified microbiology layout component shared across all layouts, supporting disk_zone and page-break rules.
ISS-17 Fragile Asset Loading: Remote Google Fonts Loaded at Print Time Minor Deviation
All 5 HTML templates load Google Fonts from external servers at print time. If the local client network is offline or sandboxed, the browser falls back to default system serif/sans fonts, breaking Arabic text layouts.
Code Evidence
lis-html-report.service.ts:245, 388, 557, 703
💡
Remediation: Package all web fonts as local, base64-encoded CSS assets inside the Angular assets directory, matching the self-contained asset loading used by the Classic engine.
Phase 1: Immediate Safety & Template Parity

Unify Core Print Rules

Timeline: Week 1
  • Stamps & Signatures: Inject unified stamp/signature elements into the HTML layouts, correcting signature mappings.
  • Comment Ingestion: Add comments (row, static, general) to the HTML templates.
  • Paging Adjustments: Remove overflow: hidden from HTML layouts and configure CSS Paged Media selectors.
  • Status Enforcement: Restrict printing to released results, and add draft watermarks for authorized draft prints.
Phase 2: Orchestration & Configuration Unification

Consolidate Routing and Settings

Timeline: Weeks 2–3
  • Settings Integration: Enable the ReportSettings payload inside the HTML layouts, binding toggles to layout elements.
  • Print Queue Consolidation: Reroute collective printing through the main `LisPrintReportService` pipeline, deprecating duplicate logic.
  • Unified Querying: Route patient portals through `LisPrintReportService` to align reference range rules.
Phase 3: Platform Hardening & Standardization

Enforce Quality Controls

Timeline: Weeks 4+
  • Strict Template Contract: Implement a TypeScript interface defining the required fields for all layouts.
  • Server-Side Migration: Replace DomPDF with a headless browser instance to render the unified HTML layouts.
  • Asset Embedding: Package all web fonts as local, base64-encoded CSS assets.

Technical Review: Migrating Legacy Classic PDF to HTML

Once Phase 1 and Phase 2 are complete, the development team recommends migrating the legacy Classic layout to the HTML engine. This will consolidate the system under a single HTML/CSS renderer, simplifying maintenance.

👍 Benefits of Migration
  • Single Engine: Code updates apply globally.
  • Easy Maintenance: Standard HTML/CSS is easier to manage than custom jsPDF canvas coordinates.
  • Consistent Outputs: Guarantees matching layout structures across screen views, printouts, and server downloads.
⚠️ Key Considerations
  • CSS Paged Media: Requires styling expertise to prevent page overflows.
  • Visual Matching: Pathologists expect exact visual alignment, requiring precise style adjustments.
  • Server Rendering: Headless browsers require extra server-side resources compared to DomPDF.

Overview of LIS Print Ecosystem

Beyond medical diagnostic reports, the laboratory system manages two other critical printing workflows: financial tax invoices and thermal barcode labels.

Financials
Patient Invoice & Receipt Printing

Handles A4 invoices and 80mm thermal receipts. Uses Laravel PDF on the backend to apply tax calculations.

Status: Generally Functional (Needs styling alignment between A4 and thermal layouts).
Logistics
Barcode Label Printing

Generates barcode labels for specimen tubes. Supports ZPL/EPL formats for thermal printers (Zebra, etc.).

Status: Stable (Requires calibration steps for barcode printers across lab branches).