<!DOCTYPE html>
<html lang="en">
<head>
<meta http-equiv="Content-type" content="text/html; charset=[% settings.charset %]" />
<title>HMDS Draft Reports</title>
<style type="text/css">
#specimen table { margin-left: 2em; }
#specimen { page-break-inside: avoid; }
#reports { width: 95%; border-collapse: collapse; }
td, th { font-size: small; border: none; padding: 2px 5px; }
th { color: #990000; background: #d9edf7; }
h3, h4 { color: #110781; }
</style>
</head>
<body>
[% # INCLUDE dumper.tt dump = data.reports %]
[% # INCLUDE dumper.tt dump = data.specimen %]
[% # INCLUDE dumper.tt dump = session %]
[% user = session.user_profile %]
<h3>HMDS draft reports [[% user.first_name.ucfirst %] [% user.last_name.ucfirst %]]</h3>
[% USE format; zero_padded = format('%02d'); # ensure zero-padded req. num. %]
<table id="reports">
<tr>
<td></td>
<th>Lab Num</th>
<th>Specimen</th>
<th align="left">Diagnosis</th>
<th>Reported</th>
</tr>
[% FOREACH r IN data.reports %]
<tr>
<td align="right">[% loop.count %].</td>
<td>[% r.request_number; '/'; zero_padded(r.year - 2000) %]</td>
<td>[% r.specimen %]</td>
<td>[% r.diagnosis %]</td>
<td align="center">[% r.created_at.strftime('%d.%b.%Y') %]</td>
</tr>
[% END %]
</table>
<div id="specimen">
<h4>Specimen breakdown</h4>
<table>
<tr>
<th>Specimen</th>
<th>n</th>
</tr>
[% FOREACH s IN data.specimen; # INCLUDE dumper.tt dump = s; # hashref %]
<tr>
<td>[% s.id %]</td>
<td align="right">[% s.n %]</td>
</tr>
[% END %]
</table>
</div>
</body>
</html>