<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Form Komunikasi</title>
    <style>
        body {
            font-family: Arial, Helvetica, sans-serif;
        }

        h3 {
            writing-mode: vertical-rl;
            transform: rotate(180deg);
            text-align: center;
        }

        td img {
            display: block;
            margin-left: auto;
            margin-right: auto;

        }
    </style>
</head>

<body>
    <table style="margin-top: -7px; width: 100%;">
        <tr>
            <td style="margin-top: -10px; width: 20%;"><img src="<?= base_url('images/logo.png'); ?>" width="70" height="50"></td>
            <td style="margin-top: -10px; width: 80%; text-align:center;">
                <b style='font-size:18px;'><?= $abdulradjak['NamaPerusahaan']; ?></b><br>
                <?= $abdulradjak['AlamatPerusahaan']; ?><br>
                <small>Telp. <?= $abdulradjak['TeleponPerusahaan']; ?>, Fax : <?= $abdulradjak['FaxPerusahaan']; ?></small>
            </td>
        </tr>
    </table>
    <hr>
    <h2 style="text-align: center;">LEMBAR KONSUL PASIEN DENGAN TELEPON DAN
        ELEKTRONIK LAINNYA</h2>
    <table class="table table-striped table-hover" style="border-collapse: collapse; width:100%;">
        <?php foreach ($hasil as $data) : ?>
            <tr>
                <td>NAMA</td>
                <td>:</td>
                <td><?= $data['Description']; ?></td>
            </tr>
            <tr>
                <td>TGL LAHIR</td>
                <td>:</td>
                <td><?= $data['DOBPlace']; ?> , <?= date('d-m-Y', strtotime($data['DOB'])); ?></td>

                <td>MR</td>
                <td>:</td>
                <td><?= $data['PatientCode']; ?></td>
            </tr>
            <tr>
                <td>ALAMAT</td>
                <td>:</td>
                <td><?= $data['HomeAddress1']; ?></td>
            </tr>
    </table>
    <br>
    <table border="1" class="table table-striped table-hover" style="border-collapse: collapse; width:100%;">
        <tr>
            <td colspan="3" style="text-align: center;">
                <h4>SBAR (SITUATION, BACGROUND,ASSESMENT, RECOMMENDATION)</h4>
            </td>
            <td colspan="3" style="text-align:center;">
                <h4>TBK (TULIS,BACAULANG,KONFIRMASI)</h4>
            </td>
        </tr>
        <tr>
            <td style="text-align: center; font-size: 100px;font-family:Arial Black;">S</td>
            <td style="text-align: center; font-size: 20px;">
                <h3>SITUATION</h3>
            </td>
            <td>
                <table>
                    <tr>
                        <td>TANGGAL</td>
                        <td>:</td>
                        <td><?= date('d-m-Y', strtotime($data['Intake Date'])); ?></td>

                        <td>JAM</td>
                        <td>:</td>
                        <td><?= date('H:i', strtotime($data['Intake Time'])); ?></td>
                    </tr>
                    <tr>
                        <td>NAMA</td>
                        <td>:</td>
                        <td><?= $data['Description']; ?></td>
                    </tr>
                    <tr>
                        <td>POLI</td>
                        <td>:</td>
                        <td><?= $data['poli']; ?></td>
                    </tr>
                    <tr>
                        <td>KELUHANSAATINI</td>
                        <td>:</td>
                        <td><?= $data['keluhan_utama']; ?></td>
                    </tr>
                </table>
            </td>
            <td style="text-align: center; font-size: 100px;font-family:Arial Black;" colspan="2">T</td>
            <td>
                <table>
                    <tr>
                        <td>TANGGAL</td>
                        <td>:</td>
                        <td><?= date('d-m-Y', strtotime($data['Tanggal'])); ?></td>

                        <td>JAM</td>
                        <td>:</td>
                        <td><?= date('H:i', strtotime($data['Jam'])); ?></td>
                    </tr>
                    <tr>
                        <td>TULISLENGKAPADVISDOKTER</td>
                        <td>:</td>
                        <td><?= $data['Tulislengkapadvisdokter']; ?></td>
                    </tr>
                </table>
            </td>
        </tr>

        <tr>
            <td style="text-align: center; font-size: 100px;font-family:Arial Black;">B</td>
            <td style="text-align: center; font-size: 20px;">
                <h3>BACKGROUND</h3>
            </td>
            <td>
                <table>
                    <tr>
                        <td>DIAGNOSA</td>
                        <td>:</td>
                        <td><?= $data['ICD_CODE'] . '-' . $data['DESCRPTION']; ?></td>
                    </tr>
                    <tr>
                        <td>PEMERIKSAANFISIK</td>
                        <td>:</td>
                        <td><?= $data['pemeriksaan_fisik']; ?></td>
                    </tr>
                    <tr>
                        <td>LABORATORIUM</td>
                        <td>
                    <tr>
                        <td colspan="4">
                            <center><?= $HeaderLab['Description']; ?></center>
                        </td>
                    </tr>
                    <?php foreach ($viewlab as $d) : ?>
                        <tr>
                            <td><?= $d['LabNo']; ?></td>
                            <td><?= $d['Bahasa']; ?></td>
                            <td><?= $d['ResultValue']; ?></td>
                            <td><?= $d['Normalvalue']; ?></td>
                        </tr>
                    <?php endforeach; ?>
            </td>
        </tr>
        <tr>
            <td>TINDAKANYANGSUDAHDILAKUKAN</td>
            <td>:</td>
            <td><?= $data['tindak_lanjut']; ?></td>
        </tr>

    </table>
    </td>
    <td style="text-align: center; font-size: 100px;font-family:Arial Black;" colspan="2">B</td>
    <td>
        <table>
            <tr>
                <td>BACAULANGADVISDOKTER</td>
                <td>:</td>
                <td><?= $data['Bacaulangdokter']; ?></td>
            </tr>
        </table>
    </td>
    </tr>

    <tr>
        <td style="text-align: center; font-size: 100px;font-family:Arial Black;">A</td>
        <td style="text-align: center; font-size: 20px;">
            <h3>ASSESMENT</h3>
        </td>
        <td>
            <table>
                <tr>
                    <td>TULISKANANALISAPENGKAJIAN</td>
                    <td>:</td>
                    <td><?= $data['Pengkajian']; ?></td>
                </tr>
            </table>
        </td>
        <td style="text-align: center; font-size: 100px;font-family:Arial Black;" colspan="2">K</td>
        <td>
            <table>
                <tr>
                    <td>KONFIRMASI</td>
                    <td>:</td>
                    <td><?= $data['Kofirmasi']; ?></td>
                </tr>
            </table>
        </td>
    </tr>

    <tr>
        <td style="text-align: center; font-size: 100px;font-family:Arial Black;">R</td>
        <td style="text-align: center; font-size: 20px;">
            <h3>RECOMMENDATION</h3>
        </td>
        <td>
            <table>
                <tr>
                    <td><?= $data['Recomendasi']; ?></td>
                    <td></td>
                    <td></td>
                </tr>
            </table>
        </td>
        <td style="text-align: center;" colspan="2">
            <h4 style="text-align: center;">SBAR</h4>
            <table style="text-align: center;">
                <tr>
                    <td>TGL</td>
                    <td>:</td>
                    <td><?= $ttd['tgl1']; ?></td>
                </tr>
                <tr>
                    <td>JAM</td>
                    <td>:</td>
                    <td><?= date('H:i', strtotime($ttd['waktu1'])); ?></td>
                </tr>
            </table>
            <img src="<?= base_url('images/uploadsign/komunikasi/' . $ttd['tandatangan_1']); ?>" width="100px" height="70px">
            <h4 style="text-align: center;">(<?= $ttd['namajelas_1']; ?>)</h4>
        </td>
        <td>
            <h4 style="text-align: center;">TBK</h4>
            <table style="text-align: center;">
                <tr>
                    <td>TGL</td>
                    <td>:</td>
                    <td><?= $ttd['tgl2']; ?></td>
                </tr>
                <tr>
                    <td>JAM</td>
                    <td>:</td>
                    <td><?= date('H:i', strtotime($ttd['waktu2'])); ?></td>
                </tr>
            </table>
            <img src="<?= base_url('images/uploadsign/komunikasi/' . $ttd['tandatangan_2']); ?>" width="100px" height="70px"> 
            <h4 style="text-align: center;">(<?= $ttd['namajelas_2']; ?>)</h4>
        </td>
    </tr>
    </table>
</body>

</html>
<?php endforeach; ?>
<script>
    window.onload = function() {
        window.print();
        setTimeout(window.close, 500);
    };
</script>