
<?php
	
	include"koneksi.php";
	$no = 1;
	$data = mysqli_query ($koneksi, " select 
											DetailPO_ID,
											PO_ID,
											ProductID,
											QtyPO
									  from 
									  detail_po 
									  where DetailPO_ID = $_POST[id]");
	$row = mysqli_fetch_array ($data);
	
?>
<form role="form" id="form-edit" method="post" action="update.php">
	<div class="form-group">
		<label>Data PO</label>
		<input type="hidden" name="detailpo_id" value="<?php echo $row['DetailPO_ID'] ; ?>">
		<select class="form-control" id="po_id" name="po_id">
			<option selected><?php echo  $row['PO_ID']; ?></option>
			<?php 
			include"koneksi.php";
			$data = mysqli_query ($koneksi, " select 
													po_tbl.PO_ID,
													po_tbl.No_PO,
													customer.CustomerName,
													po_tbl.TanggalPO
											from 
											po_tbl 
											INNER JOIN customer
											ON po_tbl.CustomerID=customer.CustomerID
											order by PO_ID DESC");
			while ($row = mysqli_fetch_array ($data))
			{
				?>
			<option value="<?php echo  $row['PO_ID']; ?>">ID: <?php echo $row['PO_ID']; ?> |<?php echo $row['No_PO']; ?> | <?php echo $row['CustomerName']; ?> | <?php echo $row['TanggalPO']; ?> </option>
			<?php } ?>
		</select>
		<p style="color:red" id="error_edit_po_id"></p>
	</div>
	<?php $data = mysqli_query ($koneksi, " select 
											DetailPO_ID,
											PO_ID,
											ProductID,
											QtyPO
									  from 
									  detail_po 
									  where DetailPO_ID = $_POST[id]");
	$row = mysqli_fetch_array ($data); ?>														
	<div class="form-group">
		<label>Product</label>
		<select class="form-control" id="product_id" name="product_id">
			<option selected><?php echo  $row['ProductID']; ?></option>
			<?php 
			include"koneksi.php";
			$data = mysqli_query ($koneksi, " select 
													ProductID,
													Material,
													ItemDescription,
													SLoc,
													QtyUnit,
													Folder
											from 
											product 
											order by ProductID DESC");
			while ($row = mysqli_fetch_array ($data))
			{
				?>
			<option value="<?php echo  $row['ProductID']; ?>">ID: <?php echo $row['ProductID']; ?> | <?php echo $row['Material']; ?> | <?php echo $row['ItemDescription']; ?> | <?php echo $row['SLoc']; ?>@<?php echo $row['QtyUnit']; ?>pcs</option>
			<?php } ?>
		</select>
		<p style="color:red" id="error_edit_product_id"></p>
	</div>
	<?php $data = mysqli_query ($koneksi, " select 
											DetailPO_ID,
											PO_ID,
											ProductID,
											QtyPO
									  from 
									  detail_po 
									  where DetailPO_ID = $_POST[id]");
	$row = mysqli_fetch_array ($data); ?>							
	<div class="form-group">
		<label>Quantity PO</label>
		<input class="form-control" id="qty_po" name="qty_po" value="<?php echo  $row['QtyPO']; ?>">
		<p style="color:red" id="error_edit_qty_po"></p>
	</div>
</form>
