<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />

<!--style sheets-->
<link href="../css/main.css" rel="stylesheet" type="text/css" />
<link rel="stylesheet" type="text/css" href="../css/scroll_table.css" />


<!--jscript-->
<script language="JavaScript" src="../jscript/cancel_confirmation.js"  type="text/javascript"></script> 
<script language="JavaScript" src="../jscript/gen_validatorv4.js"  type="text/javascript" xml:space="preserve"></script>
<script language="JavaScript" src="../jscript/show_hide_layers.js"  type="text/javascript"></script>  
<?php
include('../include/session.php');
require_once('../include/tc_calendar.php');
$today = date("Y-m-d");

$table_name = $_SESSION['db_prefix']."_employee";
$employee_query = "SELECT emp_id, emp_first_name, emp_last_name, department, leave_days FROM $table_name WHERE end_employ_date > '".$today."' AND premature_end_date > '".$today."' ";
$employee_result = mySQL_query($employee_query);
$employee_num = mysql_num_rows($employee_result);	

?>
</head>

<body>

<?php
include ("../navigation/header.php");
$page_name = "HR-leave";
include ("../navigation/access.php");
if ($permission_num==1) {
	include ("../navigation/hr_sidebar.php");
?>




<div class="main_frame"  style="height:auto; min-height:570px;">

<div class="page_head_frame">
        <table width="809" border="0" cellspacing="0" cellpadding="0">
          <tr>
            <td><label class="label_page_head">Leave month allowance</label></td>
            </tr>
        </table>
      </div>
       
<div class="page_middle_frame">
<form action="leave_month_allowance_save.php" method="POST" name="form2" id="form2">
<div class="page_inside_frame">
<p>Month leave days addition for 
  <select name="month_select" id="month_select">
    <option value="January">January</option>
    <option value="February">February</option>
    <option value="March">March</option>
    <option value="April">April</option>
    <option value="May">May</option>
    <option value="June">June</option>
    <option value="July">July</option>
    <option value="August">August</option>
    <option value="September">September</option>
    <option value="October">October</option>
    <option value="November">November</option>
    <option value="December">December</option>
    <option value="" selected="selected"></option>
  </select>
</p>
<p><img src="../images/info_green.png" width="16" height="16">Select/de-select to add leave days. Only selected employees will get leave days added.<br><br>
  
  
</p>
<script type="text/javascript" language="javascript" src="../jscript/jquery.dataTables.js"></script>
<script type="text/javascript" charset="utf-8">
			$(document).ready(function() {
				$('#scroll_table').dataTable( {
					"sScrollY": "500px",
					"bPaginate": false,
					"bScrollCollapse": true,
					"aaSorting": [[ 1, "asc" ]],
					"aoColumns": [
					     		{"bSortable": true},
								{"bSortable": true},
                             	{"bSortable": true},
								{"bSortable": true}
								 ]
				} );
			} );
		</script>
<table width="682" id="scroll_table" class="data_display"  >
  <thead>
   <tr>
      <td width="36"></td>
      <td width="353">Name</td>
      <td width="143">Department</td>
      <td width="112">Allowance</td>
    </tr>
   </thead>
   <?php
   $i=0;
   while ($i<$employee_num) {
	   $emp_id = mysql_result($employee_result, $i, "emp_id");
	   $employee_name = mysql_result($employee_result, $i, "emp_first_name").' '.mysql_result($employee_result, $i, "emp_last_name");
	   $department = mysql_result($employee_result, $i, "department");
	   $allowance = mysql_result($employee_result, $i, "leave_days");
	?>
    <tr>
      <td><input name="leave_checkbox<?php echo $i?>" type="checkbox" id="leave_checkbox<?php echo $i?>" checked="checked"></td>
      <td><?php echo $employee_name ?>&nbsp;
        <input type="hidden" name="emp_id_text<?php echo $i?>" id="emp_id_text<?php echo $i?>" value="<?php echo $emp_id; ?>">
        </td>
      <td><?php echo $department ?>&nbsp;</td>
      <td><?php echo $allowance ?>&nbsp;
        <input type="hidden" name="allowance_text<?php echo $i?>" id="allowance_text<?php echo $i?>" value="<?php echo $allowance; ?>"></td>
    </tr>
    <?php
	$i++;
   }
	?>
    <input name="list_num" id="list_num" type="hidden" value="<?php echo $employee_num ?>">
</table>
  
  

</div>
<div class="page_inside_frame">
    <table width="645" border="0">
    <tr>
      <td width="20"><input name="list_num" id="list_num" type="hidden" value="<?php echo $employee_num ?>"></td>
      <td width="615" align="right"><input name="button2" type="button" class="imagebutton" id="button2" onclick="cancel_confirmation(3, '../hr_module/hr_main.php?date=0');" value="Close"/>
        <input name="save_close_button"  id="save_close_button" type="submit" class="imagebutton" value="Add &amp; Close" onclick="needToConfirm = false; confirmRefresh();" /></td>
    </tr>
  </table>
</div>
</form> 
<script language="JavaScript" type="text/javascript" xml:space="preserve">
  var frmvalidator  = new Validator("form2");
  frmvalidator.EnableMsgsTogether();
  frmvalidator.addValidation("month_select","req","- month.");  
</script>
</div>     
</div>




<?php include ('../navigation/side_bar.php'); ?>

<?php } else {
    $_SESSION['denied_return'] = "hr_module/hr_main.php";	
    include ("../navigation/hr_sidebar.php");?>
	<body onLoad="accessdenied(); return false">	
	</body>
<?php }
?>

</body>
</html>