<?php
session_name("AUTHENUSER");
session_start();
$USERNAME = $_SESSION['SES_USERNAME'];
if(!session_name("AUTHENUSER"))
	{
?>
						<script language="javascript">
						 alert("Waktu Login telah habis.Silahkan Login Kembali");
						document.location="index.php";
						</script>
<?php
	}
if(!$USERNAME)
	{
?>
						<script language="javascript">
						 alert("Harap Login Dahulu.");
						document.location="index.php";
						</script>
<?php
	}
	?>
	<?php 
	include "common/config.php";
	include "include/head.php";
?>
<?php
	$id_stock  = $_REQUEST['id_stock'];
	$fetch = mysql_fetch_array(mysql_query("select * from inventory_diamond where id_stock = '$id_stock'"));
	$kode_stock  = $fetch['kode_stock'];
	$id_supplier = $fetch['id_supplier'];
	$lbprice  = $fetch['lbprice'];
	$cbprice  = $fetch['cbprice'];
	$rapprice  = $fetch['rapprice'];
	$msprice  = $fetch['msprice'];
	$barcodeno  = $fetch['barcodeno'];
	$weight  = $fetch['weight'];
	$id_status  = $fetch['id_status'];
	$id_branch  = $fetch['id_branch'];
	$id_type  = $fetch['id_type'];
	$id_shape  = $fetch['id_shape'];
	$certificateno  = $fetch['certificateno'];
	$color  = $fetch['color'];
	$clarity  = $fetch['clarity'];
	$cut  = $fetch['cut'];
	$description  = $fetch['description'];
	$foolish  = $fetch['foolish'];
	$symetry  = $fetch['symetry'];
	$fluo  = $fetch['fluo'];
	$discount  = $fetch['discount'];
	$description  = $fetch['description'];
	$certificate_name  = $fetch['certificate_name'];
	$loc = "certificate/";
	$all = $loc.$certificate_name; 
	$kurs2 = mysql_fetch_array(mysql_query("select usd from tbl_usd order by date_update desc limit 1"));
	$usd = $kurs2['usd'];
	if($fetch['date_stock'] == '')
								{
								$date_stock = '';
								}
								else
								{
								list($d, $e, $f)=split ("[-]", $fetch['date_stock']);
								$date_stock   =$f."-".$e."-".$d;
								}
?>
<body>
<?php include "include/head2.php"; ?>
<?php include "include/leftmenu.php"; ?>
<?php include "include/top.php"; ?>
  <h1><i class="icon-gears (alias)"></i> View Inventory Diamond</h1>
</div>

<!--<ol class="breadcrumb">
  <li><a href="#">Home</a></li>
  <li><a href="#">Bread</a></li>
  <li><a href="#">Crumbs</a></li>
  <li class="active">Example</li>
</ol>-->
          <div class="main-content">
            <div class="row">
                <div class="widget">
                  <div class="widget-content-white glossed">
                    <div class="padded">
                      <form method="post" action="update_diamond.php?act=1&id_stock=<?php echo $id_stock; ?>" enctype="multipart/form-data" role="form" class="form-horizontal">
                        <div class="form-group">
                          <label class="col-md-4 control-label">Stock ID</label>
                          <div class="col-md-8">
                            <input type="text" class="form-control" name="kode" id="kode"  value="<?php echo $kode_stock; ?>"  readonly="readonly">
                          </div>
                          </div>
                           <div class="form-group">
                          <label class="col-md-4 control-label">Kode Supplier -  Nama Supplier</label>
                          <div class="col-md-8"><select name="supplier" id="supplier" class="form-control">
                               <?php
                                              $sql3 = "select * from tbl_supplier where id_supplier='$id_supplier' order by nama_supplier,kode_supplier";
                                              $rs3 = mysql_query($sql3);
                                              while($fetch3 = mysql_fetch_array($rs3))
                                              {
                                               ?>
                                         <option <?php if($fetch3['id_supplier']==$id_supplier) { ?> selected="selected" <?php } ?> value="<?php echo $fetch3['id_supplier']; ?>"><?php echo  $fetch3['kode_supplier'];  ?> - <?php echo  $fetch3['nama_supplier'];  ?></option>
                                                      <?php
                                              }
                                             ?>
                            </select>
                          </div>
                        </div>
                           <div class="form-group">
                          <label class="col-md-4 control-label">Barcode No.</label>
                          <div class="col-md-8">
                            <input type="text" class="form-control" name="barcode" id="barcode" readonly="readonly" value="<?php echo $barcodeno; ?>">
                          </div>
                          </div>
                          <div class="form-group">
                          <label class="col-md-4 control-label">Certificate Type</label>
                          <div class="col-md-8">
                           <select name="certificate" id="certificate" class="form-control">
                               <?php
                                              $sql3 = "select * from  tbl_type where id_type='$id_type'
											   order by nama_type";
                                              $rs3 = mysql_query($sql3);
                                              while($fetch3 = mysql_fetch_array($rs3))
                                              {
                                               ?>
                                        <option <?php if($fetch3['id_type']==$id_type) { ?> selected="selected" <?php } ?> value="<?php echo $fetch3['id_type']; ?>"><?php echo  $fetch3['nama_type'];  ?></option>
                                                      <?php
                                              }
                                             ?>
                            </select>
                          </div>
                          </div>
                            <div class="form-group">
                          <label class="col-md-4 control-label">Cert No.</label>
                          <div class="col-md-8">
                            <input type="text" class="form-control" name="certificateno" id="certificateno" value="<?php echo $certificateno; ?>" readonly >
                          </div>
                          </div>
                            <div class="form-group">
                          <label class="col-md-4 control-label">Shape</label>
                          <div class="col-md-8">
                          <select name="shape" id="shape" class="form-control">
                               <?php
                                              $sql3 = "select * from  tbl_shape where id_shape='$id_shape' order by nama_shape";
                                              $rs3 = mysql_query($sql3);
                                              while($fetch3 = mysql_fetch_array($rs3))
                                              {
                                               ?>
                                        <option <?php if($fetch3['id_shape']==$id_shape) { ?> selected="selected" <?php } ?> value="<?php echo $fetch3['id_shape']; ?>"><?php echo  $fetch3['nama_shape'];  ?></option>
                                                      <?php
                                              }
                                             ?>
                            </select>
                          </div>
                          </div>
                           <div class="form-group">
                          <label class="col-md-4 control-label">Kurs</label>
                          <div class="col-md-8">
                            <input type="text" class="form-control" name="usd" id="usd" value="<?php echo $usd; ?>" readonly="readonly" >
                          </div>
                          </div>
                           <div class="form-group">
                          <label class="col-md-4 control-label">Min Price</label>
                          <div class="col-md-8">
                            <input type="text" class="form-control" name="lbprice" id="lbprice" onKeyUp="this.value = numFormat(this.value)"  value="<?php  echo number_format($lbprice, 0, ',', ','); ?>" readonly >
                          </div>
                          </div>
                           <div class="form-group">
                          <label class="col-md-4 control-label">Max Price</label>
                          <div class="col-md-8">
                            <input type="text" class="form-control" name="msprice" id="msprice" onKeyUp="this.value = numFormat(this.value)"  value="<?php  echo number_format($msprice, 0, ',', ','); ?>" readonly>
                          </div>
                          </div>
                          <div class="form-group">
                          <label class="col-md-4 control-label">RAP</label>
                          <div class="col-md-8">
                            <input type="text" class="form-control" name="rapprice" id="rapprice" onKeyUp="this.value = numFormat(this.value)"  value="<?php  echo number_format($rapprice, 0, ',', ','); ?>"  readonly>
                          </div>
                          </div>
                          <div class="form-group">
                          <label class="col-md-4 control-label">Weight</label>
                          <div class="col-md-8">
                            <input type="text" class="form-control" name="weight" id="weight"  value="<?php echo $weight; ?>" readonly >
                          </div>
                          </div>
                           <div class="form-group">
                          <label class="col-md-4 control-label">Color</label>
                          <div class="col-md-8">
                            <input type="text" class="form-control" name="color" id="color" value="<?php echo $color; ?>" readonly >
                          </div>
                          </div>
                          <div class="form-group">
                          <label class="col-md-4 control-label">Clarity</label>
                          <div class="col-md-8"> 
                            <input type="text" class="form-control" name="clarity" id="clarity"  value="<?php echo $clarity; ?>" readonly >
                          </div>
                          </div>
                          <div class="form-group">
                          <label class="col-md-4 control-label">Cut</label>
                          <div class="col-md-8">
                            <input type="text" class="form-control" name="cut" id="cut"  value="<?php echo $cut; ?>" readonly >
                          </div>
                          </div>
                           <div class="form-group">
                          <label class="col-md-4 control-label">Pol</label>
                          <div class="col-md-8">
                            <input type="text" class="form-control" name="foolish" id="foolish" value="<?php echo $foolish; ?>" readonly  >
                          </div>
                          </div>
                           <div class="form-group">
                          <label class="col-md-4 control-label">Sym</label>
                          <div class="col-md-8">
                            <input type="text" class="form-control" name="symetry" id="symetry" value="<?php echo $foolish; ?>" readonly  >
                          </div>
                          </div>
                            <div class="form-group">
                          <label class="col-md-4 control-label">Fluo</label>
                          <div class="col-md-8">
                            <input type="text" class="form-control" name="fluo" id="fluo" value="<?php echo $fluo; ?>" readonly >
                          </div>
                          </div>
                            <div class="form-group">
                          <label class="col-md-4 control-label">Discount</label>
                          <div class="col-md-8">
                            <input type="text" class="form-control" name="discount" id="discount" value="<?php echo $discount; ?>" readonly >
                          </div>
                          </div>
                           <div class="form-group">
                          <label class="col-md-4 control-label">Upload Certificate (only PDF)</label>
                          <div class="col-md-8">
                            <a class="image" href="certificate/<?php echo $certificate_name; ?>">
                            	<strong><?php echo $certificate_name; echo "</br>"; ?></strong></a>
                          </div>
                        </div>
                          <div class="form-group">
                          <label class="col-md-4 control-label">Status Inventory</label>
                          <div class="col-md-8"><select name="status" id="status" class="form-control">
                               <?php
                                              $sql3 = "select * from tbl_status where id_status='$id_status' ";
                                              $rs3 = mysql_query($sql3);
                                              while($fetch3 = mysql_fetch_array($rs3))
                                              {
                                               ?>
                                        <option <?php if($fetch3['id_status']==$id_status) { ?> selected="selected" <?php } ?> value="<?php echo $fetch3['id_status']; ?>"><?php echo  $fetch3['status'];  ?></option>
                                                      <?php
                                              }
                                             ?>
                            </select>
                          </div>
                        </div>
                          <div class="form-group">
                          <label class="col-md-4 control-label">Date Stock</label>
                          <div class="col-md-8">
                            <input type="text" class="form-control" name="barcode" id="barcode" readonly="readonly" value="<?php echo $date_stock; ?>">
                          </div>
                          </div>
                         <div class="form-group">
                          <label class="col-md-4 control-label">Branch ID</label>
                          <div class="col-md-8"><select name="id_branch" id="id_branch" class="form-control">
                            <?php if($id_branch == NULL)
                            {
                            ?>
                            <option value="">Head Office</option>
                           	<?php
						    }
                            else
                            {
                                              $sql3 = "select *
											  from tbl_branch where id_branch='$id_branch' order by nama_branch";
                                              $rs3 = mysql_query($sql3);
                                              while($fetch3 = mysql_fetch_array($rs3))
                                              {
                                               ?>
                                        <option <?php if($fetch3['id_branch']==$id_branch) { ?> selected="selected" <?php } ?> value="<?php echo $fetch3['id_branch']; ?>"><?php echo  $fetch3['nama_branch'];  ?></option>
                                                      <?php
                                              }
                                             
                            }
							?>
                            </select>
                          </div>
                        </div>
                        <div class="form-group">
                          <div class="col-md-offset-4 col-md-8">
                            <input type="button" value=" Back " class="btn btn-default" onClick="document.location='javascript:history.back(-1)'" />
                          </div>
                        </div>
                      </form>
                    </div>
                    </div>
                    </div>
                    </div>
                    </div>
                   

<?php include "include/foot.php"; ?>
<script src='assets/js/for_pages/dashboard.js'></script>
</body>

</html>