<?php 
include "../koneksi.php";
$data = mysqli_query ($koneksi, " select 
                                        detail_po.DetailPO_ID,
                                        po_tbl.No_PO,
                                        po_tbl.TanggalPO,
                                        customer.CustomerID,
                                        customer.CustomerName,
                                        product.ProductID,
                                        product.ItemDescription,
                                        product.SLoc,
                                        detail_po.QtyPO,
                                        detail_po.BalancePO
                                from 
                                detail_po 
                                INNER JOIN po_tbl
                                ON detail_po.PO_ID=po_tbl.PO_ID
                                INNER JOIN product
                                ON detail_po.ProductID=product.ProductID
                                INNER JOIN customer
                                ON po_tbl.CustomerID=customer.CustomerID
                                where po_tbl.CustomerID = '$_GET[customer]' AND detail_po.BalancePO>0");

?>
<th>NOMOR PO</th>
<td>
<select id="detail_po" name="detail_po">
        <option selected></option>
        <?php 
        while ($row = mysqli_fetch_array ($data))
        {
        ?>
        <option value="<?php echo  $row['DetailPO_ID']; ?>">Tgl.PO :<?php echo $row['TanggalPO']; ?>&ensp;|&ensp;No.PO :<?php echo $row['No_PO']; ?>&ensp;|&ensp;<?php echo $row['ItemDescription']; ?>&ensp;|&ensp;Sisa :<?php echo $row['BalancePO']; ?><?php echo substr($row['SLoc'], 0, 3); ?></option>
        <?php } ?>
</select>
<p style="color:red" id="error_detail_po"></p>
<span id="container4"></span>
</td>

<script>
          $('#detail_po').on('change', function(){
		const selectedPackage = $('#detail_po').val();
                $.get('delivery/things2.php?product=' + selectedPackage, function(data) {
				//fungsi eksekusi func. Ajax
				$('#container4').html(data);
		});
	  });
</script>
