<!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";
$result = array_values($result);
$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 - 1], "\r") < 39): ?>
                    <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) ?> (<?= esc($val1Date) ?>) | Val2 By : <?= esc($val2User) ?> (<?= esc($val2Date) ?>) 
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) ?> (<?= esc($val1Date) ?>) | Val2 By : <?= esc($val2User) ?> (<?= esc($val2Date) ?>)
Page <?= $npage + 1 ?>/<?= $npage + 1 ?> 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>
