<style>
    #tbl{
        border-spacing: 0px;


			table-layout: fixed;


			margin-left: auto;


			margin-right: auto;
    }
</style>

<table width="100%" style="font-size:12pt;">
    <tr>
        <td width="20%">
            <img src="<?= base_url('images/logo2.png') ?>" width="70" height="70" alt="">
        </td>
        <td>
            <h3  style="margin-top: 2px;"><?= $abdulradjak['NamaPerusahaan']; ?></h3>
            <p style="margin-top: -10px;"><?= $abdulradjak['AlamatPerusahaan']; ?></p>
            <p style="margin-top: -10px;"></p>
            <p style="margin-top: -10px;">Kode Pos 11460  <?= $abdulradjak['TeleponPerusahaan']; ?>, Fax : <?= $abdulradjak['FaxPerusahaan']; ?> </p>
        </td>
    </tr>
</table>
<hr>
<br>
<?php
date_default_timezone_set("Asia/Jakarta");
$tgll = date('Y-m-d', strtotime(@$id['TTL']));
$tanggal_lahir = new DateTime($tgll);
$sekarang = new DateTime("today");
if ($tanggal_lahir > $sekarang) {
    $thn = "0";
    $bln = "0";
    $tgl = "0";
}
$thn = $sekarang->diff($tanggal_lahir)->y;
$bln = $sekarang->diff($tanggal_lahir)->m;
$tgl = $sekarang->diff($tanggal_lahir)->d;

$c = $id['CompanyCode'];
$com = $this->db->query("SELECT * FROM Company WHERE CompanyCode = '$c'")->row_array();

?>
<table border="0" collapse; "width:100mm">
    <tr>
        <td>No.MR</td>
        <td>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </td>
        <td><?= $id['MR']; ?></td>

        <td>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </td>
        <td>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </td>

        <td>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;No.Reg</td>
        <td>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </td>
        <td><?= $id['ID']; ?></td>
    </tr>
    <tr>
        <td>Nama</td>
        <td>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </td>
        <td><?= $id['Nama']; ?></td>

        <td>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </td>
        <td>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </td>

        <td>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Tanggal Kunjungan</td>
        <td>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </td>
        <td><?= date('d-m-Y', strtotime($id['Kunjungan'])); ?></td>
    </tr>
    <tr>
        <td>Tanggal Lahir</td>
        <td>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </td>
        <td>
            <?php
            if ($id['TTL'] == '') {
            } else {
                echo date('d-m-Y', strtotime($id['TTL']));
            }
            ?>
        </td>

        <td>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </td>
        <td>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </td>

        <td>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Umur</td>
        <td>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </td>
        <td><?= $thn . ' th ' . $bln . ' bulan ' . $tgl . ' hari'; ?></td>
    </tr>
    <tr>
        <td>Dokter</td>
        <td>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </td>
        <td><?= $id['Dokter']; ?></td>

        <td>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </td>
        <td>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </td>

        <td>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Penjamin</td>
        <td>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </td>
        <td><?= $com['CompanyName']; ?></td>
    </tr>
    <tr>
        <td>Poli</td>
        <td>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </td>
        <td><?= $id['Poli']; ?></td>
    </tr>
</table>
<hr>
<!-- <h3 align="center"> CATATAN PERKEMBANGAN PASIEN TERINTEGRASI</h3> -->
<P align="center" style="margin-top: -5px; ">(Di tulis dengan format SOAP , disertai dengan target dan tujuan terukur, dituliskan nama dan paraf pada setiap akhir catatan, DPJP harus membaca dan memverifikasi ulang seluruh rencana perawatan)</P>
<table border="1" style="border-collapse: collapse;width:100%;">
<tr>
    <td style="width:20%; text-align:center;">Pembuat</td>
    <td style="width:20%; text-align:center;">Tanggal</td>
    <td style="width:50%; text-align:center;">Catatan</td>
    <td style="width:10%; text-align:center;">Verifikasi TTD</td>
</tr>
    <?php
    foreach ($listDetail as $list) :
    ?>
<tr>
<td style="width:20%;text-align:center;"><?= $list["UserCreated"]; ?></td>
<td style="width:20%;text-align:center;"><?= date('d F Y', strtotime($list['DateDetail'])).'-'.date('H:i', strtotime($list['TimeDetail'])); ?></td>
<td style="width:50%">
<p style="font-size: 11px; margin-top: 2px; text-align:left;">
     <?= $list['Description']; ?><br>
    &nbsp;&nbsp; S: <?= $list['Subjek']; ?><br>
    &nbsp;&nbsp; O: <?= $list['Objek']; ?><br>
    &nbsp;&nbsp; A: <?= $list['Asesment']; ?><br>
    &nbsp;&nbsp; P: <?= $list['Penilaian']; ?><br>
    &nbsp;&nbsp; Asuhankeperawatan: <?= $list['Asuhankeperawatan']; ?><br>
      </p>
    </td>
    <td style="width:10%"><img src="<?= base_url('images/uploadsign/cppt/'.$list['ttd']); ?>.png" width="190px" height="100px"></td>
</tr>
    <?php endforeach; ?>
</table>
<script>
        window.onload = function() {
            window.print();
            setTimeout(window.close, 500);
        };
</script>