<?php

header("Pragma: public");
header("Expires: 0");
header("Cache-Control: must-revalidate, post-check=0, pre-check=0");
header("Content-Type: application/force-download");
header("Content-Type: application/octet-stream");
header("Content-Type: application/download");
header("Content-Disposition: attachment;filename= Laporan_ritase.xls");
header("Content-Transfer-Encoding: binary ");

?>
<!doctype html>
<html lang="en">

<head>
    <h1>Laporan Ritase</h1>
</head>
<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</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>
        </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;'>" . $d['kubikasi'] . "</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;'>" . $d['fg_kubikasi'] . "</td>";
            echo "<td style='text-align: right;'>" . $d['ritase'] . "</td>";
            echo "<td style='text-align: right;'>" . $d['efektif'] . "</td>";
            echo "</tr>";
            $i++;
        }
        ?>
    </tbody>
</table>

</html>