<?php
require_once ('../include/tc_calendar.php');
	$start = strtotime($_SESSION['inspection_date']);
	$d = date("d", $start );
	$m = date("m", $start );
	$y = date("Y", $start );
	
$table_name = $_SESSION['db_prefix']."_list_names_authorise";
$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++;
}
}		

?>
<script type="text/javascript" src="../jscript/jquery.1.4.2.js"></script>
<script language="JavaScript" src="../jscript/gen_validatorv4.js"  type="text/javascript" xml:space="preserve"></script>
<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">Was the job
        <table width="600" id="table_details_display">
  <tr>
    <td width="296"> carried out in the agreed period:</td>
    <td width="296"><input type="checkbox" name="agreed_checkbox[]" value="yes" id="agreed_checkbox_0" onMouseUp="document.getElementById('agreed_text').value='yes'; document.getElementById('agreed_checkbox_1').checked=false;" <?php if ($_SESSION['agreed']=='yes') {?> checked="checked" <?php } ?>>
      yes
        <input type="checkbox" name="agreed_checkbox[]" value="no" id="agreed_checkbox_1" onMouseUp="document.getElementById('agreed_text').value='no'; document.getElementById('agreed_checkbox_0').checked=false;" <?php if ($_SESSION['agreed']=='no') {?> checked="checked" <?php } ?>>
        no
        <input type="hidden" name="agreed_text" id="agreed_text" value="<?php echo $_SESSION['agreed'] ?>"></td>
  </tr>
  <tr>
    <td> completed in time:</td>
    <td><input type="checkbox" name="completed_checkbox[]" value="yes" id="completed_checkbox_0" onMouseUp="document.getElementById('completed_text').value='yes'; document.getElementById('completed_checkbox_1').checked=false;" <?php if ($_SESSION['completed']=='yes') {?> checked="checked" <?php } ?>>
      yes
      <input type="checkbox" name="completed_checkbox[]" value="no" id="completed_checkbox_1" onMouseUp="document.getElementById('completed_text').value='no'; document.getElementById('completed_checkbox_0').checked=false;" <?php if ($_SESSION['completed']=='no') {?> checked="checked" <?php } ?>>
      no
      <input type="hidden" name="completed_text" id="completed_text" value="<?php echo $_SESSION['completed'] ?>"></td>
  </tr>
  <tr>
    <td> signed for by customer:</td>
    <td><input type="checkbox" name="signed_checkbox[]" value="yes" id="signed_checkbox_0" onMouseUp="document.getElementById('signed_text').value='yes'; document.getElementById('signed_checkbox_1').checked=false;" <?php if ($_SESSION['signed']=='yes') {?> checked="checked" <?php } ?>>
      yes
      <input type="checkbox" name="signed_checkbox[]" value="no" id="signed_checkbox_1" onMouseUp="document.getElementById('signed_text').value='no'; document.getElementById('signed_checkbox_0').checked=false;" <?php if ($_SESSION['signed']=='no') {?> checked="checked" <?php } ?>>
      no
      <input type="hidden" name="signed_text" id="signed_text" value="<?php echo $_SESSION['signed'] ?>"></td>
  </tr>
  <tr>
    <td> job card filled in completely:</td>
    <td><input type="checkbox" name="filled_checkbox[]" value="yes" id="filled_checkbox_0" onMouseUp="document.getElementById('filled_text').value='yes'; document.getElementById('filled_checkbox_1').checked=false;" <?php if ($_SESSION['filled']=='yes') {?> checked="checked" <?php } ?>>
      yes
      <input type="checkbox" name="filled_checkbox[]" value="no" id="filled_checkbox_1" onMouseUp="document.getElementById('filled_text').value='no'; document.getElementById('filled_checkbox_0').checked=false;" <?php if ($_SESSION['filled']=='no') {?> checked="checked" <?php } ?>>
      no
      <input type="hidden" name="filled_text" id="filled_text" value="<?php echo $_SESSION['filled'] ?>"></td>
  </tr>
  <tr>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
  </tr>
  <tr>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
  </tr>
        </table>
        </div>
        <div class="wizard_frame">
        <table width="600" id="table_details_display">
  <tr>
    <td width="296" valign="top">Job was inspected by:</td>
    <td width="292"><select name="inspect_select" class="select120"  >
      <option value="<?php echo $_SESSION['inspect']?>" selected="selected"><?php echo $_SESSION['inspect'] ?></option>
      <?php
        	for ($j = 0; $j < count($arrId1); $j++) {
    		echo "<option value=" . "\"" . $arrId1[$j] . "\"" . ">" . $arrName1[$j] . "</option>";
	}
?>
    </select></td>
  </tr>
  <tr>
    <td valign="top">Inspection date:</td>
    <td><?php

		$myCalendar = new tc_calendar("inspection_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>
        </table>
    </div>
    <div class="wizard_frame">
    <table width="600" id="table_details_display">
  <tr>
    <td width="296">Job approved?</td>
    <td><input type="checkbox" name="approved_checkbox[]" value="yes" id="approved_checkbox_0" onMouseUp="document.getElementById('approved_text').value='yes'; document.getElementById('approved_checkbox_1').checked=false;" <?php if ($_SESSION['approved']=='yes') {?> checked="checked" <?php } ?>>
      yes
      <input type="checkbox" name="approved_checkbox[]" value="no" id="approved_checkbox_1" onMouseUp="document.getElementById('approved_text').value='no'; document.getElementById('approved_checkbox_0').checked=false;" <?php if ($_SESSION['approved']=='no') {?> checked="checked" <?php } ?>>
      no
      <input type="hidden" name="approved_text" id="approved_text" value="<?php echo $_SESSION['approved'] ?>"></td>
  </tr>
</table>

    </div>  
    
    <div class="wizard_frame">
    <table width="600" id="table_details_display">
  <tr>
    <td width="166" valign="top">Inspection report notes:</td>
    <td width="422"><textarea name="inspection_notes_text" id="inspection_notes_text" cols="45" rows="5" class="text_box"><?php echo $_SESSION['inspection_notes'] ?></textarea></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','inspectJobWizbase.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("agreed_checkbox[]","selmin=1","- done in agreed time");
  frmvalidator.addValidation("completed_checkbox[]","selmin=1","- completed in agreed time");
  frmvalidator.addValidation("signed_checkbox[]","selmin=1","- job card signed");
  frmvalidator.addValidation("filled_checkbox[]","selmin=1","- job card completely filled");
  frmvalidator.addValidation("inspect_select","req","- inspector.");
  frmvalidator.addValidation("approved_checkbox[]","selmin=1","- job approved");
  
</script>
</body>      