<head>
<?php
require_once ('../include/tc_calendar.php');
$start = strtotime($_SESSION['receiveDate']);
$d = date("d", $start );
$m = date("m", $start );
$y = date("Y", $start );

$table_name = $_SESSION['db_prefix']."_list_department";
$department_query = "SELECT item_name FROM $table_name ";
	$department_result = execsql($department_query);
	$department_num = mysql_num_rows($department_result);
	$w = 0;
	$arrId = array ();
	$arrName = array ();
	while ($w < $department_num) {
		$arrId[$w] = mysql_result($department_result, $w, "item_name");
		$arrName[$w] = mysql_result($department_result, $w, "item_name");
		$w++;
	}
	
$table_name2 = $_SESSION['db_prefix']."_employee";
$employee_query = "SELECT emp_id, emp_first_name, emp_last_name FROM $table_name2 ORDER BY emp_first_name ASC";
	$employee_result = execsql($employee_query);
	$employee_num = mysql_num_rows($employee_result);
	$v = 0;
	$arrId1 = array ();
	$arrName1 = array ();
	while ($v < $employee_num) {
		$arrId1[$v] = mysql_result($employee_result, $v, "emp_id");
		$arrName1[$v] = mysql_result($employee_result, $v, "emp_first_name")." ".mysql_result($employee_result, $v, "emp_last_name");
		$v++;
	}
?>

<!--jscript-->
<script language="JavaScript" src="../jscript/gen_validatorv4.js"  type="text/javascript" xml:space="preserve"></script>
<script language="JavaScript" src="../jscript/go_to_URL.js"  type="text/javascript"></script>  

</head>
<?php include('../include/wait.php') ?>

<body onLoad="MM_showHideLayers('department-block','','hide','employee_block','','hide','wait','','hide')" onFocus="MM_showHideLayers('wait','','hide');"  onBlur="MM_showHideLayers('wait','','hide');">
<div class="page_middle_frame" >
<form id="form1" method="get" action="deliverWizbase.php">
  <div class="wizard_frame">
          <label class="label_std" >Issued to: &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</label>
          <label class="label_std">
            <input name="select_group" type="radio" id="select_group_0" onClick="MM_showHideLayers('department-block','','show','employee_block','','hide');MM_callJS('form1.employee_select.selectedIndex = 3;');MM_callJS('form1.department_select.selectedIndex = 0;')" value="department" />
            department</label>
          <label class="label_std">
            <input name="select_group" type="radio" id="select_group_1" onClick="MM_showHideLayers('department-block','','hide','employee_block','','show');MM_callJS('form1.department_select.selectedIndex = 3;');MM_callJS('form1.employee_select.selectedIndex = 0;')" value="employee" />
            employee</label>
        </div>
        <br />
        <br />
        <div class="wizard_frame" id="department-block">
          <table width="500" border="0" cellspacing="0" cellpadding="0">
            <tr>
              <td width="141"><label class="label_std">Select department:</label></td>
              <td width="359"><select name="department_select" id="department_select" class="select160" >
                  <option selected> </option>
                  <?php
    	for ($i = 0; $i < count($arrId); $i++) {
		echo "<option value=" . "\"" . $arrId[$i] . "\"" . ">" . $arrName[$i] . "</option>";
		}
     ?>
                </select></td>
            </tr>
          </table>
        </div>
        <br />
        <div class="wizard_frame" id="employee_block">
          <table width="500" border="0" cellspacing="0" cellpadding="0">
            <tr>
              <td width="141"><label class="label_std">Employee name::</label></td>
              <td width="359"><select name="employee_select" id="employee_select" class="select160" >
                  <option selected> </option>
                  <?php
    	for ($j = 0; $j < count($arrId1); $j++) {
		echo "<option value=" . "\"" . $arrId1[$j] . "\"" . ">" . $arrName1[$j] . "</option>";
		}
     ?>
                </select></td>
            </tr>
          </table>
        </div>
      <div class="button_bar_frame" style="margin-top:125px;" >
      <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_goToURL('parent','deliverWizbase.php?s=&p=2');return document.MM_returnValue"  tabindex="-1" MM_showHideLayers('wait','','show');/></td>
            <td width="115"><span class="wizard">
              <input name="s" type="hidden" id="s" value="3" />
              <input name="p" type="hidden" id="p" value="3" />
              </span></td>
            <td width="99">&nbsp;</td>
            <td width="125"><input name="cancelbutton" type="button" class="imagebutton" id="cancelbutton" onClick="needToConfirm = false; cancel_confirmation(1, '../store/store_main.php');;" value="Cancel"  tabindex="-1" MM_showHideLayers('wait','','show');/></td>
            <td width="110" align="left"><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("department_select","req","Please select a department.");
  frmvalidator.addValidation("employee_select","req","Please select an employee.");
 
  </script>
</body>
