<!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('../include/session.php');
?>
</head>
<?php
	
$table_name = $_SESSION['db_prefix']."_vehicle";
$vehicle_query = "SELECT vehicle_id, registration_no, make, model, fuel, department, clock_reading, road_license_date, ba_license_date, renewal_date FROM $table_name WHERE disposal_date = '2030-01-01'" ;
$vehicle_result = mySQL_query($vehicle_query);
$vehicle_num = mysql_num_rows($vehicle_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>

<body>
<?php
include ("../navigation/header.php");
$page_name = "Transport-main";
include ("../navigation/access.php");

if ($permission_num==1) {
	include ("../navigation/transport_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">Vehicles</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": [[ 1, "asc" ]],
					"aoColumns": [
								{"bSortable": true},
                              	{"bSortable": true},
                             	{"bSortable": true},
								{"bSortable": true},
								{"bSortable": true},
								{"bSortable": true},
								{"bSortable": true},
								{"bSortable": true},
								{"bSortable": true}
								 ]
				} );
			} );
		</script>

<table id="scroll_table" class="data_display" width="640"; >
  
  <thead>
  <tr>
    <th align="center">Reg no</th>
    <th align="center">Make</th>
    <th align="center">Model</th>
    <th align="center">Department</th>
    <th align="center">Mileage</th>
    <th align="center">Road license</th>
    <th align="center">BA license</th>
    <th align="center">Insurance</th>
    <th align="center">&nbsp;</th>
    </tr>
    </thead>
<?php 
$i=0;
while ($i<$vehicle_num) {
	$a =  mysql_result($vehicle_result, $i, "vehicle_id");
	$a0 = mysql_result($vehicle_result, $i, "registration_no");
	$a1 = mysql_result($vehicle_result, $i, "make");
	$a2 = mysql_result($vehicle_result, $i, "model");
	//$a3 = mysql_result($vehicle_result, $i, "fuel");
	$a4 = mysql_result($vehicle_result, $i, "department");
	//$a5 = mysql_result($vehicle_result, $i, "chassis_no");
	//$a6 = mysql_result($vehicle_result, $i, "insurance_value");
	$a7 = number_format(mysql_result($vehicle_result, $i, "clock_reading"), 0, '.', ',');
	$a8 = mysql_result($vehicle_result, $i, "road_license_date");
	$a9 = mysql_result($vehicle_result, $i, "ba_license_date");
	$a10 = mysql_result($vehicle_result, $i, "renewal_date");
	
	
	
		
	
	$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="48" align="left"><a href="vehicle_details.php?vehicle_id=<?php echo $a?>" onMouseover="ddrivetip('<?php echo $vehicleTT ?>  ', 200)"; onMouseout="hideddrivetip()"><?php echo $a0 ?></a></td>
    <td width="56" align="left"><?php echo $a1 ?></td>
    <td width="86" align="left"><?php echo $a2 ?></td>
    <td width="41" align="left"><?php echo $a4 ?></td>
    <td width="71" align="right"><?php echo $a7 ?></td>
    <td width="81" align="center"><?php if ($a8!='0000-00-00') { echo date("M-Y", strtotime($a8));}?></td>
    <td width="76" align="center"><?php if ($a9!='0000-00-00') { echo date("M-Y", strtotime($a9));}?></td>
    <td width="85" align="center"><?php if ($a10!='0000-00-00') { echo date("M-Y", strtotime($a10));}?></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>