<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<link href="../css/main.css" rel="stylesheet" type="text/css" />
<script type="text/javascript" src="../jscript/jquery.1.4.2.js"></script>
<script language="javascript" src="../jscript/calendar.js"></script>

<?php
include('../include/session.php');
require_once('../include/tc_calendar.php');

$edit_date = date("Y-m-d");
$edit_date = strtotime($edit_date);
$d = date("d", $edit_date ) ;
$m = date("m", $edit_date ) ;
$y = date("Y", $edit_date ) ;

$page = $_GET['page'];
	
if ($page=='vehicle') {
$reference='vehicle_service_list.php?date=&vehicle_id=';	
$page_display='Vehicle service.';
$ref='vehicle';
$table_name = $_SESSION['db_prefix']."_vehicle";
$vehicleQuery = "SELECT vehicle_id, registration_no, make, model FROM $table_name  ORDER BY registration_no ASC";
$vehicleResult = execsql($vehicleQuery);
$vehicleNum = mysql_num_rows($vehicleResult);
	$w = 0;
	$arrId4 = array ();
	$arrName4 = array ();
	while ($w < $vehicleNum) {
		$arrId4[$w] = mysql_result($vehicleResult, $w, 'vehicle_id');
		$arrName4[$w] = mysql_result($vehicleResult, $w, 'registration_no').' '.mysql_result($vehicleResult, $w, 'make').' '.mysql_result($vehicleResult, $w, 'model');
		$w++;
	}
}

//if ($page=='supplier') {
//$reference='supplier_details_edit.php?supplier_id=';
//$page_name='Supplier details';
//$table_name = $_SESSION['db_prefix']."_suppliers";
//$supplier_query = "SELECT account_name, supplier_id FROM $table_name ORDER BY account_name ASC";
//$supplier_result = mySQL_query($supplier_query);
//$supplier_num = mysql_num_rows($supplier_result);
//$supplier_id = mysql_result($supplier_result, 0, "supplier_id"); 	
//
//	$w = 0;
//	$arrId4 = array ();
//	$arrName4 = array ();
//	while ($w < $supplier_num) {
//		$arrId4[$w] = mysql_result($supplier_result, $w, 'supplier_id');
//		$arrName4[$w] = mysql_result($supplier_result, $w, 'account_name');
//		$w++;
//	}
//}

?>
</head>

<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">
<div class="page_head_frame">
        <table width="630" border="0" cellspacing="0" cellpadding="0">
          <tr>
            <td width="385"><label class="label_page_head">Select</label></td>
            <td align="right">&nbsp;</td>
          </tr>
        </table>
      </div>
       
<div class="page_middle_frame"><br />

<?php 
if ($page=='vehicle') { ?>
<div class="page_inside_frame">
  <label class="label_std" style="font-size:16px;"><?php echo $page_display?></label>
  <br />
  <br />
  <form action="" method="get">
  
    <label class="label_std"> Select <?php echo $ref?> : &nbsp;&nbsp;</label>
    <select name="vehicle_select" autofocus class="selectbox300" id="vehicle_select" onchange="window.location.href= this.form.vehicle_select.options[this.form.vehicle_select.selectedIndex].value"> 
      <option value=" " selected="selected" >&nbsp;</option>
      <?php
    	for ($j = 0; $j < count($arrId4); $j++) {
			echo "<option value=".$reference.$arrId4[$j].">".$arrName4[$j]."</option>";	
		}
     ?>
    </select>
  
  </form>
  <br />
  <br />
<br />
<br />
<br />
</div>
<?php } ?>


<?php if ($page=='time') { ?>
	 
             <div class="page_inside_frame">
             <form id="form1" name="form1" method="get" action="edit_timekeeping.php">
                <table width="670" border="0" cellspacing="0" cellpadding="0">
                  <tr>
                  <td width="226"><label class="label_std">Select date to edit the time keeping: </label></td>
                  <td><?php 
				  //instantiate class and set properties
		$myCalendar = new tc_calendar("edit_date", true);
		$myCalendar->setIcon("../images/iconCalendar.gif");
		$myCalendar->setDate($d, $m, $y);
		$myCalendar->setYearInterval(2010, 2020);
		//output the calendar
		$myCalendar->writeScript();
?> &nbsp;&nbsp;&nbsp;
                    <input type="hidden" name="edit" id="edit" value="0"/>                    &nbsp;&nbsp;
                    <input name="date"  id="date" type="hidden" value="0" />
                      <input name="continue_button" type="submit" class="imagebutton" id="continue_button"  value="Continue" />
                    </td>
                  </tr>
              </table>
              </form><br />
<br />
<br />
<br />
<br />

              </div>   
             
            <br />
            
            <?php ;} ?>




    
</div>
</div>
<?php include ('../navigation/side_bar.php'); ?>


<?php } else {
    $_SESSION['denied_return'] = "transport/transport_main.php?date=";	
    include ("../navigation/hr_sidebar.php");?>
    <?php include ('../navigation/side_bar.php'); ?>
	<body onLoad="accessdenied(); return false">	
	</body>
<?php }
?>

</body>
</html>