<!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');

$table_name = $_SESSION['db_prefix']."_production";
$received_query = "SELECT production_no, production_date, packing_date, store_item_id, packed_no, batch_code FROM $table_name WHERE packing_date >= '".$start."' AND packing_date <= '".$end."' ";
$received_result = $con->query($received_query);

?>
<!--style sheets-->
<link href="../css/main.css" rel="stylesheet" type="text/css">
<link rel="stylesheet" type="text/css" href="../css/scroll_table.css" />

       
</head>

<body>

<div class="main_frame">
 
  <div class="page_head_frame">
    <label class="label_page_head">Produced tiles & accessories</label>
  </div>

<div class="page_middle_frame">   

<script type="text/javascript" language="javascript" src="../jscript/jquery.dataTables.js"></script>
<script type="text/javascript" charset="utf-8">
			$(document).ready(function() {
				$('#scroll_table').dataTable( {
					"sScrollY": "400px",
					"bPaginate": false,
					"bScrollCollapse": true,
					"aaSorting": [[ 0, "desc" ]],
					"aoColumns": [
								{"bSortable": true},
								{"iDataSort": 6},
								{"iDataSort": 7},
								{"bSortable": true},
								{"bSortable": true},
								{"bSortable": true},
								{"bVisible": false},
								{"bVisible": false}
							 ]
				} );
			} );
		</script>
       
        
<?php
$page='products_received_list.php';
$reference_name='';
$reference='';
$reference_name_2='';
$reference_2='';
include('../include/period_select_block_2.php');
?>

<div class="page_inside_frame">            
          <table width="671" id="scroll_table" class="data_display" >
            <thead>
            <tr>
              <th align="center" >Production<br>no</th>
              <th width="108" >Production date</th>
              <th width="91" >Packing date</th>
              <th width="123" >Product</th>
              <th width="64" >Quantity<br>received</th>
              <th width="127" >Batch code</th>
              <th width="23">&nbsp;</th>
              <th width="23">&nbsp;</th>
              </tr>
            </thead>
            <?php 

while($row = $received_result->fetch_assoc()) {
	$a1 = $row["production_no"];
	$a2 = $row["production_date"];
	$a3 = $row["packing_date"];
	$a4 = $row["store_item_id"];
	$a5 = $row["packed_no"];
	$a6 = $row["batch_code"];
	
	$table_name = $_SESSION['db_prefix']."_store_items";
	$item_name_query = "SELECT item_name, quantity FROM $table_name WHERE store_item_id = '".$a4."'  ";
	$item_name_result = $con->query($item_name_query);
	$row = mysqli_fetch_assoc($item_name_result);
	$a4a = $row['item_name'];
	$a7 = $row['quantity'];
	
	
	$itemTT ="<table id=table_tool_tip ><tr><td  width=75>Item:</td><td width=200>".$a4a."</td></tr><tr><td>Stock received:</td><td>".$a5."</td></tr><tr><td>Current stock:</td><td>".$a7."</td></tr></table><br><b>Click for details</b>";
	?>
            <tr>               
              <td width="76"align="left"  style="padding-left:0px;"><a href="../production/day_production_tiles_list.php?sub_cat=Tiles&date=<?php echo $a2 ?>" onmouseover="ddrivetip('Click for day production', 115)"; onmouseout="hideddrivetip()"><?php echo $a1 ?></a></td>
              <td align="left"><?php echo date("d-m-Y", strtotime($a2))?></td>
              <td align="left"><?php echo date("d-m-Y", strtotime($a3))?></td>
              <td align="left"><a href="store_item_display.php?store_item_id=<?php echo $a4 ?>" onmouseover="ddrivetip('<?php echo $itemTT?>', 300)"; onmouseout="hideddrivetip()"><?php echo $a4a ?></a></td>
              <td align="left"><?php echo $a5 ?></td>
              <td align="left"><?php echo $a6 ?></td>
              <td align="left"><?php echo $a2 ?></td>
              <td align="left"><?php echo $a3 ?></td>
            </tr>
            <?php
}
?>
            <tfoot>
            </tfoot>
          </table>
 
 </div>
</div>

</div> 
<?php include ('../navigation/side_bar.php'); ?>
</body>
<?php } else { ?>
<script> needToConfirm = false; </script>
<?php
    $_SESSION['denied_return'] = "store/store_main.php?date=";	?>
<body onLoad="accessdenied(); return false">
</body>
<?php }
?>

