<?php
	include "../koneksi.php";
	$data = mysqli_query ($koneksi, " SELECT incoming.IncomingID,
															incoming.Date_Inc,
															incoming.MaterialID,
															material.RawMat,
															material.Qty,
															incoming.Supplier,
															incoming.No_SJ,
															incoming.Qty_Inc,
															incoming.`Desc`
													FROM incoming
													INNER JOIN material
													ON incoming.MaterialID=material.MaterialID
									  	  			where incoming.IncomingID = $_POST[id]");
	$row = mysqli_fetch_array ($data);
	
?>
<form role="form" id="form-edit" method="post" action="update.php">
<div class="form-group">
	<input type="hidden" name="inc_id" value="<?php echo $row['IncomingID'] ; ?>">
	<label>Date Plan</label>
	<input type="text" class="input-tanggal form-control" id="date_inc" name="date_inc" data-date-format="dd-mm-yy" placeholder="Masukkan Tanggal Planning.." value="<?php echo $row['Date_Inc'] ; ?>" >
	<p style="color:red" id="error_edit_date_inc"></p>
</div>
<div class="form-group">
	<label>Material</label>
	<select class="form-control" id="material" name="material">
		<option value="<?php echo $row['MaterialID'] ; ?>" selected><?php echo $row['RawMat']; ?></option>
		<?php 
		$data1 = mysqli_query ($koneksi, " select 
								MaterialID,
								RawMat
						  from 
						  material 
						  order by MaterialID DESC");
		while ($row1 = mysqli_fetch_array ($data1))
		{
		?>
		<option value="<?php echo  $row1['MaterialID']; ?>"><?php echo $row1['RawMat']; ?></option>
		<?php } ?>
	</select>
	<p style="color:red" id="error_material"></p>
</div>
<div class="form-group">
	<label>Supplier</label>
	<input class="form-control" id="supplier" name="supplier" value="<?php echo $row['Supplier'] ; ?>">
	<p style="color:red" id="error_edit_supplier"></p>
</div>
<div class="form-group">
	<label>No. SJ</label>
	<input class="form-control" id="no_sj" name="no_sj" value="<?php echo $row['No_SJ'] ; ?>">
	<p style="color:red" id="error_edit_no_sj"></p>
</div>
<div class="form-group">
	<label>Quantity</label>
	<input class="form-control" id="qty" name="qty" value="<?php echo $row['Qty_Inc'] ; ?>">
	<p style="color:red" id="error_edit_qty"></p>
</div>						
<div class="form-group">
	<label>Description</label>
	<input class="form-control" id="desc" name="desc" value="<?php echo $row['Desc'] ; ?>">
	<p style="color:red" id="error_edit_desc"></p>
</div>			
</form>
