<?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"; ?>
    
<body>
<?php include "include/head2.php"; ?>
<?php include "include/leftmenu.php"; ?>
<?php include "include/top.php"; ?>
  <h1><i class="icon-pencil"></i> Consignment Input</h1>
</div>

<ol class="breadcrumb">
  <li><a href="add_consigment.php">Add Consignment</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="widget">
              <h3 class="section-title first-title"><i class="icon-table"></i> Listing Consignment Input</h3>
              <div class="widget-content-white glossed">
                <div class="padded">
                <table class="table table-striped table-bordered table-hover">
                  <thead>
                    <tr>
                      <th>Kode Consigment</th>
                            <th>Tanggal Consigment</th>
                            <th>Branch From</th>
                            <th>Branch To</th>
                    </tr>
                  </thead>
                  <tbody>
                     <?php
						$sql = mysql_query("select * from  inventory_consigment
						where status_consigment = 1 and user_receive = '' order by id_consigment");
						while($fetch = mysql_fetch_array($sql))
						{
								$id_consigment = $fetch['id_consigment'];
								$id_branchto = $fetch['id_branchto'];
								$id_branchfrom = $fetch['id_branchfrom'];
								if($id_branchto == 0)
								{
									$branchto = 'Head Office';
								}
								else
								{
									$id_branchto = $fetch['id_branchto'];
									$fetch3 = mysql_fetch_array(mysql_query("select * from tbl_branch where id_branch = '$id_branchto'"));
									$branchto = $fetch3['nama_branch'];
								}
								if($id_branchfrom == 0)
								{
									$branchfrom = 'Head Office';
								}
								else
								{
									$id_branchfrom = $fetch['id_branchfrom'];
									$fetch3 = mysql_fetch_array(mysql_query("select * from tbl_branch where id_branch = '$id_branchfrom'"));
									$branchfrom = $fetch3['nama_branch'];
								}
								list($y, $m, $d)=split ("[-]",$fetch['tgl_consigment']);
								$tgl_consigment=$d."-".$m."-".$y;
					?>
                        <tr>
                           <td><a href="view_consigment.php?id_consigment=<?php echo $id_consigment; ?>"><?php echo $fetch['kode_consigment'];?></a></td>
                            <td><?php echo $tgl_consigment;?></td>
                            <td><?php echo $branchfrom;?></td>
                            <td><?php echo $branchto;?></td>
                       </tr>
                       <?php
						}
						?>
                  </tbody>
                </table>
                </div>
              </div>
            </div>
          </div>
        </div>
      </div>

    </div>
  </div>
</div>       

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

</html>