<?php
$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++;
	}	
?>

</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">
           <table width="630" id="table_display_wizard">
             <tr>
               <td width="123" valign="middle">Project foreman: 
                 <label class="star">*</label></td>
               <td valign="middle"><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></td>
             </tr>
           </table>
            <br>
            <table width="667" id="table_display_wizard">
              <tr>
                <td colspan="4">Project costs:</td>
              </tr>
              <tr>
                <td width="226" height="38">Labour charges:</td>
                <td width="429">
                  <input type="text" name="labour_text" id="labour_text" class="text100" onKeyPress="return isNumberKey(event)" onKeyUp=" this.value = this.value.replace (/(\...).*/, '$1')" style="text-align:right" value="<?php echo $_SESSION['labour'] ?>" autocomplete="off" onfocus = "this.select();">
                </td>
              </tr>
              <tr>
                <td height="37">Travel expense:</td>
                <td><input type="text" name="travel_text" id="travel_text" class="text100" onKeyPress="return isNumberKey(event)" onKeyUp=" this.value = this.value.replace (/(\...).*/, '$1')" style="text-align:right"  value="<?php echo $_SESSION['travel'] ?>" autocomplete="off" onfocus = "this.select();"></td>
              </tr>
              <tr>
                <td height="36">Accomodation expense </td>
                <td><input type="text" name="accomodation_text" id="accomodation_text" class="text100" onKeyPress="return isNumberKey(event)" onKeyUp=" this.value = this.value.replace (/(\...).*/, '$1')" style="text-align:right" value="<?php echo $_SESSION['accomodation'] ?>" autocomplete="off" onfocus = "this.select();"></td>
              </tr>
              <tr>
                <td height="36">&nbsp;</td>
                <td>&nbsp;</td>
              </tr>
              <tr>
                <td height="36"><input type="checkbox" name="mworks_checkbox" id="mworks_checkbox" <?php if ($_SESSION['mworks']=='yes') {?> checked='checked' <?php } ?> onClick="if (document.getElementById('mworks_checkbox').checked==true) {document.getElementById('mworks_text').disabled=false;} else {document.getElementById('mworks_text').disabled=true; document.getElementById('mworks_text').value='';} ">
                  Generate M-works job card&nbsp;&nbsp;&nbsp;</td>
                <td height="36"><input name="mworks_text" type="text" <?php if ($_SESSION['mworks']!='yes') {?> disabled <?php } ?> class="text100" id="mworks_text" style="text-align:right" onKeyPress="return isNumberKey(event)" onKeyUp=" this.value = this.value.replace (/(\...).*/, '$1')" value="<?php echo $_SESSION['mworks_charge'] ?>"></td>
              </tr>	
            </table>
        </div>
        
        <div class="wizard_spacer_frame" style="height:50px;"></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','compileJobWizbase.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>
            <input type="hidden" name="preset" id="preset">
            <input type="hidden" name="preset_list_name" id="preset_list_name"></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>
<!--form validation-->
<script language="JavaScript" type="text/javascript" xml:space="preserve">

  var frmvalidator  = new Validator("form1");
  frmvalidator.EnableMsgsTogether();
  frmvalidator.addValidation("forman_select","req","Please select forman for this project");
 
  
</script>
</body>      