<h3 style="text-align: center;"><?= strtoupper($header) ?></h3>
<h4 style="text-align: center;">PERIODE <?= $periode_mulai ?> S/D <?= $periode_selesai ?></h4>
<h4></h4>

<?php
    // dd($table_header); die();
?>
<table width="100%" style="border-collapse:collapse;" border="1">
    <!-- HEADER -->
    <tr>
        <th rowspan="2">NO</th>
        <th rowspan="2">NIK</th>
        <th rowspan="2">NAMA KARYAWAN</th>
        <th colspan="<?= COUNT($table_header) ?>" class="text-center align-middle">AKTIVITAS</th>
    </tr>

    <tr>
        <?php foreach($table_header AS $value){?>
            <th class="text-center align-middle"><?= strtoupper($value->nama_aktivitas) ?></th>
        <?php } ?>
    </tr>

    <!-- BODY -->
    <?php
        $no = 0;
        foreach ($list as $field) {
            $no++;
    ?>
            <tr>
                <td class="text-center"><?= $no ?></td>
                <td class="text-center">#<?= $field->nik ?>#</td>
                <td class="text-center"><?= $field->nama_lengkap ?></td>

                <?php
                    foreach($table_header AS $header){
                        $total_aktivitas = $get_aktivitas[$field->id_karyawan][$header->nama_aktivitas]['total'];
                ?>
                        <td class="text-center"><?= !empty($total_aktivitas) ? $total_aktivitas : 0 ?></td>
                <?php
                    }
                ?>
            </tr>
    <?php
        }
    ?>

    <!-- FOOTER -->
    <tr>
        <td colspan="3" class="text-center">TOTAL AKTIVITAS</td>
        <?php
            foreach($table_header AS $header){
                $total_aktivitas = $get_aktivitas['total_aktivitas_all'][$header->nama_aktivitas];
        ?>
                <td class="text-center"><?= !empty($total_aktivitas) ? $total_aktivitas : 0 ?></td>
        <?php
            }
        ?>
    <tr>
</table>