<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<!--style sheets--> 
<link href="../css/main.css" rel="stylesheet" type="text/css" />
<link rel="stylesheet" type="text/css" href="../css/scroll_table.css" />
<link rel="stylesheet" type="text/css" href="../css/tooltip.css" />
<!--jscript-->
<script language="javascript" src="../jscript/calendar.js"></script>
<script language="JavaScript" src="../jscript/tooltip.js"  type="text/javascript"></script> 

<?php
include('../include/session.php');
include('../include/period_select_date.php');	

$emp_id = $_GET['emp_id'];


$table_name2 = $_SESSION['db_prefix']."_sick_records";
$sick_query = "SELECT * FROM $table_name2 WHERE emp_id = '".$emp_id."' AND rec_date BETWEEN '".$start."' AND '".$end."' ";
$sick_result = mySQL_query($sick_query);
$sick_num = mysql_num_rows($sick_result);

$table_name2 = $_SESSION['db_prefix']."_employee";
$employee_query = "SELECT emp_first_name, emp_last_name FROM $table_name2 WHERE emp_id ='".$emp_id."' ";
$employee_result = mySQL_query($employee_query);
$employee_num = mysql_num_rows($employee_result);	
$employee_name = mysql_result($employee_result, 0, "emp_first_name").' '.mysql_result($employee_result, 0, "emp_last_name"); 

?>

</head>

<body>
<?php
include ("../navigation/header.php");
$page_name = "HR-main";
include ("../navigation/access.php");

if ($permission_num==1) {
	include ("../navigation/hr_sidebar.php");
?>

<div class="main_frame">

  <div class="page_head_frame">
      <table width="650" border="0" cellspacing="0" cellpadding="0">
          <tr>
            <td width="600"><label class="label_page_head">Sick records</label>&nbsp;&nbsp;<label class="label_page_head_2"><?php echo $employee_name ?></label></td>
            
            <td width="50" align="right">&nbsp;</td>
          </tr>
        </table>
      </div>
<div class="page_middle_frame">
<?php
$page='sick_records.php';
$reference_name='emp_id';
$reference=$emp_id;
include('../include/period_select_block.php');
?>
<div class="page_inside_frame">
<!--jscript-->
<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": [[ 6, "asc" ]],
					"aoColumns": [
								{"iDataSort": 6},
					     		{"bSortable": true},
								{"bSortable": true},
                             	{"bSortable": true},
								{"bSortable": true},
								{"bSortable": true},
								{"bVisible": false}
								 ]
				} );
			} );
		</script>
<table width="680" id="scroll_table" class="data_display"  >
  <thead>
  <tr>
    <th>Date</th>
    <th>Plus</th>
    <th>Minus</th>
    <th>Balance</th>
    <th>reason</th>
    <th>Notes</th>
    <th>&nbsp;</th>
    </tr>
    </thead>
<?php 

$i=0;
$a3_total=0;
$a6_total=0;
while ($i<$sick_num) {

	
		
	$a1 = mysql_result($sick_result, $i, "rec_date");
	$a2 = mysql_result($sick_result, $i, "days_plus");
	$a3 = mysql_result($sick_result, $i, "days_minus");
	$a4 = mysql_result($sick_result, $i, "balance");
	$a5 = mysql_result($sick_result, $i, "reason");
	$a6 = mysql_result($sick_result, $i, "notes");
	
	
	
	
	?>

  <tr>
    <td width="81" align="left"><?php echo date("d-m-Y", strtotime($a1)) ?>&nbsp;</td>
    <td width="71" align="center"><?php echo $a2 ?></td>
    <td width="56" align="center"><?php echo $a3  ?></td>
    <td width="71" align="center"><?php echo $a4 ?></td>
    <td width="86" align="left"><?php echo $a5 ?></td>
    <td width="250" align="left"><?php echo $a6 ?></td>
    <td width="33" align="left"><?php echo $a1?></td>
    </tr>
  
  <?php
  $i++;
}
?>
<tfoot>
</tfoot>
</table>
</div>
<div class="page_inside_frame">
<a href="print_sick_records.php?emp_id=<?php echo $emp_id ?>&emp_name=<?php echo $employee_name ?>&start=<?php echo $start ?>&end=<?php echo $end ?> " title="Manase leave records print" target="_blank"><input name="print_button" type="button" class="imagebutton" value="Print list"></a>
</div>
</div>
</div>

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


</body>
</html>