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

<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
  
<!--style sheets-->
<link rel="stylesheet" href="../window/dhtmlwindow.css" type="text/css" />
<link rel="stylesheet" href="../window/modal.css" type="text/css" />
<link href="../css/main.css" rel="stylesheet" type="text/css" />

<!--jscript-->
<script type="text/javascript" src="../window/dhtmlwindow.js"></script>
<script type="text/javascript" src="../window/modal.js"></script>
<script language="javascript" src="../jscript/calendar.js"></script>
<script language="JavaScript" src="../jscript/cancel_confirmation.js"  type="text/javascript"></script> 
<script language="JavaScript" src="../jscript/lower_case.js"  type="text/javascript"></script>
<script language="JavaScript" src="../jscript/numbers_only.js"  type="text/javascript"></script>  
<script language="JavaScript" src="../jscript/numbers_only_decimal.js"  type="text/javascript"></script>  
<script language="JavaScript" src="../jscript/upper_case.js"  type="text/javascript"></script>  
<script language="JavaScript" src="../jscript/capitalize_textbox.js"  type="text/javascript"></script> 
<script language="JavaScript" src="../jscript/upper_case.js"  type="text/javascript"></script>   
<?php
include ("../navigation/header.php");
//$registration_no = $_POST['registration_no'];
?>

<?php
$table_name = $_SESSION['db_prefix']."_list_vehicle_make";
    $position_query = "SELECT item_name FROM $table_name ORDER BY item_name ASC";
	$arrId2 = array ();
	$arrName2 = array ();
	$position_result = execsql($position_query);
	if ($position_result!="") {
	$position_num = mysql_num_rows($position_result);
	$b = 0;
	while ($b < $position_num) {
		$arrId2[$b] = mysql_result($position_result, $b, "item_name");
		$arrName2[$b] = mysql_result($position_result, $b, "item_name");
		$b++;
	}
	}
	
	$table_name = $_SESSION['db_prefix']."_list_vehicle_model";
    $position_query = "SELECT item_name FROM $table_name ORDER BY item_name ASC";
	$arrId1 = array ();
	$arrName1 = array ();
	$position_result = execsql($position_query);
	if ($position_result!="") {
	$position_num = mysql_num_rows($position_result);
	$b = 0;
	while ($b < $position_num) {
		$arrId1[$b] = mysql_result($position_result, $b, "item_name");
		$arrName1[$b] = mysql_result($position_result, $b, "item_name");
		$b++;
	}
	}
	
	$table_name = $_SESSION['db_prefix']."_list_company";
    $position_query = "SELECT item_name FROM $table_name ORDER BY item_name ASC";
	$arrId3 = array ();
	$arrName3 = array ();
	$position_result = execsql($position_query);
	if ($position_result!="") {
	$position_num = mysql_num_rows($position_result);
	$b = 0;
	while ($b < $position_num) {
		$arrId3[$b] = mysql_result($position_result, $b, "item_name");
		$arrName3[$b] = mysql_result($position_result, $b, "item_name");
		$b++;
	}
	}
	
	$table_name = $_SESSION['db_prefix']."_list_service_interval";
    $position_query = "SELECT item_name FROM $table_name ORDER BY item_name ASC";
	$arrId4 = array ();
	$arrName4 = array ();
	$position_result = execsql($position_query);
	if ($position_result!="") {
	$position_num = mysql_num_rows($position_result);
	$b = 0;
	while ($b < $position_num) {
		$arrId4[$b] = mysql_result($position_result, $b, "item_name");
		$arrName4[$b] = mysql_result($position_result, $b, "item_name");
		$b++;
	}
	}
	
$vehicle_id = $_GET['vehicle_id'];
$user_id = $_SESSION['username'];

	
$table_name2 = $_SESSION['db_prefix']."_vehicle";
$vehicle_query = "SELECT * FROM $table_name2 WHERE vehicle_id ='".$vehicle_id."' ";
$vehicle_result = mySQL_query($vehicle_query);
$vehicle_num = mysql_num_rows($vehicle_result);	
$vehicle_id = mysql_result($vehicle_result, 0, "vehicle_id");
$a0 = mysql_result($vehicle_result, 0, "registration_no");
$a1 = mysql_result($vehicle_result, 0, "make");
$a2 = mysql_result($vehicle_result, 0, "model");
$a3 = mysql_result($vehicle_result, 0, "fuel");
$a4 = mysql_result($vehicle_result, 0, "department");
$a5 = mysql_result($vehicle_result, 0, "average_consumption");
$a6 = mysql_result($vehicle_result, 0, "in_service");
$a7 = mysql_result($vehicle_result, 0, "chassis_no");
$a8 = mysql_result($vehicle_result, 0, "engine_no");
$a9 = mysql_result($vehicle_result, 0, "service_interval");
$a10 = mysql_result($vehicle_result, 0, "clock_reading");
$a11 = mysql_result($vehicle_result, 0, "road_license_date");
$a12 = mysql_result($vehicle_result, 0, "clock");
$a13 = mysql_result($vehicle_result, 0, "driver");
$a14 = mysql_result($vehicle_result, 0, "notes");
$a15 = mysql_result($vehicle_result, 0, "ba_license_date");



?>



</head>
<body>
<?php

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

if ($permission_num==1) {
	include ("../navigation/store_sidebar.php");
?>
<div class="main_frame">
<form action="vehicle_details_edit_save.php" method="POST" name="form1">
  <div class="page_head_frame">
      <table width="809" border="0" cellspacing="0" cellpadding="0">
          <tr>
            <td width="385"><label class="label_page_head">Vehicle</label>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<label class="label_page_head_2"><?php echo $a0 ?></label></td>
            <td width="253">&nbsp;</td>
            <td width="171" align="right">&nbsp;</td>
          </tr>
        </table>
      </div>
        
<div class="page_middle_frame">
<div class="page_inside_frame">
<div align="left">Vehicle  details</div>
  <table width="670" id="table_details_display">
    <tr>
      <td width="126" height="25">Registration:</td>
      <td><b><?php echo $a0?> 
        <input type="hidden" name="vehicle_id_text" id="vehicle_id_text" value="<?php echo $vehicle_id?>" />
      </b></td>
      <td>&nbsp;</td>
      <td><input type="checkbox" name="in_service_checkbox" id="in_service_checkbox" <?php if ($a6=='yes') { ?> checked <?php } ?>> 
        in service</td>
      </tr>
    <tr>
      <td height="25">Make:</td>
      <td width="191"><select name="make_select" class="select120"  >
        <option value="<?php echo $a1 ?>" selected="selected"><?php echo $a1 ?></option>
        <?php
        	for ($j = 0; $j < count($arrId2); $j++) {
    		echo "<option value=" . "\"" . $arrId2[$j] . "\"" . ">" . $arrName2[$j] . "</option>";
	}
?>
      </select></td>
      <td width="116">Model:</td>
      <td width="217"><select name="model_select" class="select120"  >
        <option value="<?php echo $a2 ?>"><?php echo $a2 ?></option>
        <option value="  "> </option>
        <?php
        	for ($j = 0; $j < count($arrId1); $j++) {
    		echo "<option value=" . "\"" . $arrId1[$j] . "\"" . ">" . $arrName1[$j] . "</option>";
	}
?>
      </select></td>
      </tr>
  </table>
</div>
<div class="page_inside_frame">
<div align="left">Vehicle specifications</div>
  <table width="670" id="table_details_display">
    <tr>
      <td width="126" height="25">Company:</td>
      <td width="207"><select name="department_select" class="select200">
        <option value="<?php echo $a4 ?>" selected="selected"><?php echo $a4 ?></option>
        <?php
        	for ($j = 0; $j < count($arrId3); $j++) {
    		echo "<option value=" . "\"" . $arrId3[$j] . "\"" . ">" . $arrName3[$j] . "</option>";
	}
?>
      </select></td>
      <td width="135">Driver:</td>
      <td width="182"><input type="text" name="driver_text" id="driver_text" class="text200" value="<?php echo $a13 ?>"></td>
      </tr>
    <tr>
      <td height="25">Fuel:</td>
      <td><select name="fuel_select" class="select80" id="fuel_select">
        <option value="diesel">diesel</option>
        <option value="petrol">petrol</option>
        <option value="<?php echo $a3 ?>" selected="selected"><?php echo $a3 ?></option>
      </select></td>
      <td>Aerage consumption:</td>
      <td>1 liter on 
        <input type="text" name="average_text" id="average_text" class="text50" style="text-align:right" onfocus = "this.select();" onKeyPress="return isNumberKey(event)" onkeyup=" this.value = this.value.replace (/(\..).*/, '$1')" maxlength="4" value="<?php echo $a5 ?>"></td>
      </tr>
    <tr>
      <td height="25">Service interval:</td>
      <td>
        <select name="service_select" class="select120"  >
          <option value="<?php echo $a9 ?>" selected="selected"><?php echo $a9 ?></option>
          <?php
        	for ($j = 0; $j < count($arrId4); $j++) {
    		echo "<option value=" . "\"" . $arrId4[$j] . "\"" . ">" . $arrName4[$j] . "</option>";
	}
?>
        </select>
      </td>
      <td>Clock reading:</td>
      <td><input name="mileage_text" type="text" class="text100" id="mileage_text" value="<?php echo $a10 ?>" onfocus = "this.select();" onkeypress="return numbersonly(this, event)"/></td>
      </tr>
    <tr>
      <td height="25">&nbsp;</td>
      <td>&nbsp;</td>
      <td>Clock unit:</td>
      <td><select name="clock_unit_select" class="select80" id="clock_unit_select">
        <option value="km">km</option>
        <option value="hrs">hrs</option>
        <option value="<?php echo $a12 ?>" selected="selected"><?php echo $a12 ?></option>
      </select></td>
    </tr>
  </table>
</div>
<div class="page_inside_frame">
  <table width="670" id="table_details_display">
    <tr>
      <td width="126" height="25">Chassis no:</td>
      <td width="191"><input name="chassis_text" type="text" class="text150" id="chassis_text" value="<?php echo $a7 ?>" onfocus = "this.select();" onkeyup="ToUpper(this)"/></td>
      <td width="134">Engine no:</td>
      <td width="199"><input name="engine_text" type="text" class="text150" id="engine_text" value="<?php echo $a8 ?>" onfocus = "this.select();" onkeyup="ToUpper(this)"/></td>
      </tr>
  </table>
</div>
<div class="page_inside_frame">
<div align="left">Admin</div>
  <table width="670" id="table_details_display">
    <tr>
      <td width="317" height="25">Road license <br />
        expires end of:&nbsp;&nbsp;&nbsp;
        <select name="license_select" class="select80"  >
          <option value=""></option>
          <option value="January">January</option>
          <option value="February">February</option>
          <option value="March">March</option>
          <option value="April">April</option>
          <option value="May">May</option>
          <option value="June">June</option>
          <option value="July">July</option>
          <option value="August">August</option>
          <option value="September">September</option>
          <option value="October">October</option>
          <option value="November">November</option>
          <option value="December">December</option>
          <option value="<?php echo $a11 ?>" selected="selected"><?php echo $a11 ?></option>
        </select></td>
      <td width="341">BA license<br />
expires end of:&nbsp;&nbsp;&nbsp;
        <select name="ba_license_select" class="select80"  >
          <option value=""></option>
          <option value="January">January</option>
          <option value="February">February</option>
          <option value="March">March</option>
          <option value="April">April</option>
          <option value="May">May</option>
          <option value="June">June</option>
          <option value="July">July</option>
          <option value="August">August</option>
          <option value="September">September</option>
          <option value="October">October</option>
          <option value="November">November</option>
          <option value="December">December</option>
          <option value="<?php echo $a15 ?>" selected="selected"><?php echo $a15 ?></option>
        </select></td>
      </tr>
  </table>
</div>
<div class="page_inside_frame">
<div align="left">Miscelaneous</div>
  <table width="670" id="table_details_display">
    <tr>
      <td width="93" height="25" valign="top">Notes:</td>
      <td width="565"><textarea name="notes_text" id="notes_text" cols="50" rows="3"><?php echo $a14 ?></textarea></td>
    </tr>
  </table>
</div>

<div class="page_inside_frame">
  <table width="645" border="0">
    <tr>
      <td width="20"></td>
      <td width="615" align="right"><input type="hidden" name="vehicle_id_text" id="emp_id_text" value="<?php echo $vehicle_id ?>" />
        <input name="button2" type="button" class="imagebutton" id="button2" onclick="cancel_confirmation(3, '../store/store_main.php?date=0');" value="Close"/>
        <input name="save_button"  id="save_button" type="submit" class="imagebutton" value="Save" onclick="needToConfirm = false; confirmRefresh();" />
        <input name="save_close_button"  id="save_close_button" type="submit" class="imagebutton" value="Save &amp; Close" onclick="needToConfirm = false; confirmRefresh();" /></td>
    </tr>
  </table>
</div>

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

</html>