<table class="table table-sm table-bordered table-hover">
    <thead>
        <tr>
            <th rowspan='2'>#</th>
            <th rowspan='2'>Sopir</th>
            <th rowspan='2'>No Pol</th>
            <th rowspan='2'>Hari Kerja</th>
            <th rowspan='2'>Kubikasi Kendaraan</th>
            <th rowspan='2'>Ritase DK</th>
            <th rowspan='2'>Ritase LK</th>
            <th rowspan='2'>Total Ritase</th>
            <th rowspan='2'>Total SJ</th>
            <th rowspan='2'>Total Kubikasi</th>
            <th colspan='2' style='text-align: center;'>Rata-rata</th>
            <th rowspan='2'>Trace</th>
        </tr>
        <tr>
            <th>Ritase</th>
            <th>Efektivitas(%)</th>
        </tr>
    </thead>
    <tbody>
        <?php
        $i = 1;
        foreach ($data as $d) {
            echo "<tr>";
            echo "<td>" . $i . "</td>";
            echo "<td>" . $d['sopir'] . "</td>";
            echo "<td>" . $d['no_pol'] . "</td>";
            echo "<td style='text-align: center;'>" . $d['hitung_hari_kerja'] . "</td>";
            echo "<td style='text-align: right;'>" . number_format($d['kubikasi'], 2, '.', ',') . "</td>";
            echo "<td style='text-align: center;'>" . $d['dk'] . "</td>";
            echo "<td style='text-align: center;'>" . $d['lk'] . "</td>";
            echo "<td style='text-align: center;'>" . $d['total_ritase'] . "</td>";
            echo "<td style='text-align: center;'>" . $d['total_sj'] . "</td>";
            echo "<td style='text-align: right;'>" . number_format($d['fg_kubikasi'], 2, '.', ',') . "</td>";
            echo "<td style='text-align: right;'>" . number_format($d['ritase'], 2, '.', ',') . "</td>";
            echo "<td style='text-align: right;'>" . number_format($d['efektif'], 2, '.', ',') . "</td>";
            if ($akses['unduh'] == 1) {
                echo "<td><button onclick='detail_ritase(\"" . $d['emp_id'] . "\"," . $d['id_kendaraan'] . ")' class='btn btn-primary btn-sm'><i class='bi bi-search'></i></button></td>";
            } else {
                echo "<td></td>";
            }
            echo "</tr>";
            $i++;
        }
        ?>
    </tbody>
</table>