<?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_stok_opname.xls");
header("Content-Transfer-Encoding: binary ");
?>
<!doctype html>
<html lang="en">

<head>
    <h1>Stok Gudang</h1>
</head>

<body>
    <table class="table table-sm table-bordered">
        <thead>
            <th>#</th>
            <th>SKU</th>
            <th>BARANG</th>
            <th>JUMLAH</th>
        </thead>
        <tbody>
            <?php
            $i = 1;
            foreach ($data as $d) {
                echo "<tr>";
                echo "<td>" . $i . "</td>";
                echo "<td>" . $d['sku'] . "</td>";
                echo "<td>" . $d['barang'] . "</td>";
                echo "<td>" . $d['hitung'] . "</td>";
                echo "</tr>";
                $i++;
            }
            ?>
        </tbody>
    </table>
</body>

</html>