gdc_cmod/app/Views/report/template.php
mahdahar 0b4fdcfe5f feat: Extend audit trail with tube received tracking and enhance PDF workflow
Major Updates:

1. Extended Audit Trail System
   - Added tube received events tracking from SP_TUBES table (TUBESTATUS=4)
   - New audit tab "Receive" in dialog_audit.php to display tube reception history
   - ApiRequestsAuditController now fetches and returns tube received events with:
     * Sample type, tube status, collection date, and user information
   - Audit events sorted chronologically combining validation, sampling, and receiving events

2. Enhanced PDF Generation Workflow
   - Created new PdfHelper library with methods for PDF generation and posting to spooler
   - Reports can now be generated via GET /report/{accessnumber}/pdf endpoint
   - Updated PDF spooler API endpoint from port 3030 to 3000
   - Added retry PDF button with spinner animation for failed generations
   - Fixed PDF status check to use correct spooler endpoint

3. Validation UI Improvements
   - Added toast notification showing PDF queued after second validation (val2)
   - Retry PDF button appears when val1 and val2 are complete
   - Toast notifications success/error states with auto-dismiss after 2 seconds
   - Loading state with spinning icon during PDF retry operation

4. Report Template Fixes
   - Fixed typo in Val2 By display (added missing ":")
   - Consistent formatting with Val1 By : and Val2 By :

5. Documentation Updates
   - TODO.md updated with:
     * Auto generate PDF (in progress)
     * Print Eng Result (pending)
     * Add Receive to Audit (completed)

6. Cleanup
   - Removed legacy Node.js spooler implementation (node_spooler directory)
   - Deleted P0_log.txt (SQL setup scripts no longer needed in repo)
   - Cleaned up .gitignore to remove stale node_spooler entries

Files Changed:
- app/Controllers/ApiRequestsAuditController.php (tube received audit)
- app/Controllers/ReportController.php (port update: 3030 → 3000)
- app/Libraries/PdfHelper.php (new library)
- app/Views/report/template.php (typo fix)
- app/Views/shared/content_requests.php (retry PDF button)
- app/Views/shared/dialog_audit.php (receive tab)
- app/Views/shared/script_requests.php (retry handler, tube events)
- app/Views/shared/script_validation.php (enhanced toast)
- TODO.md (pending/completed tasks)
- .gitignore (cleanup)
- Deleted: node_spooler/* (legacy implementation)
- Deleted: P0_log.txt (no longer needed)
2026-02-04 11:09:42 +07:00

150 lines
5.3 KiB
PHP

<!DOCTYPE html>
<html lang="en">
<head>
<meta http-equiv='Content-Type' content='text/html; charset=utf-8' />
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Lab Report - <?= esc($accessnumber) ?></title>
<link rel='stylesheet' href='<?= base_url('assets/report/normalize.min.css') ?>'>
<?php if (isset($ispdf) && $ispdf == 1): ?>
<link rel='stylesheet' href='<?= base_url('assets/report/pdf.css') ?>'>
<?php else: ?>
<link rel='stylesheet' href='<?= base_url('assets/report/style.css') ?>'>
<?php endif; ?>
</head>
<body style='-webkit-print-color-adjust:exact;'>
<?php
$othertitle = $eng == 1 ? "Non Laboratory Test" : "Pemeriksaan Non Laboratorium";
$npage = count($result);
$i = 1;
?>
<?php foreach ($result as $page): ?>
<div id='page'>
<div id='pagetop' style='height:0.01cm'></div>
<?php if (isset($ispdf) && $ispdf == 1): ?>
<img src='<?= base_url('assets/report/gleneagleshdr.png') ?>' class='img'/>
<?php endif; ?>
<div id='dinfo'>
<?= $info ?>
</div>
<div id='dresult'>
<table class='result'>
<colgroup>
<col style='width:26%;'></col>
<col style='width:10%;'></col>
<col style='width:15%;'></col>
<col style='width:12%;'></col>
<col style='width:10%;'></col>
<col style='width:15%;'></col>
<col style='width:12%;'></col>
</colgroup>
<tr>
<th rowspan='2' style='border-right:solid 1px black; border-bottom:solid 1px black;'>TEST</th>
<th colspan='3' style='border-right:solid 1px black;'>CONVENTIONAL</th>
<th colspan='3'>INTERNATIONAL</th>
</tr>
<tr style='border-bottom:solid 1px black;'>
<th>RESULT</th>
<th>REF. RANGES</th>
<th style='border-right:solid 1px black;'>UNIT</th>
<th>RESULT</th>
<th>REF. RANGES</th>
<th>UNIT</th>
</tr>
<?= $page ?>
</table>
<?php if ($i == $npage): ?>
<?= $noSample ?>
<table>
<tr><td>Note :</td> <td><pre><?= esc($notes) ?></pre></td></tr>
</table>
<br/>
<?php if ($others != '' && substr_count($others, "\r") + substr_count($result[$npage], "\r") < 38): ?>
<table>
<tr><td><b><?= esc($othertitle) ?>:</b><br/>
<?= $others ?></td></tr>
</table>
<?php $others = ''; ?>
<?php endif; ?>
<?php endif; ?>
</div>
<div id='footer'>
<table class='footer'>
<tr>
<td>
<?php if ($i == $npage): ?>
Status : <?= esc($status) ?>
<?php endif; ?>
<pre class='small'>Collected on <?= esc($collData) ?>
Received on <?= esc($recvData) ?>
Val1 By : <?= esc($val1User) ?> | Val2 By : <?= esc($val2User) ?>
Page <?= $i ?>/<?= $npage ?> Printed By : <?= esc($valBy) ?> <?= esc($date) ?></pre>
</td>
<td class='right'>
<pre><b>&rdquo;This result is valid without signature.&rdquo;</b></pre>
</td>
</tr>
</table>
</div>
<?php if (isset($ispdf) && $ispdf == 1): ?>
<img src='<?= base_url('assets/report/gleneaglesftr.png') ?>' class='img img-footer'/>
<?php endif; ?>
</div>
<?php
$i++;
endforeach;
?>
<?php if ($others != ''): ?>
<div id='page'>
<div id='pagetop' style='height:0.01cm'></div>
<?php if (isset($ispdf) && $ispdf == 1): ?>
<img src='<?= base_url('assets/report/gleneagleshdr.png') ?>' class='img'/>
<?php endif; ?>
<div id='dinfo'>
<?= $info ?>
</div>
<div id='dresult'>
<table class='others' style='width:15cm'>
<tr><td><b><?= esc($othertitle) ?> : </b><br/>
<?= $others ?></td></tr>
</table>
</div>
<div id='footer'>
<table class='footer'>
<tr>
<td>
Status : <?= esc($status) ?>
<pre class='small'>Collected on <?= esc($collData) ?>
Received on <?= esc($recvData) ?>
Val1 By : <?= esc($val1User) ?> | Val2 By <?= esc($val2User) ?>
Page <?= $i ?>/<?= $npage ?> Printed By : <?= esc($valBy) ?> <?= esc($date) ?></pre>
</td>
<td class='right'>
<pre><b>&rdquo;This result is valid without signature.&rdquo;</b></pre>
</td>
</tr>
</table>
</div>
<?php if (isset($ispdf) && $ispdf == 1): ?>
<img src='<?= base_url('assets/report/gleneaglesftr.png') ?>' class='img img-footer'/>
<?php endif; ?>
</div>
<?php endif; ?>
</body>
</html>