<table class="table table-sm table-bordered table-hover">
    <thead>
        <th>#</th>
        <th>Tgl SPB</th>
        <th>No SO</th>
        <th>Customer</th>
        <th>Kirim Ke 1</th>
        <th>Keterangan Detail</th>
        <th>Kuantitas</th>
        <th>Kts</th>
        <th>Qty SPB</th>
    </thead>
    <tbody>
        <?php
        $i = 1;
        foreach ($data as $d) {
            echo "<tr>";
            echo "<td>" . $i . "</td>";
            echo "<td>" . $d['tgl_spb'] . "</td>";
            echo "<td>" . $d['no_so'] . "</td>";
            echo "<td>" . $d['customer'] . "</td>";
            echo "<td>" . $d['shipto'] . "</td>";
            echo "<td>" . $d['remark'] . "</td>";
            echo "<td style='text-align: right;'>" . $d['qty'] . "</td>";
            echo "<td style='text-align: right;'>" . $d['qty_s'] . "</td>";
            if ($d['qty_spb'] == 0) {
                echo "<td onclick='add_qty(" . $d['id_spb'] . "," . $d['qty'] . ")' data-bs-toggle='modal' data-bs-target='#f_add_qty' style='text-align: center;'><button type='button' class='btn btn-primary btn-sm'><i class='bi bi-pencil'></i></button></td>";
            } else {
                echo "<td onclick='add_qty(" . $d['id_spb'] . "," . $d['qty'] . ")' data-bs-toggle='modal' data-bs-target='#f_add_qty' style='text-align: right;'><a href='#'>" . $d['qty_spb'] . "</a></td>";
            }
            echo "</tr>";
            $i++;
        }
        ?>
    </tbody>
</table>