<?php 
if ($_SESSION['job_card_no']=='') {
?>
<script language="javascript" type="text/javascript">
          needToConfirm = false;
          window.location="orders_no_return.php";
</script>
<?php
}
else {
require_once ('../include/tc_calendar.php');
	$start = strtotime($_SESSION['install_date']);
	$d = date("d", $start );
	$m = date("m", $start );
	$y = date("Y", $start );

$table_name = $_SESSION['db_prefix']."_list_names_foreman";
$select_query = "SELECT emp_id, item_name FROM $table_name";
	$arrId2 = array ();
	$arrName2 = array ();
	$select_result = execsql($select_query);
	$select_num = mysql_num_rows($select_result);
	$a = 0;
	while ($a < $select_num) {
		$arrId2[$a] = mysql_result($select_result, $a, "emp_id");
		$arrName2[$a] = mysql_result($select_result, $a, "item_name");
		$a++;
	}
	
$table_name = $_SESSION['db_prefix']."_vehicle";
$select_query = "SELECT vehicle_id, registration_no, make, model FROM $table_name";
	$arrId = array ();
	$arrName = array ();
	$select_result = execsql($select_query);
	$select_num = mysql_num_rows($select_result);
	$a = 0;
	while ($a < $select_num) {
		$arrId[$a] = mysql_result($select_result, $a, "vehicle_id");
		$arrName[$a] = mysql_result($select_result, $a, "registration_no").' '.mysql_result($select_result, $a, "make").' '.mysql_result($select_result, $a, "model");
		$a++;
	}		
?>
<!--jscript-->
<script language="javascript" src="../jscript/calendar.js"></script>
</head>

<?php include('../include/wait.php') ?>
<link href="../css/wait.css" rel="stylesheet" type="text/css">
<body onLoad="MM_showHideLayers('wait','','hide')" onFocus="MM_showHideLayers('wait','','hide');"  onBlur="MM_showHideLayers('wait','','hide');">

<div class="wizard_page_middle_frame">
<form action="" method="get" name="form1" id="form1" >
     <div class="wizard_frame">
           Change project forman: 
             <select name="forman_select" class="select200"  id="forman_select" >
               <option value="<?php echo $_SESSION['forman'] ?>" selected><?php echo $_SESSION['forman_name'] ?></option>
               <?php
        	for ($j = 0; $j < count($arrId2); $j++) {
    		echo "<option value=" . "\"" . $arrId2[$j] . "\"" . ">" . $arrName2[$j] . "</option>";
	}
?>
   </select>
         </div>
        <div class="wizard_frame">
        <table width="600" id="table_details_display">
  <tr>
    <td width="88">Install date:</td>
    <td width="506"><?php

		$myCalendar = new tc_calendar("install_date", true);
		$myCalendar->setIcon("../images/iconCalendar.gif");
		$myCalendar->setDate($d, $m, $y);
		$myCalendar->setPath("./");
		$myCalendar->setYearInterval(2010, 2030);
		//$myCalendar->dateAllow('2009-02-20', "", false);
		$myCalendar->writeScript();
?></td>
  </tr>
  <tr>
    <td colspan="2">      Confirmed with site contact?&nbsp;
      <label class="star">*</label>
&nbsp;
     
          <input type="checkbox" name="confirm_checkbox[]" value="yes" id="confirm_checkbox_0" onMouseUp="document.getElementById('confirm_text').value='yes'; document.getElementById('confirm_checkbox_1').checked=false;" <?php if ($_SESSION['confirm']=='yes') {?> checked="checked" <?php } ?>>yes
          <input type="checkbox" name="confirm_checkbox[]" value="no" id="confirm_checkbox_1" onMouseUp="document.getElementById('confirm_text').value='no'; document.getElementById('confirm_checkbox_0').checked=false;" <?php if ($_SESSION['confirm']=='no') {?> checked="checked" <?php } ?>>no 
          <input type="hidden" name="confirm_text" id="confirm_text" value="<?php echo $_SESSION['confirm'] ?>"></td>
    </tr>
</table>
        </div>
        <div class="wizard_frame">
        <table width="600" id="table_details_display">
  <tr>
    <td width="131">Site contact:&nbsp;&nbsp;
      <label class="star">*</label></td>
    <td width="469"><input type="text" name="site_contact_text" id="site_contact_text" class="text200" value="<?php echo $_SESSION['site_contact']?>" onBlur="capitalize(this)" ></td>
  </tr>
  <tr>
    <td>Site contact no:&nbsp;&nbsp;
      <label class="star">*</label></td>
    <td><input type="text" name="site_no_text" id="site_no_text" class="text100" value="<?php echo $_SESSION['site_no']?>" onKeyPress="return numbersonly(this, event)"></td>
  </tr>
  <tr>
    <td valign="top">Route description:</td>
    <td><textarea name="route_text" id="route_text" cols="50" rows="3" class="text_box"><?php echo $_SESSION['route']?></textarea></td>
  </tr>
</table>
    </div>
    <div class="wizard_frame">
    <table width="600" id="table_details_display">
  <tr>
    <td width="131">Vehicle to be used: 
      <label class="star">*</label></td>
    <td width="469"><select name="vehicle_select" id="vehicle_select" class="select200" >
      <option selected value="<?php echo $_SESSION['vehicle_id']?>"><?php echo $_SESSION['vehicle_name']?></option>
      <?php
        	for ($i = 0; $i < count($arrId); $i++) {
    		echo "<option value=".$arrId[$i].">".$arrName[$i]."</option>";
	}
?>
    </select></td>
  </tr>
</table>

    </div>    
        <div class="wizard_frame">
      <table width="590" height="50" align="center" id="table_button_bar">
        <tr>
          <td width="117"><input type="button" name="lastprev_button" class="imagebutton" value="Prev"  onclick="needToConfirm = false;MM_showHideLayers('wait','','show');MM_goToURL('parent','installJobWizbase.php?s=&amp;p=1');return document.MM_returnValue" /></td>
          <td width="115">&nbsp;</td>
          <td width="99"><input name="p" type="hidden" id="p" value="2" />
            <input name="s" type="hidden" id="s" value="2" />
            </span></td>
          <td width="125" align="right"><input name="cancelbutton" type="button" class="imagebutton" id="cancelbutton"  onClick="needToConfirm = false; cancel_confirmation(1, '../orders/orders_main.php');" value="Cancel" /></td>
          <td width="110" align="right"><input type="submit" name="next_button" id="next_button" class="imagebutton" value="Next"  onClick="needToConfirm = false; MM_showHideLayers('wait','','show'); " /></td>
        </tr>
      </table>
      </div>
</form>
</div>
<script language="JavaScript" type="text/javascript" xml:space="preserve">
  var frmvalidator  = new Validator("form1");
  frmvalidator.EnableMsgsTogether();
  frmvalidator.addValidation("confirm_checkbox[]","selmin=1","- appointment confirmation");
  frmvalidator.addValidation("site_contact_text","req","- site contact name.");
  frmvalidator.addValidation("site_no_text","req","- site contact number.");
  frmvalidator.addValidation("vehicle_select","req","- vehicle to be used.");
  
</script>
</body>      
<?php
}
?>