<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<?php 
include ("../navigation/header.php");

$page_name = "Stores-main";
include ("../navigation/access.php");

if ($permission_num==1) {

	include ("../navigation/store_sidebar.php");
	
	include('../include/period_select_date.php');	
	
	
	$product_item_id =  $_GET['product_item_id'];	 
	
		  
	$table_name1 = $_SESSION['db_prefix']."_product_history";
	$table_name2 = $_SESSION['db_prefix']."_product_store";
	  
		$displayQuery = "SELECT $table_name1.history_id, $table_name1.product_item_id, $table_name1.details, $table_name1.entry, $table_name1.reference, $table_name1.reference_2,  $table_name1.reference_3, $table_name1.quantity, $table_name1.total, $table_name1.date, $table_name1.entryDate,  $table_name1.userId, $table_name2.product_item_id, $table_name2.item_name FROM $table_name1, $table_name2 WHERE $table_name2.product_item_id=$product_item_id AND  $table_name2.product_item_id = $table_name1.product_item_id AND $table_name1.entryDate >= '$start' AND $table_name1.entryDate <= ('$end'+ INTERVAL 1 DAY) ORDER BY $table_name1.history_id DESC";
		$displayResult = $con->query($displayQuery);
		$i = 0;
		$num = mysqli_num_rows($displayResult);
		if ($num==0) {
		  $message="No records to show"; 
		   }
		else  {
		  $message="End of list";
		  }
	
	$table_name3 = $_SESSION['db_prefix']."_product_store";
    $item_query = "SELECT item_name, subCategory, location, quantity, minimumStock, price FROM $table_name3 WHERE product_item_id = '".$product_item_id."'  ";
    $item_result = $con->query($item_query);
	while($row = $item_result->fetch_assoc()) {
	$b2 = $row["item_name"];
	$b3 = $row["subCategory"];
	$b4 = $row["location"];
	$b5 = $row["quantity"];
	$b6 = $row["minimumStock"];
	$b7 = $row["price"];
	}
	
	$itemTT =
		   "<table id=table_tool_tip width=250 ><tr><td  width=75>Item name:</td><td width=175>".$b2."</td></tr><tr><td>Category</td><td>".$b3."</td></tr><tr><td>Location</td><td>".$b4."</td></tr><tr><td>stock qty</td><td>".$b5."</td></tr><tr><td>Min. stock</td><td>".$b6."</td></tr><tr><td>Price</td><td>".$b7."</td></tr></table><br><b>Click for details</b>";
	
	?>
<!--style sheets-->
<link rel="stylesheet" type="text/css" href="../css/tooltip.css" />

<!--jscript-->    
<script type="text/javascript" src="../jscript/tablesort.js"></script>
<script language="JavaScript" src="../jscript/tooltip.js"  type="text/javascript"></script> 

</head>

<body>
<div class="main_frame">
  <div class="page_head_frame">
    <label class="label_page_head">Product Item History</label>
    &nbsp;&nbsp;
    <label class="label_page_head_2"> &nbsp;&nbsp; 
      &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<a href="product_item_display.php?product_item_id=<?php echo $product_item_id ?> " onMouseover="ddrivetip('<?php echo $itemTT ?>', 260)"; onMouseout="hideddrivetip()"> <?php echo $b2 ?></a></label>
  </div>
  <br />
  <br />
  <br />
  <br />
  <br />
  <?php
$page='product_item_history.php';
$reference_name='product_item_id';
$reference=$product_item_id;
$reference_name_2='';
$reference_2='';
include('../include/period_select_block.php');
?>
  <br />
  <br />
  <div class="scroll_frame_long">
    <table width="660" id="table_list" class="sortable-onload-0r rowstyle-alt no-arrow "  >
      <thead>
        <tr>
          <th colspan="2" class="sortable-numeric">Entry </th>
          <th width="468" >Details </th>
          <th width="42" align="center" > qty <br />
            in/out </th>
          <th width="41" align="center"> stock qty</th>
          <th width="38" align="center" >Date</th>
        </tr>
      </thead>
      <tbody>
        <?php
    $i=0;
	$receiveTT = "";
	$TT="";
	$link="";
	while($row = $displayResult->fetch_assoc()) {
        $b1 = $row["history_id"];
		$b2 = $row["details"];
		$b3 = $row["quantity"];
		if ($b3>0) {$b3= '+'.$b3;}
		$b4 = $row["date"];
		$b5 = $row["product_item_id"];
		$b7 = $row["total"];
		$b8 = $row["reference"];
		$b8a = $row["reference_2"];
		$b8b = $row["reference_3"];
		$b10 = $row["entry"];
		$b12="";
		$b9 = $row["entryDate"];
		$b20 = $row["userId"];
		
		
		
		
		//stock count
		//if ($b10==5) { 
//		$b10a = "Stock count adjustment";
//		$stockCountTT = "stock count adjustment";
//		}
		
				
		switch ($b10) {
		case 5:
			//stock count
			$b10a = "Stock count adjustment on batch no ".$b8a.".";
			$stockCountTT = "Stock count adjustment on batch no ".$b8a.".";
		break;	
		case 10:
		    //new item added	
			$table_name = $_SESSION['db_prefix']."_product_store";
			$item_query = "SELECT item_name, category, subCategory, location, minimumStock FROM $table_name WHERE product_item_id = '".$b5."' ";
			$item_result = $con->query($item_query);
			while($row = $item_result->fetch_assoc()) {
			$m1 = $row["item_name"];
			$m2 = $row["category"];
			$m3 = $row["subCategory"];
			$m4 = $row["location"];
			$m5 = $row["minimumStock"];
			}
			
			$itemTT = "<table id=table_tool_tip width=250 ><tr><td  width=75>Item name:</td><td width=175>".$m1."</td></tr><tr><td>Category</td><td>".$m2."</td></tr><tr><td>Sub category</td><td>".$m3."</td></tr><tr><td>Location:</td><td>".$m4."</td></tr><tr><td>Min. stock</td><td>".$m5."</td></tr></table><br><b>Click for details</b>";	
		break;
		
		case 11:
		    //new item added	
			$table_name = $_SESSION['db_prefix']."_product_store";
			$item_query = "SELECT item_name, category, subCategory, location, minimumStock FROM $table_name WHERE product_item_id = '".$b5."' ";
			$item_result = $con->query($item_query);
			while($row = $item_result->fetch_assoc()) {
			$m1 = $row["item_name"];
			$m2 = $row["category"];
			$m3 = $row["subCategory"];
			$m4 = $row["location"];
			$m5 = $row["minimumStock"];
			}
			
			$itemTT = "<table id=table_tool_tip width=250 ><tr><td  width=75>Item name:</td><td width=175>".$m1."</td></tr><tr><td>Category</td><td>".$m2."</td></tr><tr><td>Sub category</td><td>".$m3."</td></tr><tr><td>Location:</td><td>".$m4."</td></tr><tr><td>Min. stock</td><td>".$m5."</td></tr></table><br><b>Click for details</b>";	
		break;
		
		case 12:
			//stock count edit
			$b10a = "Stock count edited on batch no ".$b8a.".";
			$stockCountTT = "Stock count edited on batch no ".$b8a.".";
		break;	
		
		case 13:
		    //deliver product	
			$table_name = $_SESSION['db_prefix']."_deliver_product";
			$cust_id_query = "SELECT cust_id FROM $table_name WHERE delivery_no = '".$b8."'  ";
			$cust_id_result = $con->query($cust_id_query);
			$row = mysqli_fetch_assoc($cust_id_result);
			$cust_id = $row['cust_id'];
			
			$table_name2 = $_SESSION['db_prefix']."_customer";
			$customer_query = "SELECT comp_name FROM $table_name2 WHERE cust_id ='".$cust_id."' ";
			$customer_result = $con->query($customer_query);
			$row = mysqli_fetch_assoc($customer_result);
			$cust_name = $row['comp_name'];
						
			$deliveryTT = "Delivery on note ".$b8." for:<br>".$cust_name."<br>Batch codes: ".$b8a."<br><b>Click for details</b>";	
		break;
		case 14:
		    //cash deliver product	
			
						
			$deliveryTT = "Cash delivery ".$b8." to:<br>".$b8a."<br>Batch codes: ".$b8a."<br><b>Click for details</b>";	
		break;
		
		case 15:
		    //supply department
			$department_supplyTT = "Supply department on no ".$b8b." for:<b>".$b8."</b>.";	
		break;
		
		case 16:
		    //return employee
			$table_name2 = $_SESSION['db_prefix']."_employee";
			$employee_query = "SELECT emp_first_name, emp_last_name FROM $table_name2 WHERE emp_id ='".$b8."' ";
			$employee_result = mySQL_query($employee_query);
			$employee_num = mysql_num_rows($employee_result);	
			$emp_name = mysql_result($employee_result, 0, "emp_first_name").' '.mysql_result($employee_result, 0, "emp_last_name"); 
			$employee_supplyTT = "Return from employee on no ".$b8b." for:<b>".$emp_name."</b>.";	
		break;
		
		case 18:
		    //return from order
			$table_name = $_SESSION['db_prefix']."_order_return";
			$cust_id_query = "SELECT cust_id FROM $table_name WHERE order_return_no = '".$b8b."'  ";
			$cust_id_result = mySQL_query($cust_id_query);
			$cust_id = mysql_result($cust_id_result, 0, "cust_id");
			
			$table_name2 = $_SESSION['db_prefix']."_customer";
			$customer_query = "SELECT comp_name FROM $table_name2 WHERE cust_id ='".$cust_id."' ";
			$customer_result = mySQL_query($customer_query);
			$customer_num = mysql_num_rows($customer_result);	
			$cust_name = mysql_result($customer_result, 0, "comp_name"); 
						
			$order_returnTT = "Returns on note ".$b8b." for:<br>".$cust_name."<br><br><b>Click for details</b>";	
		break;
		
		case 19:
		    
		break;
			
    	case 20:
		   	//direct materials used in production 
			$table_name = $_SESSION['db_prefix']."_production";
			$production_query = "SELECT product_item_id FROM $table_name WHERE production_id = '".$b8."' ";
			$production_result = $con->query($production_query);
			$row = mysqli_fetch_assoc($production_result);
			$product_item_id = $row['product_item_id'];
			
			$table_name = $_SESSION['db_prefix']."_product_store";
			$item_query = "SELECT item_name FROM $table_name WHERE product_item_id = '".$product_item_id."' ";
			$item_result = $con->query($item_query);
			$row = mysqli_fetch_assoc($item_result);
			$item_name = $row['item_name'];

			$production_noTT = "<table id=table_tool_tip width=250 ><tr><td  width=75>Production no:</td><td width=175>".$b8."</td></tr><tr><td>Product:</td><td>".$item_name."</td></tr></table><br><b>Click for details</b>";	
		break;
		 
		 case 21:	           
		   //produced, no stock	recording	
			$table_name5 = $_SESSION['db_prefix']."_production";
            $production_query = "SELECT batch_code, product_item_id, produced_no, production_date  FROM $table_name5 WHERE production_no = '".$b8."'  ";
			$production_result = $con->query($production_query);
			$row = mysqli_fetch_assoc($production_result);
			$c2 = $row['production_date'];
			$c3 = $row['batch_code'];
			$c4 = $row['product_item_id'];
			
			$table_name = $_SESSION['db_prefix']."_product_store";
			$item_name_query = "SELECT item_name FROM $table_name WHERE product_item_id = '".$c4."' ";
			$item_name_result = $con->query($item_name_query);
			$row = mysqli_fetch_assoc($item_name_result);
			$c4a = $row['item_name'];

			$productionTT = "<table width=350px><tr><td>Production date:</td><td>".date("d-m-Y", strtotime($c2))."</td></tr><tr><td  width=90>Product:</td><td>".$c4a."</td></tr><tr><td>Produced:</td><td>".number_format($b3, 0, '.', ',')."</td></tr><tr><td>Batch code:</td><td>".$c3."</td></tr></table><b>Click for details</b>";	
			
		 break;
		 
		case 22:
		   	//edit skips in production
			$table_name5 = $_SESSION['db_prefix']."_production";
            $production_query = "SELECT batch_code, product_item_id, produced_no, production_date  FROM $table_name5 WHERE production_no = '".$b8."'  ";
			$production_result = $con->query($production_query);
			$row = mysqli_fetch_assoc($production_result);
			$c2 = $row['production_date'];
			$c3 = $row['batch_code'];
			$c4 = $row['product_item_id'];
			
			$table_name = $_SESSION['db_prefix']."_product_store";
			$item_name_query = "SELECT item_name FROM $table_name WHERE product_item_id = '".$c4."' ";
			$item_name_result = $con->query($item_name_query);
			$row = mysqli_fetch_assoc($item_name_result);
			$c4a = $row['item_name'];

			$productionTT = "<table width=350px><tr><td>Production date:</td><td>".date("d-m-Y", strtotime($c2))."</td></tr><tr><td  width=90>Product:</td><td>".$c4a."</td></tr><tr><td>Edited total production:</td><td>".number_format($b3, 0, '.', ',')."</td></tr><tr><td>Batch code:</td><td>".$c3."</td></tr></table><b>Click for details</b>";	
			
		break;
		
		case 23:
		   	//direct materials used in production 
			$table_name = $_SESSION['db_prefix']."_production";
			$production_query = "SELECT product_item_id FROM $table_name WHERE production_id = '".$b8."' ";
			$production_result = $con->query($production_query);
			$row = mysqli_fetch_assoc($production_result);
			$store_item_id = $row['store_item_id'];
			
			$table_name = $_SESSION['db_prefix']."_store_items";
			$item_query = "SELECT item_name FROM $table_name WHERE store_item_id = '".$store_item_id."' ";
			$item_result = $con->query($item_query);
			$row = mysqli_fetch_assoc($item_result);
			$item_name = $row['item_name'];

			$production_noTT = "<table id=table_tool_tip width=250 ><tr><td  width=75>Production no:</td><td width=175>".$b8."</td></tr><tr><td>Product:</td><td>".$item_name."</td></tr></table><br><b>Click for details</b>";	
		
		break; 
		
		case 24:
		   	//packed, stock recording	
			$table_name5 = $_SESSION['db_prefix']."_production";
            $production_query = "SELECT batch_code, product_item_id, produced_no, production_date  FROM $table_name5 WHERE production_no = '".$b8."'  ";
			$production_result = $con->query($production_query);
			$row = mysqli_fetch_assoc($production_result);
			$c2 = $row['production_date'];
			$c3 = $row['batch_code'];
			$c4 = $row['product_item_id'];
			
			$table_name = $_SESSION['db_prefix']."_product_store";
			$item_name_query = "SELECT item_name FROM $table_name WHERE product_item_id = '".$c4."' ";
			$item_name_result = $con->query($item_name_query);
			$row = mysqli_fetch_assoc($item_name_result);
			$c4a = $row['item_name'];

			$productionTT = "<table width=350px><tr><td>Production date:</td><td>".date("d-m-Y", strtotime($c2))."</td></tr><tr><td  width=90>Product:</td><td>".$c4a."</td></tr><tr><td>Packed:</td><td>".number_format($b3, 0, '.', ',')."</td></tr><tr><td>Batch code:</td><td>".$c3."</td></tr></table><b>Click for details</b>";	
			
		break; 
		
	  case 25:
		   	//edit production
			
			$table_name = $_SESSION['db_prefix']."_production";
			$production_query = "SELECT store_item_id FROM $table_name WHERE production_id = '".$b8."' ";
			$production_result = $con->query($production_query);
			$row = mysqli_fetch_assoc($production_result);
			$store_item_id = $row['store_item_id'];
			
			$table_name = $_SESSION['db_prefix']."_store_items";
			$item_query = "SELECT item_name FROM $table_name WHERE store_item_id = '".$store_item_id."' ";
			$item_result = $con->query($item_query);
			$row = mysqli_fetch_assoc($item_result);
			$item_name = $row['item_name'];

			$production_noTT = "<table id=table_tool_tip width=250 ><tr><td  width=75>Production no:</td><td width=175>".$b8."</td></tr><tr><td>Product:</td><td>".$item_name."</td></tr></table><br><b>Click for details</b>";	
		break;
		
		case 26:
		   	//edit packed, stock recording	
			$table_name5 = $_SESSION['db_prefix']."_production";
            $production_query = "SELECT batch_code, store_item_id, produced_no, production_date  FROM $table_name5 WHERE production_no = '".$b8."'  ";
			$production_result = $con->query($production_query);
			$row = mysqli_fetch_assoc($production_result);
			$c2 = $row['production_date'];
			$c3 = $row['batch_code'];
			$c4 = $row['store_item_id'];
			
			$table_name = $_SESSION['db_prefix']."_store_items";
			$item_name_query = "SELECT item_name FROM $table_name WHERE store_item_id = '".$c4."' ";
			$item_name_result = $con->query($item_name_query);
			$row = mysqli_fetch_assoc($item_name_result);
			$c4a = $row['item_name'];

			$productionTT = "<table width=350px><tr><td>Production date:</td><td>".date("d-m-Y", strtotime($c2))."</td></tr><tr><td  width=90>Product:</td><td>".$c4a."</td></tr><tr><td>Packed:</td><td>".number_format($b3, 0, '.', ',')."</td></tr><tr><td>Batch code:</td><td>".$c3."</td></tr></table><b>Click for details</b>";	
			
		break; 
		
		case 27:
		   	//edit packing
			
			$table_name = $_SESSION['db_prefix']."_production";
			$production_query = "SELECT store_item_id FROM $table_name WHERE production_id = '".$b8."' ";
			$production_result = $con->query($production_query);
			$row = mysqli_fetch_assoc($production_result);
			$store_item_id = $row['store_item_id'];
			
			$table_name = $_SESSION['db_prefix']."_store_items";
			$item_query = "SELECT item_name FROM $table_name WHERE store_item_id = '".$store_item_id."' ";
			$item_result = $con->query($item_query);
			$row = mysqli_fetch_assoc($item_result);
			$item_name = $row['item_name'];

			$production_noTT = "<table id=table_tool_tip width=250 ><tr><td  width=75>Production no:</td><td width=175>".$b8."</td></tr><tr><td>Product:</td><td>".$item_name."</td></tr></table><br><b>Click for details</b>";	
		break;
		
		case 28:
		   	//edit packing
			
			$table_name = $_SESSION['db_prefix']."_production";
			$production_query = "SELECT store_item_id FROM $table_name WHERE production_id = '".$b8."' ";
			$production_result = $con->query($production_query);
			$row = mysqli_fetch_assoc($production_result);
			$store_item_id = $row['store_item_id'];
			
			$table_name = $_SESSION['db_prefix']."_store_items";
			$item_query = "SELECT item_name FROM $table_name WHERE store_item_id = '".$store_item_id."' ";
			$item_result = $con->query($item_query);
			$row = mysqli_fetch_assoc($item_result);
			$item_name = $row['item_name'];

			$production_noTT = "<table id=table_tool_tip width=250 ><tr><td  width=75>Production no:</td><td width=175>".$b8."</td></tr><tr><td>Product:</td><td>".$item_name."</td></tr></table><br><b>Click for details</b>";	
		break;
		
		case 29:	           
		   //produced, no stock	recording	
			$table_name5 = $_SESSION['db_prefix']."_production";
            $production_query = "SELECT batch_code, product_item_id, produced_no, production_date  FROM $table_name5 WHERE production_no = '".$b8."'  ";
			$production_result = $con->query($production_query);
			$row = mysqli_fetch_assoc($production_result);
			$c2 = $row['production_date'];
			$c3 = $row['batch_code'];
			$c4 = $row['product_item_id'];
			
			$table_name = $_SESSION['db_prefix']."_product_store";
			$item_name_query = "SELECT item_name FROM $table_name WHERE product_item_id = '".$c4."' ";
			$item_name_result = $con->query($item_name_query);
			$row = mysqli_fetch_assoc($item_name_result);
			$c4a = $row['item_name'];

			$productionTT = "<table width=350px><tr><td>Production date:</td><td>".date("d-m-Y", strtotime($c2))."</td></tr><tr><td  width=90>Product:</td><td>".$c4a."</td></tr><tr><td>Produced:</td><td>".number_format($b3, 0, '.', ',')."</td></tr><tr><td>Batch code:</td><td>".$c3."</td></tr></table><b>Click for details</b>";	
		
		 break;
		
		case 35:
		    //new item added	
			$table_name = $_SESSION['db_prefix']."_store_items";
			$item_query = "SELECT item_name, category, subCategory, location, minimumStock FROM $table_name WHERE store_item_id = '".$b5."' ";
			$item_result = $con->query($item_query);
			$row = mysqli_fetch_assoc($item_result);
			$m1 = $row['item_name'];
			$m2 = $row['category'];
			$m3 = $row['subCategory'];
			$m4 = $row['location'];
			$m5 = $row['minimumStock'];
			
			$itemTT = "<table id=table_tool_tip width=250 ><tr><td  width=75>Item name:</td><td width=175>".$m1."</td></tr><tr><td>Category</td><td>".$m2."</td></tr><tr><td>Sub category</td><td>".$m3."</td></tr><tr><td>Location:</td><td>".$m4."</td></tr><tr><td>Min. stock</td><td>".$m5."</td></tr></table><br><b>Click for details</b>";	
		break; 
		 
		case 36:
		    
		break;
		
		case 37:
		   
		break;
		
		}
		
		$entryTT="<label class=tip_text_label_bold>Entered on: ". date('d-m-Y  --- H:i', strtotime($b9)) . " by: ". $b20."</label>";
		
		
		?>
        <tr class="alt">
          <td width="20"><a href=""onmouseover="ddrivetip('<?php echo $entryTT ?>', 250)" onMouseOut="hideddrivetip()";><?php echo $b1?></a></td>
          <td width="23"><a href=""onmouseover="ddrivetip('<?php echo $entryTT ?>', 250)" onMouseOut="hideddrivetip()";><?php echo date("d-m-Y", strtotime($b9));?></a></td>
          <td>
          <?php
            switch ($b10) {
			case 5:	           
		    	?>
            Stock count adjustment on batch no<a href="" onMouseOver="ddrivetip('<?php echo $stockCountTT ?>' , 200)" onMouseOut="hideddrivetip()";> <?php echo $b8a ?></a>
            <?php
			break;	
			case 10:	           
		    	?>
            <a href="store_item_display.php?store_item_id=<?php echo $b5?>" onMouseOver="ddrivetip('<?php echo $itemTT ?>' , 200)" onMouseOut="hideddrivetip()";>Item added to store</a>
            <?php
			break;	
			case 11:	           
		    	?>
            <a href="receive_note.php?receive_id=<?php echo $b8?>" onMouseOver="ddrivetip('<?php echo $itemTT ?>' , 200)" onMouseOut="hideddrivetip()";>Stock received</a>
            <?php
			break;
			case 12:	           
		    	?>
            Stock count edited on batch no <a href="" onMouseOver="ddrivetip('<?php echo $stockCountTT ?>' , 220)" onMouseOut="hideddrivetip()";><?php echo $b8a ?></a>
            <?php
			break;
			case 13:	           
		    	?>
            Delivered on <a href="../store/deliver_product_display.php?delivery_no=<?php echo $b8?>" onMouseOver="ddrivetip('<?php echo $deliveryTT ?>' , 200)" onMouseOut="hideddrivetip()";><b><?php echo $b8 ?></b></a> for <a href="account_details.php?cust_id=<?php echo $b8?>" onMouseOver="ddrivetip('<?php echo $deliveryTT ?>' , 200)" onMouseOut="hideddrivetip()";><?php echo $cust_name ?></a>, batch codes: <?php echo $b8a ?>
            <?php
			break;
			case 14:	           
		    	?>
            Cash delivery <a href="../store/cash_deliver_product_display.php?cash_sale_no=<?php echo $b8?>" onMouseOver="ddrivetip('<?php echo $deliveryTT ?>' , 200)" onMouseOut="hideddrivetip()";><b><?php echo $b8 ?></b></a> to <?php echo $b8a ?>.
            <?php
			break;
			case 15:	           
		    	?>
            Supplied on no <a href="department_supply.php?dep_supply_no=<?php echo $b8b?>" onMouseOver="ddrivetip('<?php echo $department_supplyTT ?>' , 200)" onMouseOut="hideddrivetip()";><?php echo $b8b ?></a> for <?php echo $b8?>, issued to: <?php echo $b8a ?>
            <?php
			break;
			case 16:	           
		    	?>
            Returned on no <a href="employee_return.php?emp_supply_no=<?php echo $b8b?>" onMouseOver="ddrivetip('<?php echo $employee_supplyTT ?>' , 200)" onMouseOut="hideddrivetip()";><?php echo $b8b ?></a> from <a href="../hr_module/employee_details.php?emp_id=<?php echo $b8?>" onMouseOver="ddrivetip('Click for details' , 200)" onMouseOut="hideddrivetip()";><b><?php echo $emp_name?></b></a>.
            <?php
			break;
			case 18:	           
		    	?>
            Returned on no <a href="order_return.php?order_return_no=<?php echo $b8b?>" onMouseOver="ddrivetip('<?php echo $order_returnTT ?>' , 200)" onMouseOut="hideddrivetip()";><?php echo $b8b ?></a> for <a href="account_details.php?cust_id=<?php echo $cust_id?>" onMouseOver="ddrivetip('<?php echo $order_returnTT ?>' , 200)" onMouseOut="hideddrivetip()";><?php echo $cust_name ?></a>.
            <?php
			break;
			case 19:	           
		    	?>
            Supplied on no <a href="company_supply.php?dep_supply_no=<?php echo $b8b?>" onMouseOver="ddrivetip('<?php echo $company_supplyTT ?>' , 200)" onMouseOut="hideddrivetip()";><?php echo $b8b ?></a> for <?php echo $b8?>, issued to: <?php echo $b8a ?>
            <?php
			break;
			case 20:	           
		    	?>
            Used in production, production no: <a href="../production/production_slip.php?production_no=<?php echo $b8?>" onMouseOver="ddrivetip('<?php echo $production_noTT ?>' , 200)" onMouseOut="hideddrivetip()";><b><?php echo $b8?></b></a>: <?php echo $item_name ?>
            <?php
			break;	
			case 21:	           
		    	?>
            Production no <b><a href="../production/production_slip.php?production_no=<?php echo $b8?>" onMouseOver="ddrivetip('<?php echo $productionTT ?>' , 300)" onMouseOut="hideddrivetip()";><?php echo $b8 ?></a></b> of <b><?php echo $c4a ?></b> on: <?php echo date("d-m-Y", strtotime($c2)) ?>, batch code: <?php echo $c3 ?>
            <?php
			break;
			case 22:	           
		    	?>
            Production no <b><a href="../production/production_slip.php?production_no=<?php echo $b8?>" onMouseOver="ddrivetip('<?php echo $productionTT ?>' , 300)" onMouseOut="hideddrivetip()";><?php echo $b8 ?></a></b> of <b><?php echo $c4a ?></b> on: <?php echo date("d-m-Y", strtotime($c2)) ?>, batch code: <?php echo $c3 ?> 
            <?php
			break;	
			case 23:	           
		    	?>
            Used in product packing, production no: <a href="../production/production_slip.php?production_no=<?php echo $b8?>" onMouseOver="ddrivetip('<?php echo $production_noTT ?>' , 200)" onMouseOut="hideddrivetip()";><b><?php echo $b8?></b></a>: <?php echo $item_name ?>
            <?php
			break;
			case 24:	           
		    	?>
            Packing production no <b><a href="../production/production_slip.php?production_no=<?php echo $b8?>" onMouseOver="ddrivetip('<?php echo $productionTT ?>' , 300)" onMouseOut="hideddrivetip()";><?php echo $b8 ?></a></b> of <b><?php echo $c4a ?></b> on: <?php echo date("d-m-Y", strtotime($c2)) ?>, batch code: <?php echo $c3 ?>(stock recorded)
            <?php
			break;
			case 25:	           
		    	?>
            Stock adjustment on editing production no: <a href="../production/production_slip.php?production_no=<?php echo $b8?>" onMouseOver="ddrivetip('<?php echo $production_noTT ?>' , 200)" onMouseOut="hideddrivetip()";><b><?php echo $b8?></b></a>: <?php echo $item_name ?>
            <?php
			break;
			case 26:	           
		    	?>
            Edit packing production no <b><a href="../production/packing_slip.php?production_no=<?php echo $b8?>" onMouseOver="ddrivetip('<?php echo $productionTT ?>' , 300)" onMouseOut="hideddrivetip()";><?php echo $b8 ?></a></b> of <b><?php echo $c4a ?></b> on: <?php echo date("d-m-Y", strtotime($c2)) ?>, batch code: <?php echo $c3 ?> (stock quantity adjusted)
            <?php
			break;
			case 27:	           
		    	?>
            Stock adjustment on editing packing production no: <a href="../production/day_production_display.php?production_no=<?php echo $b8?>" onMouseOver="ddrivetip('<?php echo $production_noTT ?>' , 200)" onMouseOut="hideddrivetip()";><b><?php echo $b8?></b></a>: <?php echo $item_name ?>
            <?php
			break;
			case 28:	           
		    	?>
            Stock adjustment on changing packaging design on production no: <a href="../production/day_production_display.php?production_no=<?php echo $b8?>" onMouseOver="ddrivetip('<?php echo $production_noTT ?>' , 200)" onMouseOut="hideddrivetip()";><b><?php echo $b8?></b></a>: <?php echo $item_name ?>
            <?php
			break;	
			case 29:	           
		    	?>
            Products sent for recycling.
            <?php
			break;
			case 30:	           
		    	?>
            Diesel delivery to: <a href="../store/vehicle_details.php?vehicle_id=<?php echo $b8?>" onMouseOver="ddrivetip('<?php echo $fuel_deliveryTT ?>' , 200)" onMouseOut="hideddrivetip()";><b><?php echo $registration_no?></b></a> <?php echo $make.' '.$model ?>
            <?php
			break;
			case 35:	           
		    	?>
            Adjustment on receive note<a href="receive_note.php?receive_id=<?php echo $b8?>" onMouseOver="ddrivetip('<?php echo $itemTT ?>' , 200)" onMouseOut="hideddrivetip()";> <b><?php echo $b8 ?></b></a>
            <?php
			break;	
			case 36:	           
		    	?>
            Supplied on no <a href="vehicle_supply.php?veh_supply_no=<?php echo $b8b?>" onMouseOver="ddrivetip('<?php echo $vehicle_supplyTT ?>' , 200)" onMouseOut="hideddrivetip()";><?php echo $b8b ?></a> to <a href="../store/vehicle_details.php?vehicle_id=<?php echo $b8?>" onMouseOver="ddrivetip('Click for details' , 200)" onMouseOut="hideddrivetip()";><b><?php echo $veh_name?></b></a>.
            <?php
			break;	
			case 37:	           
		    	?>
            Supplied on no <a href="machinery_supply.php?mach_supply_no=<?php echo $b8b?>" onMouseOver="ddrivetip('<?php echo $machine_supplyTT ?>' , 200)" onMouseOut="hideddrivetip()";><?php echo $b8b ?></a> to <a href="../store/machine_details.php?machine_id=<?php echo $b8?>" onMouseOver="ddrivetip('Click for details' , 200)" onMouseOut="hideddrivetip()";><b><?php echo $mach_name?></b></a>.
            
            <?php
				
    	    } 
			?>
            </td>
          <td align="right"><?php echo $b3?></td>
          <td align="right"><?php echo $b7?></td>
          <td><?php echo date("d-m-Y", strtotime($b4));?></td>
        </tr>
        <?php
	}
	?>
      </tbody>
    </table>
  </div>
</div>
</body>
<?php } else { ?>
<script> needToConfirm = false; </script>
<?php
    $_SESSION['denied_return'] = "store/store_main.php?date=0&branch=&subCatSelect=Tiles";	?>
<body onLoad="accessdenied(); return false">
</body>
<?php }
?>
<?php include ('../navigation/side_bar.php'); ?>
