<?php
require_once("../includes/config.php");
$arrstatus = getFullStatus("",$link1);
/////////check approval is applicable or not
$apply_app = getAnyDetails(base64_decode($_REQUEST['pid']),"apply_approval","tabid","tab_master",$link1);
$partcode=$_REQUEST['partcode'];
//// Requisition details

$sql_locdet="SELECT * FROM packing_master where partcode='".$partcode."'";
$res_locdet=mysqli_query($link1,$sql_locdet);
$row_locdet=mysqli_fetch_assoc($res_locdet);

?>
<!DOCTYPE html>
<html>
  <head>
  <meta charset="utf-8">
  <meta name="viewport" content="width=device-width, initial-scale=1">
  <title>
  <?=siteTitle?>
  </title>
  <link rel="shortcut icon" href="../images/titleimg.png" type="image/png">
  <script src="../js/jquery.js"></script>
  <?php 
	 include("../includes/fontawesome.html");
	 include("../includes/main_css.html"); 
	 include("../includes/bootstrap.html");
	 include("../includes/datatables.html");
  ?>
  </head>
  <body>
  <div class="container-fluid">
    <div class="row content">
    <?php 
    include("../includes/leftnav_admin.php");
    ?>
      <div class="<?=$screenwidth?>">
        <h2 align="center"><i class="fa <?=$fa_icon?>"></i> Packing Details</h2>      	
        <div class="form-group"  id="page-wrap" style="margin-left:10px;" >
	  <form id="frm1" name="frm1" class="form-horizontal" action="" method="post">
   <div class="panel-group">
    <div class="panel panel-success table-responsive">
        <div class="panel-heading"><i class="fa fa-newspaper-o fa-lg"></i>&nbsp;&nbsp;Packing Part</div>
         <div class="panel-body">
          <table class="table table-bordered" width="100%">
            <tbody>
              <tr>
                <td width="20%"><label class="control-label">Partcode</label></td>
                <td width="30%" colspan="3"><?php echo getAnyDetails($row_locdet['partcode'],"part_name","partcode","partcode_master",$link1)." (".$row_locdet['partcode'].")"; ?></td>
              </tr>
			  <tr>
				<td width="20%"><label class="control-label">Update Date</label></td>
                <td width="30%"><?=$row_locdet['update_date'];?></td>
              </tr>
			  <tr>
				<td width="20%"><label class="control-label">Update By</label></td>
                <td width="30%" colspan="3"><?=$row_locdet['update_by']?></td>
              </tr>
              <?php if(isset($row_locdet['updateby'])){?>
              <tr>
                <td width="20%"><label class="control-label">Update By</label></td>
                <td width="30%"><?=getAnyDetails($row_locdet['updateby'],"name","username","admin_users",$link1)?></td>
                <td width="20%"><label class="control-label">Update Date</label></td>
                <td width="30%"><?=dt_format($row_locdet['updatedate'])?></td>
              </tr>
              <?php }?>
              <?php if(trim($row_locdet['cancel_by']) !=''){?>
              <tr>
                <td width="20%"><label class="control-label">Cancel By</label></td>
                <td width="30%"><?=getAnyDetails($row_locdet['cancel_by'],"name","username","admin_users",$link1)?></td>
                <td width="20%"><label class="control-label">Cancel Date</label></td>
                <td width="30%"><?=dt_format($row_locdet['cancel_date'])?></td>
              </tr>
              <tr>
                <td width="20%"><label class="control-label">Cancel Remark</label></td>
                <td colspan="3"><?=$row_locdet['cancel_remark']?></td>
              </tr>
              <?php }?>
              <?php 
			  if($apply_app=="Y"){
				  $row_app = mysqli_fetch_assoc(mysqli_query($link1,"select action_by,action_taken,action_date,action_remark from  approval_activity where ref_no='".$docid."'"));
				  ?>
              <tr>
                <td width="20%"><label class="control-label">Approval By</label></td>
                <td width="30%"><?=getAnyDetails($row_app['action_by'],"name","username","admin_users",$link1)?></td>
                <td width="20%"><label class="control-label">Approval Date</label></td>
                <td width="30%"><?=dt_format($row_app['action_date'])?></td>
              </tr>
              <tr>
                <td width="20%"><label class="control-label">Approval Action</label></td>
                <td width="30%"><?=$arrstatus[$row_app['action_taken']]?></td>
                <td width="20%"><label class="control-label">Approval Remark</label></td>
                <td width="30%"><?=$row_app['action_remark']?></td>
              </tr>
              <?php }?>
            </tbody>
          </table>
        </div><!--close panel body-->
    </div><!--close panel-->
    <div class="panel panel-success table-responsive">
        <div class="panel-heading"><i class="fa fa-cubes fa-lg"></i>&nbsp;&nbsp;Packing Details</div>
         <div class="panel-body">
          <table class="table table-bordered" width="100%">
            <thead>
                <tr class="<?=$tableheadcolor?>">
                    <th width="8%">packing_level</th>
                    <th width="13%">Barcode Print</th>
                    <th width="13%">No. Of Unit</th>
                    <th width="13%">Barcode Type</th>
                    <th width="15%">Barcode Info</th>
                    <th width="20%">Sticker Print Size (Inc)</th>
                    <th width="15%">Custom Sticker</th>
                </tr>
            </thead>
            <tbody>
			<?php
			/// select requistion data table info
			$tot_req_qty=0;
			$tot_allocate_qty=0;
			$res_bom = mysqli_query($link1,"SELECT * FROM packing_master where partcode='".$partcode."'");
			while($row_bom = mysqli_fetch_assoc($res_bom)){
			?>
              <tr>
                <td><?=$row_bom['packing_level']?></td>
		<td><?=$row_bom['barcode_print']?></td>
                <td><?=$row_bom['no_of_unit']?></td>
                <td><?=$row_bom['barcode_type']?></td>
                <td><?=$row_bom['barcode_info']?></td>
                <td><?=$row_bom['sticker_print_size']?></td>
                <td><?=$row_bom['custom_sticker']?></td>
              </tr>
              
            <?php }?>
		
            <tr>
                <td align="center" colspan="8">
                  <button title="Back" type="button" class="btn<?= $btncolor ?>" onClick="window.location.href = 'packing_list.php?partcode=<?php
                                    if (isset($_REQUEST['partcode'])) {
                                        echo $_REQUEST['partcode'];
                                    }
                                    ?><?= $pagenav ?>'"><i class="fa fa-reply fa-lg"></i>&nbsp;&nbsp;Back</button>
                 </td>
             </tr>  
            </tbody>
          </table>
        </div><!--close panel body-->
    </div><!--close panel-->    
    </div><!--close panel group-->
	</form>
        </div>
        <!--End form group--> 
      </div>
      <!--End col-sm-9--> 
    </div>
    <!--End row content--> 
  </div>
  <!--End container fluid-->
  <div id="loader"></div>
  <?php
include("../includes/footer.php");
include("../includes/connection_close.php");
?>
</body>
</html>
