<?php
date_default_timezone_set("Asia/Jakarta");
?>
<div class="content-wrapper">
    <!-- Content Header (Page header) -->
    <!-- Main content -->
    <section class="content">


        <div class="card" style="padding: 15px; background-color: white;border-radius: 5px;">
            <div class="card-body">
                <div class="row">
                    <div class="col-md-7">
                        <table>
                            <tr>
                                <td>
                                    <img src="<?= base_url('images/logo.png'); ?>" height="80px">
                                </td>
                                <td valign="top">
                                    <h4 style="font-weight: bold;">
                                        <?= $abdulradjak['NamaPerusahaan']; ?>
                                    </h4>
                                    <p>
                                        <?= $abdulradjak['AlamatPerusahaan']; ?>
                                    </p>
                                </td>
                            </tr>
                        </table>
                    </div>
                    <div class="col-md-5">
                        <div class="card" style="padding: 10px; border: 1px solid gray; border-radius: 5px; font-size: 9pt;">
                            <div class="card-body">
                                <table width="100%">
                                    <tr>
                                        <td width="30%">Nama</td>
                                        <td width="5%">:</td>
                                        <td><?= $datahamil['Description']; ?></td>
                                    </tr>
                                    <tr>
                                        <td>No.RM Pasien</td>
                                        <td>:</td>
                                        <td><?= $datahamil['PatientCode']; ?></td>
                                    </tr>
                                    <tr>
                                        <td>Tanggal Lahir / Umur</td>
                                        <td>:</td>
                                        <td>
                                            <?= date('d F Y', strtotime($datahamil['DOB'])); ?> /
                                            <?php
                                            // tanggal lahir
                                            $dob = date('Y-m-d', strtotime($datahamil['DOB']));
                                            $tanggal = new DateTime($dob);

                                            // tanggal hari ini
                                            $today = new DateTime('today');

                                            // tahun
                                            $y = $today->diff($tanggal)->y;

                                            // bulan
                                            $m = $today->diff($tanggal)->m;

                                            // hari
                                            $d = $today->diff($tanggal)->d;
                                            echo  $y . " tahun ";
                                            ?>
                                        </td>
                                    </tr>
                                    <tr>
                                        <td>Alamat</td>
                                        <td>:</td>
                                        <td><?= $datahamil['HomeAddress1']; ?></td>
                                    </tr>
                                </table>
                            </div>
                        </div>
                    </div>
                </div>
                <p align="center"><b>Obstetri Trimester 1</b></p>
            </div>
            <table border="1" style="width: 100%; border-collapse: collapse;">
                <tr>
                    <td>Gs</td>
                    <td>:</td>
                    <td><?= $datahamil['Gs']; ?></td>

                    <td colspan="2"><?= $datahamil['in1']; ?></td>
                </tr>
                <tr>
                    <td>FE</td>
                    <td>:</td>
                    <td><?= $datahamil['Fe']; ?></td>

                    <td colspan="2"><?= $datahamil['Tu']; ?></td>
                </tr>
                <tr>
                    <td>YS</td>
                    <td>:</td>
                    <td><?= $datahamil['Ys']; ?></td>
                </tr>
                <tr>
                    <td>FHR</td>
                    <td>:</td>
                    <td><?= $datahamil['Fhr']; ?></td>

                    <td>Frekuensi</td>
                    <td><?= $datahamil['frekuensi']; ?></td>
                </tr>
                <tr>
                    <td>CRL</td>
                    <td>:</td>
                    <td><?= $datahamil['Crl']; ?></td>

                    <td>Durasi Minggu</td>
                    <td><?= $datahamil['minggu']; ?> Minggu</td>
                </tr>
                <tr>
                    <td>NT</td>
                    <td>:</td>
                    <td><?= $datahamil['Nt']; ?></td>
                </tr>
                <tr>
                    <td>Kesimpulan</td>
                    <td>:</td>
                    <td><?= $datahamil['kesimpulan']; ?></td>
                </tr>
            </table>

            <p align="center"><b>Obstetri Trimester 2</b></p>
            <table border="1" style="width: 100%; border-collapse: collapse;">
                <tr>
                    <td colspan="2">
                        <center><img src="<?= base_url('aset/img/1.png'); ?>" height="200">
                    </td>
                    </center>
                    <td colspan="2">
                        <center><img src="<?= base_url('aset/img/2.png'); ?>" height="200">
                    </td>
                    </center>
                    <td colspan="2">
                        <center><img src="<?= base_url('aset/img/3.png'); ?>" height="200">
                    </td>
                    </center>
                </tr>
                <tr>
                    <td>BPD</td>
                    <td>:</td>
                    <td><?= $datahamil['Bpd']; ?></td>
                </tr>
                <tr>
                    <td>HC</td>
                    <td>:</td>
                    <td><?= $datahamil['Hc']; ?></td>

                    <td>TBJ</td>
                    <td>:</td>
                    <td><?= $datahamil['tbj']; ?> Gram</td>
                </tr>
                <tr>
                    <td>AC</td>
                    <td>:</td>
                    <td><?= $datahamil['Ac']; ?></td>

                    <td>UK</td>
                    <td>:</td>
                    <td><?= $datahamil['Uk']; ?> Minggu</td>
                </tr>
                <tr>
                    <td>FL</td>
                    <td>:</td>
                    <td><?= $datahamil['Fl']; ?></td>

                    <td>TP</td>
                    <td>:</td>
                    <td><?= $datahamil['Tp']; ?></td>
                </tr>
                <tr>
                    <td>PLASENTA</td>
                    <td>:</td>
                    <td><?= $datahamil['fudus']; ?></td>

                    <td>Oui</td>
                    <td>:</td>
                    <td><?= $datahamil['oui']; ?></td>
                </tr>
                <tr>
                    <td>ICA</td>
                    <td>:</td>
                    <td><?= $datahamil['ica']; ?></td>

                    <td>Gerak Janin</td>
                    <td>:</td>
                    <td><?= $datahamil['gerakjanin']; ?></td>
                </tr>
                <tr>
                    <td>FHR</td>
                    <td>:</td>
                    <td><?= $datahamil['fhr1']; ?> dpm</td>
                </tr>
                <tr>
                    <td>Jenis Kelamin</td>
                    <td>:</td>
                    <td><?= $datahamil['jenis']; ?></td>
                </tr>
                <tr>
                    <td>Kesimpulan</td>
                    <td>:</td>
                    <td><?= $datahamil['kesimpulan2']; ?></td>
                </tr>
            </table>
            <p align="center"><b>Ginekologi</b></p>
            <table border="1" style="width: 100%; border-collapse: collapse;">
                <tr>
                    <td>Uterus</td>
                    <td>:</td>
                    <td><?= $datahamil['Af']; ?></td>

                    <td><?= $datahamil['Membesar']; ?></td>

                    <td>Ukuran</td>
                    <td style="text-align:center;"><?= $datahamil['m1']; ?></td>
                    <td style="text-align:center;">X</td>
                    <td style="text-align:center;"><?= $datahamil['m2']; ?></td>
                    <td style="text-align:center;">X</td>
                    <td style="text-align:center;"><?= $datahamil['m3']; ?></td>
                </tr>
                <tr>
                    <td>Ovarium Kanan</td>
                    <td>:</td>
                    <td colspan="8"><?= $datahamil['ovakanan']; ?></td>
                </tr>
                <tr>
                    <td>Ovarium Kiri</td>
                    <td>:</td>
                    <td colspan="8"><?= $datahamil['ovakiri']; ?></td>
                </tr>
                <tr>
                    <td>Massa</td>
                    <td>:</td>
                    <td colspan="8"><?= $datahamil['massa']; ?></td>
                </tr>
                <tr>
                    <td>Kesimpulan</td>
                    <td>:</td>
                    <td colspan="8"><?= $datahamil['kesimpulan3']; ?></td>
                </tr>
            </table>

            <br><br>
            <table align="center" width="90%" style="font-size: 12pt;">
                <tr align="center">
                    <td>
                        <?php
                        date_default_timezone_set("Asia/Jakarta");
                        $tgl =  date("d/m/Y");
                        'Bogor' . ', ' . $tgl; ?><br>
                        Mengetahui,
                        <br><br><br><br><br>
                        ( ................... )
                    </td>
                    <td></td>
                    <td>
                        <br>
                        Pasien,
                        <br><br><br><br><br>
                        ( ..................... )
                    </td>
                </tr>
                <tr>
                    <td colspan="4" align="right">
                        <small><i>**cetak <?= date('d-m-Y H:i:s'); ?></i></small>
                    </td>
                </tr>
            </table>
        </div>
</div>
</div>
</section>
</div>
<script>
        window.onload = function() {
            window.print();
            setTimeout(window.close, 500);
        };
</script>