<?php
include("../include/session.php");
if( !$session->isAdmin() && !$session->isRadstoneReceptionUser() && !$session->isRadstoneStoreUser() ){
	//header("Location: ../Store/storeMenu.php");?>
	<script language="javascript" type="text/javascript">
        <!--
		  window.location="denied.php";
        -->
       </script>
	   <?php 
}else{
	include("../storeHeader.php");
			
	
	   
	
	$listQuery =  "SELECT * FROM vehicle  ORDER BY reg_no ";
	$listResult = mySQL_query($listQuery) or die ("Error in query:   $listQuery . * ". mySQL_error());
	$n = 0;
	$listNum = mysql_num_rows($listResult);
	
	 
?>
<script type="text/javascript" src="../css/tablesort.js"></script>
<link href="../css/main.css" rel="stylesheet" type="text/css" />

<script type="text/javascript">
<!--
function MM_goToURL() { //v3.0
  var i, args=MM_goToURL.arguments; document.MM_returnValue = false;
  for (i=0; i<(args.length-1); i+=2) eval(args[i]+".location='"+args[i+1]+"'");
}
//-->
</script>

<div class="headerbox2">Tocotex Vehicle list </div>
<p class="main">Vehicles as per : <b><?php echo date("d-m-Y");?></b>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;        Number in list:<b><b><?php echo $listNum;?></b></b>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
  <input name="button3" type="button" class="linkbutton" id="button3" onclick="MM_goToURL('parent','vehicleWiz0.php');return document.MM_returnValue" value="New Vehicle" />
</p>

	

<table id="tableList" class="sortable-onload-1 rowstyle-alt no-arrow "  >
<thead>
		<tr>
		    <th width="142" class="sortable-text">Registration</th>
			<th width="148" class="sortable-text">Make </th>
			<th width="117" class="sortable-text">Model</th>
			<th width="173" class="sortable-text">Company</th>
		</tr>
	</thead>
	<tbody>
	<?php 
	while ($n < $listNum) {
	    $b0 = mysql_result($listResult, $n, "vehicleId");
		$b1 = mysql_result($listResult, $n, "reg_no");
	    $b2 = mysql_result($listResult, $n, "make");
		$b3 = mysql_result($listResult, $n, "model");
		$b4 = mysql_result($listResult, $n, "company");
		
	?>
	
		<tr onmouseover="this.style.cursor='pointer'" onclick="MM_goToURL('parent','displayVehicle.php?vehicleId=<?php echo $b0 ?>');return document.MM_returnValue" >
		  <td><?php echo $b1?></td>
		  <td> <?php echo $b2?>
		  </td>
		  <td><?php echo $b3?></td>
		  <td><?php echo $b4 ?></td>
	    </tr>
		
	<?php 
	$n++;
	}
	?>
	</tbody>
</table>

  
	  
	    End of list.<?php
	}
	include("../footer.php");

?>
      
