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

<table width="100%" style="border-collapse:collapse;" border="1">
    <tr>
        <th class="text-center align-middle">NO</th>
        <th class="text-center align-middle">TANGGAL</th>
        <th class="text-center align-middle">NIK</th>
        <th class="text-center align-middle">SALES</th>
        <th class="text-center align-middle">NOMINAL</th>
        <th class="text-center align-middle">PRODUK</th>
        <th class="text-center align-middle">PELANGGAN</th>
        <th class="text-center align-middle">TITLE</th>
        <th class="text-center align-middle">KATEGORI</th>
        <th class="text-center align-middle">JENIS</th>
        <th class="text-center align-middle">LEAD SOURCE</th>
        <th class="text-center align-middle">LAMA CLOSING</th>
    </tr>

    <?php
        $no = 0;
        foreach ($list as $field) {
            $no++;
            $lama_closing = timespan(strtotime($field->tgl_input_main), strtotime($field->tgl_approve), 2);
    ?>
            <tr>
                <td><?= $no ?></td>
                <td><?= date_format(date_create($field->tgl_approve), "d-m-Y") ?></td>
                <td>#<?= $field->nik ?>#</td>
                <td><?= $field->nama_karyawan ?></td>
                <td><?= $field->nominal_layanan ?></td>
                <td><?= $field->nama_product ?></td>
                <td><?= $field->nama_perusahaan ?></td>
                <td><?= $field->title ?></td>
                <td><?= ucwords($field->kategori_pelanggan); ?></td>
                <td><?= $field->jenis_perusahaan ?></td>
                <td><?= ucwords($field->nama_lead); ?></td>
                <td><?= $lama_closing ?></td>
            </tr>
    <?php
        }
    ?>
</table>