<?php
    if ($is_excel === false) {
?>
        <style type="text/css">
            body {
                font-family: sans-serif;
            }
            table {
                border-spacing: 0;
                border-collapse: collapse;
                width: 100%;
                max-width: 100%;
                margin-bottom: 20px;
                font-size:11px;
                vertical-align: middle;
                padding: 0;
                padding: 1px;
                vertical-align: top;
                text-align:center;
                font-family: sans-serif;
            }
        </style>
<?php
    }
?>

<?php
if ($data != null) {
    $jml_data = count($data);
    $nomor = 0;
    // print_r();

    foreach ($data as $key => $value) {
        $nomor++;
        $karyawan       = $value['data_karyawan'];
        $data_aktivitas = $value['data_aktivitas'];
?>
        <h3 style="text-align: center;"><?= strtoupper(strtolower($title)) ?></h3>
        <h4 style="text-align: center;">PERIODE : <?php echo $tanggal_mulai . ' s/d ' . $tanggal_selesai ?></h4>
        <h4> </h4>
        <table width="100%" border="1">
            <tr>
                <td style="border:1px solid #fff; text-align:left" colspan="2">NIK</td>
                <td style="border:1px solid #fff; text-align:left">: <?php echo $karyawan['nik']; ?></td>
                <td style="border:1px solid #fff; text-align:left"></td>
                <td style="border:1px solid #fff; text-align:left">CABANG</td>
                <td style="border:1px solid #fff; text-align:left" colspan="2">: <?php echo  $karyawan['kode_cabang']." - ".$karyawan['nama_cabang']; ?></td>
            </tr>
            <tr>
                <td style="border:1px solid #fff; text-align:left" colspan="2">NAMA</td>
                <td style="border:1px solid #fff; text-align:left">: <?php echo $karyawan['nama_karyawan']; ?></td>
                <td style="border:1px solid #fff; text-align:left"></td>
                <td style="border:1px solid #fff; text-align:left">DEPARTEMEN</td>
                <td style="border:1px solid #fff; text-align:left" colspan="2">: <?php echo $karyawan['kode_departemen']." - ".$karyawan['nama_departemen']; ?></td>
            </tr>
            <tr>
                <td style="border:1px solid #fff; text-align:left" colspan="2"></td>
                <td style="border:1px solid #fff; text-align:left"></td>
                <td style="border:1px solid #fff; text-align:left"></td>
                <td style="border:1px solid #fff; text-align:left">JABATAN</td>
                <td style="border:1px solid #fff; text-align:left" colspan="2">: <?php echo  $karyawan['kode_jabatan']." - ".$karyawan['nama_jabatan']; ?></td>
            </tr>
            <tr>
                <td style="text-align:center;" width="20">NO</td>
                <td style="text-align:center;" width="50">TANGGAL</td>
                <td style="text-align:center;" width="100">LOKASI</td>
                <td style="text-align:center;" colspan="4">KETERANGAN</td>
            </tr>
            <?php
                if (count($data_aktivitas) > 0) {
                    $no = 1;
                    foreach ($data_aktivitas as $k => $v) {
            ?>
                        <tr>
                            <td><?php echo $no ?></td>
                            <td><?php echo $v['waktu'] ?></td>
                            <td><?php echo $v['lokasi'] ?></td>
                            <td colspan="4"><?php echo $v['keterangan'] ?></td>
                        </tr>
            <?php
                        $no++;
                    }
                }
            ?>
        </table>
        <?php
        if ($is_excel === true) {
            echo '<h5>--PAGEBREAK--</h5>';
        } else {
            if ($nomor >= 1 && $nomor != $jml_data) {
                echo '<pagebreak>';
            }
        }
        ?>
<?php
    }
}
?>