<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>

<?php 
include('../include/session.php');
					  
		$team = $_GET['team'];
								
		$table_name2 = $_SESSION['db_prefix']."_team_stock"; 
		
		$items_query = "SELECT * FROM $table_name2 WHERE team_id = '".$team."' GROUP BY store_item_id ";	
		$items_result = execsql($items_query);
    	$items_num = mysql_num_rows($items_result);
		
		    	
?>
<!--style sheets-->
<link rel="stylesheet" type="text/css" href="../css/tooltip.css" />
<link rel="stylesheet" type="text/css" href="../css/scroll_table.css" />
<link href="../css/main.css" rel="stylesheet" type="text/css">

</head>

<body>
<?php
include ("../navigation/header.php");
$page_name = "Stores-main";
include ("../navigation/access.php");
if ($permission_num==1) {
	 include ("../navigation/store_sidebar.php");
	 ?>
<div class="main_frame">
 
  <div class="page_head_frame">
    <label class="label_page_head">Floating stock list <?php echo $team ?></label>
  </div>
 

<div class="page_inside_frame">
<!--jscript-->
<script language="JavaScript" src="../jscript/tooltip.js"  type="text/javascript"></script>
<script type="text/javascript" language="javascript" src="../jscript/jquery.dataTables.js"></script> 
<script type="text/javascript" charset="utf-8">
			$(document).ready(function() {
				$('#scroll_table_1').dataTable( {
					"sScrollY": "410px",
					"bPaginate": false,
					"bScrollCollapse": true,
					"aaSorting": [[ 0, "asc" ]],
					"aoColumns": [
								{"bSortable": true},
								{"bSortable": true},
								{"bSortable": true},
                             	{"bSortable": true},
								{"bSortable": true},
								{"bSortable": true},
								{"bSortable": true},
								{"bSortable": true},
								{"bSortable": true}
								 ]
				} );
			} );
		</script>
  <table width="650" id="scroll_table_1" class="data_display">
      <thead>
        <tr>
          <th>Product Name</th>
          <th style="border-left:hidden;">&nbsp;</th>
          <th width="101">Group</th>
          <th width="56">Stock<br>qty</th>
          <th width="41">Unit</th>
          <th width="56">&nbsp;</th>
          <th width="56">&nbsp;</th>
          <th width="56">&nbsp;</th>
          <th width="66">&nbsp;</th>
        </tr>
      </thead>
      <tbody>
        <?php 
    $i=0;
	
    while($i < $items_num){
	       $b1 = mysql_result($items_result, $i, "store_item_id");
		        $table_name = $_SESSION['db_prefix']."_store_items";
				$name_query = "SELECT item_name, subCategory, unit FROM $table_name WHERE store_item_id = '".$b1."'  ";
				$name_result = mySQL_query($name_query);
				$b2 = mysql_result($name_result, 0, "item_name");
				$b4 = mysql_result($name_result, 0, "subCategory");
	       		$b8 = mysql_result($name_result, 0, "unit");
	       
		   
	       $b5 = mysql_result($items_result, $i, "total_quantity");
	       
		  				   
		     
			$itemTT = "<table id=table_tool_tip width=250 ><tr><td  width=75>Item name:</td><td width=175>".$b2."</td></tr><tr><td>Group</td><td>".$b4."</td></tr></table><br><b>Click for details</b>";
			
			
    ?>
        <tr class="alt">
          <td width="156" align="left"><a href="store_item_display.php?store_item_id=<?php echo $b1 ?> " onMouseover="ddrivetip('<?php echo $itemTT ?>', 260)"; onMouseout="hideddrivetip()"><?php echo $b2 ?></a></td>
          <td width="22" align="right" style="border-left:hidden;">&nbsp;</td>
          <td align="left"><?php echo $b4 ?>&nbsp;</td>
          <td align="center"><?php
         echo number_format($b5, 2, '.', ',');
			?></td>
          <td align="center"><?php echo $b8 ?></td>
          <td align="center">&nbsp;</td>
          <td align="center">&nbsp;</td>
          <td align="center">&nbsp;</td>
          <td align="center">&nbsp;</td>
        </tr>
        <?php 
		$i++;
    	}
    	?>
      </tbody>
    </table>
  </div>  
  </div>
</div>
</body>
<?php } else { 
    $_SESSION['denied_return'] = "store/store_main.php";	?>
<body onLoad="accessdenied(); return false">
</body>
<?php }
?>
<?php include ('../navigation/side_bar.php'); ?>
