<h3 style="text-align: center;"><?= strtoupper($filename) ?></h3>
<h4 style="text-align: center;">BULAN <?= strtoupper($periode) ?></h4>
<h4></h4>

<table width="100%" style="border-collapse:collapse;" border="1">
    <tr>
        <th rowspan="2" class="text-center align-middle" width="20">NO</th>
        <th rowspan="2" class="text-center align-middle">NIK</th>
        <th rowspan="2" class="text-center align-middle">NAMA</th>

        <?php
        for ($x = 1; $x <= (COUNT($list_week)); $x++) {
            echo '<th colspan="2" class="text-center"> MINGGU KE-' . $x . '</th>';
        }
        ?>

        <th colspan="2" class="text-center align-middle">TOTAL POIN</th>
    </tr>
    <tr>
        <?php
        for ($x = 1; $x <= (COUNT($list_week)); $x++) {
            echo '<th class="text-center text-uppercase">TARGET</th>';
            echo '<th class="text-center text-uppercase">REALISASI</th>';
        }
        ?>

        <th class="text-center text-uppercase">TARGET</th>
        <th class="text-center text-uppercase">REALISASI</th>
    </tr>

    <?php
    $no = 0;
    foreach ($list as $field) {
        $no++;
    ?>
        <tr>
            <td><?= $no ?></td>
            <td>#<?= $field->nik ?>#</td>
            <td><?= $field->nama_karyawan ?></td>
            <?php
            $total_target_poin = 0;
            $total_realisasi_poin = 0;

            for ($x = 1; $x <= (COUNT($list_week)); $x++) {
                $target_poin_mingguan  = $target_poin[$field->id_karyawan][$x]['total_poin'];
                echo '<td>' . (!empty($target_poin_mingguan) ? $target_poin_mingguan : 0) . '</td>';
                $total_target_poin    += $target_poin_mingguan;

                $total_poin_mingguan   = $poin_realisasi[$field->id_karyawan][$x]['total_poin'];
                echo '<td>' . (!empty($total_poin_mingguan) ? $total_poin_mingguan : 0) . '</td>';
                $total_realisasi_poin += $total_poin_mingguan;
            }

            echo '<td>' . $total_target_poin . '</td>';
            echo '<td>' . $total_realisasi_poin . '</td>';
            ?>
        </tr>
    <?php
    }
    ?>
</table>
