<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
  
<?php

include ("../navigation/header.php");
	
$table_name = $_SESSION['db_prefix']."_machinery";
$machine_query = "SELECT machine_id, machine_name, make, model, department, clock_reading FROM $table_name" ;
$machine_result = mySQL_query($machine_query);
$machine_num = mysql_num_rows($machine_result);	

?>

<!--style sheets-->
<link rel="stylesheet" type="text/css" href="../css/tooltip.css" />
<link rel="stylesheet" type="text/css" href="../css/scroll_table.css" />
<!--jscript-->
<script language="JavaScript" src="../jscript/tooltip.js"  type="text/javascript"></script> 
<script type="text/javascript" language="javascript" src="../jscript/jquery.dataTables.js"></script>
</head>
<body>
<?php

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

if ($permission_num==1) {
	include ("../navigation/store_sidebar.php");
?>

<div class="main_frame" style="height:auto;">
  <div class="page_head_frame">
      <table width="809" border="0" cellspacing="0" cellpadding="0">
          <tr>
            <td width="385"><label class="label_page_head">Machinery</label></td>
            <td width="253">&nbsp;</td>
            <td width="171" align="right">&nbsp;</td>
          </tr>
        </table>
      </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": "500px",
					"bPaginate": false,
					"bScrollCollapse": true,
					"aaSorting": [[ 0, "asc" ]],
					"aoColumns": [
								{"bSortable": true},
                              	{"bSortable": true},
                             	{"bSortable": true},
								{"bSortable": true},
								{"bSortable": true},
								{"bSortable": true},
								{"bSortable": true},
								]
				} );
			} );
		</script>

<table id="scroll_table" class="data_display" width="493"; >
  
  <thead>
  <tr>
    <th align="center">Machine name</th>
    <th align="center">Make</th>
    <th align="center">Model</th>
    <th align="center">Company</th>
    <th align="center">Clock reading</th>
    <th align="center">&nbsp;</th>
    <th align="center">&nbsp;</th>
    </tr>
    </thead>
<?php 
$i=0;
while ($i<$machine_num) {
	$a =  mysql_result($machine_result, $i, "machine_id");
	$a0 = mysql_result($machine_result, $i, "machine_name");
	$a1 = mysql_result($machine_result, $i, "make");
	$a2 = mysql_result($machine_result, $i, "model");
	$a4 = mysql_result($machine_result, $i, "department");
	$a7 = number_format(mysql_result($machine_result, $i, "clock_reading"), 0, '.', ',');
	
	
	
		
	
	$vehicleTT ="<table id=table_tool_tip width=250 ><tr><td  width=75>Make/model:</td><td width=175>".$a1.' '.$a2."</td></tr><tr><td>Department:</td><td>".$a4."</td></tr><tr><td>Km reading:</td><td>".$a7."km</td></tr></table><br><b>Click for details</b>";
	
	?>
  
  <tr>
    <td width="40" align="left"><a href="machine_details.php?machine_id=<?php echo $a?>" onMouseover="ddrivetip('<?php echo $vehicleTT ?>  ', 200)"; onMouseout="hideddrivetip()"><?php echo $a0 ?></a></td>
    <td width="47" align="left"><?php echo $a1 ?></td>
    <td width="60" align="left"><?php echo $a2 ?></td>
    <td width="124" align="left"><?php echo $a4 ?></td>
    <td width="59" align="left"><?php echo $a7 ?></td>
    <td width="61" align="left">&nbsp;</td>
    <td width="56" align="left">&nbsp;</td>
    </tr>
  <?php
  $i++;
}
?>
</table>
<div align="left"></div>
</div>
  
</div>
</body>
<?php } else {
$_SESSION['denied_return'] = "transport/transport_main.php?edit=";	
include ("../navigation/transport_sidebar.php");?>
	<body onload="accessdenied(); return false">
	</body>
<?php }
?>
<?php include ('../navigation/side_bar.php'); ?>
</html>