<!--Notice: (c)2013 This page is part of the management program for Tlhomeso Timbers, Gaborone, 
and developed by Customized Software (Pty) Ltd, Gaborone, Botswana. 
Customized Software holds the copyright on the source code on this and all other pages in the 
management program. For more info contact Customized Software on email: info@bwcustomized.com-->

<?php 

	if($_SESSION['p']==1) {
		    $_SESSION['emp_id'] = $_GET['emp_id'];
	}
	$table_name = $_SESSION['db_prefix']."_employee";
	$query = "SELECT emp_id FROM $table_name WHERE emp_id = '". $_SESSION['emp_id']."' " ;
	$result = mySQL_query($query) or die ("Error in query:   $Query . * ". mySQL_error());
	$num = mysql_num_rows($result);
	if ($num==0)
	{ 
	$_SESSION['error']=1;
	$_SESSION['p']=1;
	
	?>
    <script language="javascript" type="text/javascript">
        <!--
		needToConfirm = false;
	 window.location="leaveToWizbase.php?s=0&p=1";
        -->
     </script>
     
     

<?php	
       }
    else{
$_SESSION['error']=0;

?>
<head>

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

<script language="javascript" src="../jscript/calendar.js"></script>

<?php

$table_name = $_SESSION['db_prefix']."_list_leave_give";
    $position_query = "SELECT item_name FROM $table_name ORDER BY item_name ASC";
	$arrId2 = array ();
	$arrName2 = array ();
	$position_result = execsql($position_query);
	if ($position_result!="") {
	$position_num = mysql_num_rows($position_result);
	$b = 0;
	while ($b < $position_num) {
		$arrId2[$b] = mysql_result($position_result, $b, "item_name");
		$arrName2[$b] = mysql_result($position_result, $b, "item_name");
		$b++;
	}
	}

	
require_once('../include/tc_calendar.php');
$rec_date = strtotime($_SESSION['rec_date']);
$d1 = date("d", $rec_date ) ;
$m1 = date("m", $rec_date ) ;
$y1 = date("Y", $rec_date ) ;
   
?>





</head>

<body >
   
<form id="form1" method="get" action="leaveToWizbase.php">
  <table id="tableMain" width="595">
    <!--begin of tableMain-->
    <tr>
      <td><!--center of tableMain-->
        <table width=595 border="0" align="center" cellpadding="10" cellspacing="0" bordercolor="#0066FF" border-collapse="collapse">
          <tr>
            <td width="525" valign="top" >
            
            <?php if ($_SESSION['error2']==1) { ?>
            <div class="wizard_frame">
        <table width="613"  id="table_display_wizard">
                <tr>
                  <td width="253" height="45" valign="middle"><label class="label_std"><font color='red'>An employee with the name "<?php echo $_SESSION['employee_name']?>" does not exists, please select another employee.</font></label>
        </td>
       </tr>
       </table><br>
        <?php 
	// $_SESSION['comp_name'] = "";
	   } ?>
   </div>
   <div class="wizard_frame">         
              <table width="613"  id="table_display_wizard">
                <tr>
                  <td width="140"  valign="middle"><label class="label_std">Date given:</label>
&nbsp;&nbsp;
<label class="star">*</label></td>
                  <td width="461" valign="middle"><?php 
				  //instantiate class and set properties
		$myCalendar = new tc_calendar("rec_date", true);
		$myCalendar->setIcon("../images/iconCalendar.gif");
		$myCalendar->setDate($d1, $m1, $y1);
		$myCalendar->setYearInterval(2010, 2020);
		//output the calendar
		$myCalendar->writeScript();
?></td>
                  </tr>
                <tr>
                  <td valign="middle"><label class="label_std">Number of days:</label>&nbsp;&nbsp;<label class="star">*</label></td>
                  <td valign="middle"><select name="day_no_select" class="select80" id="day_no_select">
                    <option value="0.5">0.5</option>
                    <option value="1.0">1.0</option>
                    <option value="1.5">1.5</option>
                    <option value="2.0">2.0</option>
                    <option value="2.5">2.5</option>
                    <option value="3.0">3.0</option>
                    <option value="3.5">3.5</option>
                    <option value="4.0">4.0</option>
                    <option value="4.5">4.5</option>
                    <option value="5.0">5.0</option>
                    <option value="5.5">5.5</option>
                    <option value="6.0">6.0</option>
                    <option value="6.5">6.5</option>
                    <option value="7.0">7.0</option>
                    <option value="7.5">7.5</option>
                    <option value="8.0">8.0</option>
                    <option value="8.5">8.5</option>
                    <option value="9.0">9.0</option>
                    <option value="9.5">9.5</option>
                    <option value="10.0">10.0</option>
                    <option value="11.0">11.0</option>
                    <option value="12.0">12.0</option>
                    <option value="13.0">13.0</option>
                    <option value="14.0">14.0</option>
                    <option value="15.0">15.0</option>
                    <option value="16.0">16.0</option>
                    <option value="17.0">17.0</option>
                    <option value="18.0">18.0</option>
                    <option value="19.0">19.0</option>
                    <option value="20.0">20.0</option>
                    <option value="<?php echo  $_SESSION['day_no'] ?>" selected><?php echo  $_SESSION['day_no'] ?></option>
                  </select></td>
                  </tr>
                <tr>
                  <td valign="middle"><label class="label_std">Given for:</label>&nbsp;&nbsp;<label class="star">*</label></td>
                  <td valign="middle"><select name="give_take_select" class="select200"  >
                    <option value="<?php echo  $_SESSION['give_take'] ?>" selected><?php echo  $_SESSION['give_take'] ?></option>
                    <?php
        	for ($j = 0; $j < count($arrId2); $j++) {
    		echo "<option value=" . "\"" . $arrId2[$j] . "\"" . ">" . $arrName2[$j] . "</option>";
	}
?>
                  </select></td>
                </tr>
                <tr>
                  <td valign="middle"><label class="label_std">Notes:</label></td>
                  <td valign="middle"><textarea name="notes_text" cols="60" rows="3" class="text_box" id="notes_text"><?php echo  $_SESSION['notes'] ?> </textarea></td>
                </tr>
              </table>
            </div><br /><br /><br />
            <br />
<br /></td>
            <!--center of tableMain-->
          </tr>
          <tr>
            <td><!--center of tableMain-->
              <table width="675" height="50" align="center" id="table_button_bar">
                <tr>
                  <td width="117"><input type="submit" name="prev_button" id="prev_button" class="imagebutton" value="Prev" onClick=" needToConfirm = false; " /></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; confirmRefresh();" value="Cancel" /></td>
                  <td width="110" align="right"><input type="submit" name="next_button" class="imagebutton" value="Next" onClick="needToConfirm = false; " /></td>
                </tr>
              </table></td>
          </tr>
        </table>
  </table>
  <!--end of tableMain-->
</form>
<!--form validation-->
  <script language="JavaScript" type="text/javascript" xml:space="preserve">
  var frmvalidator  = new Validator("form1");
  frmvalidator.EnableMsgsTogether();
  frmvalidator.addValidation("day_no_select","req","Please enter no of days.");
  frmvalidator.addValidation("give_take_select","req","Please select given for."); 
</script>

	
 </body>
 
<?php
	}
	?>