<?php
include 'koneksi.php';
$q_riwayat = "SELECT po.id_po, po.no_po, s.supplier_nama FROM purchase_order po 
              LEFT JOIN supplier s ON po.id_supplier = s.supplier_id 
              ORDER BY po.id_po DESC";
$res_r = mysqli_query($conn, $q_riwayat);
$no = 1;
while($r = mysqli_fetch_array($res_r)) { ?>
    <tr>
        <td><?= $no++; ?></td>
        <td><a href="purchase-order.php?id_po=<?= $r['id_po']; ?>"><?= $r['no_po']; ?></a></td>
        <td><?= $r['supplier_nama'] ?? 'Supplier Terhapus'; ?></td>
        <td><a href="aksi/hapus_po.php?id=<?= $r['id_po']; ?>" class="btn btn-danger btn-sm" onclick="return confirm('Yakin hapus?');"><i class="fa fa-trash"></i></a></td>
    </tr>
<?php } ?>