<?php
include_once("../../lib/konfig.php");
$MySQLi = new MySQLi($strDBHostName, $strDBUsername, $strDBPassword, $strDBName);

$listbj = "select 
row_number() over (order by A.tgl_diterima desc) as nmr,
A.sku,
B.barang,
A.kode_fg,
date_format(A.tgl_diterima,'%d %b %Y') as tgl,
date_format(A.tgl_diterima,'%T') as jam
from tb_fg_gudang A
left join tb_fg B on B.sku = A.sku
where date_format(A.tgl_diterima,'%Y-%m-%d') = current_date();";

$resultbj = $MySQLi->query($listbj);
?>
<table class="table table-sm table-bordered">
    <thead>
        <tr>
            <th>#</th>
            <th>Kode FG</th>
            <th>Sku</th>
            <th>Nama Barang</th>
            <th>Tanggal diterima</th>
            <th>Jam diterima</th>
        </tr>
    </thead>
    <tbody>
        <?php
        foreach ($resultbj as $r) {
            echo "<tr>";
            echo "<td>" . $r['nmr'] . "</td>";
            echo "<td>" . $r['kode_fg'] . "</td>";
            echo "<td>" . $r['sku'] . "</td>";
            echo "<td>" . $r['barang'] . "</td>";
            echo "<td>" . $r['tgl'] . "</td>";
            echo "<td>" . $r['jam'] . "</td>";
            echo "</tr>";
        }
        ?>
    </tbody>
</table>