
<!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" />
<link rel="stylesheet" type="text/css" href="../css/tab.css" />
<link rel="stylesheet" type="text/css" href="../css/tooltip.css" />

<?php
include ("../navigation/header.php");
$today = date("Y-m-d");
	
$table_name2 = $_SESSION['db_prefix']."_employee";
$employee_query = "SELECT emp_id, emp_first_name, emp_last_name, id_number, department, position, employ_date, end_employ_date, premature_end_date, permit_number, permit_date  FROM $table_name2  WHERE emp_group='E'";
$employee_result = mySQL_query($employee_query);
$employee_num = mysql_num_rows($employee_result);

?>


</head>


<body>
<?php 

$page_name = "HR-main";
include ("../navigation/access.php");

if ($permission_num==1) {
	include ("../navigation/hr_sidebar.php");
	
    $current_page = "contract_list.php";
	?>	
<div class="main_frame">
 <div class="page_head_frame">
     <table width="809" border="0" cellspacing="0" cellpadding="0">
          <tr>
            <td><label class="label_page_head">Employees - Contract details</label></td>
            <td width="171" align="right">&nbsp;</td>
          </tr>
        </table>
      </div>
 <div class="page_middle_frame" style="width:700px;">       
        <div class="tab_button_holder_frame">
      <a href="employee_list.php"><div class="<?php if ($current_page =='employee_list.php') {echo 'tab_button_active'; } else { echo 'tab_button'; }?>"><div align="center">Employees</div></div></a>
      <a href="contract_list.php"><div class="<?php if ($current_page =='contract_list.php') {echo 'tab_button_active'; } else { echo 'tab_button'; }?>"><div align="center">Contracts</div></div></a>
      <a href="address_list.php"><div class="<?php if ($current_page =='address_list.php') {echo 'tab_button_active'; } else { echo 'tab_button'; }?>"><div align="center">Addresses</div></div></a>
      <a href="contact_list.php"><div class="<?php if ($current_page =='contact_list.php') {echo 'tab_button_active'; } else { echo 'tab_button'; }?>"><div align="center">Contacts</div></div></a>
      <a href="bank_list.php"><div class="<?php if ($current_page =='bank_list.php') {echo 'tab_button_active'; } else { echo 'tab_button'; }?>"><div align="center">Banking</div></div></a>
      <a href="sizes_list.php"><div class="<?php if ($current_page =='sizes_list.php') {echo 'tab_button_active'; } else { echo 'tab_button'; }?>"><div align="center">Sizes</div></div></a>
      <a href="wages_list.php"><div class="<?php if ($current_page =='wages_list.php') {echo 'tab_button_active'; } else { echo 'tab_button'; }?>"><div align="center">Salaries</div></div></a>
      <a href="emergency_list.php"><div class="<?php if ($current_page =='emergency_list.php') {echo 'tab_button_active'; } else { echo 'tab_button'; }?>"><div align="center">Emergency</div></div></a>
      </div>

        
<div class="tab_middle_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": [[ 0, "asc" ]],
					"aoColumns": [
								{"bSortable": true},
                             	{"bSortable": true},
								{"bSortable": true},
								{"iDataSort": 7},
								{"iDataSort": 8},
								{"bSortable": true},
								{"bSortable": true},
								{"bVisible": false},
								{"bVisible": false}
								 ]
				} );
			} );
		</script>
<table width="671" id="scroll_table" class="data_display" >
  <thead>
  <tr>
    <th align="center">Name</th>
    <th align="center">Department</th>
    <th align="center">Position</th>
    <th align="center">Employ date</th>
    <th align="center">Contract<br>
exp date</th>
    <th align="center">Work permit</th>
    <th align="center">Permit exp date</th>
    <th align="center">&nbsp;</th>
    <th align="center">&nbsp;</th>
    </tr>
    </thead>
<?php 
$i=0;
while ($i<$employee_num) {
	$a =  mysql_result($employee_result, $i, "emp_id");
	$a0 = mysql_result($employee_result, $i, "emp_first_name");
	$a1 = mysql_result($employee_result, $i, "emp_last_name");
		
	$a4 = mysql_result($employee_result, $i, "department");
	$a5 = mysql_result($employee_result, $i, "position");
	$a6 = mysql_result($employee_result, $i, "employ_date");
	$a7 = mysql_result($employee_result, $i, "end_employ_date");
	$a8 = mysql_result($employee_result, $i, "permit_number");
	$a9 = mysql_result($employee_result, $i, "permit_date");
	$a10 = mysql_result($employee_result, $i, "premature_end_date");
	
	?>
  
  <tr <?php if ( ($a10<$today) OR ($a7<$today) ) {?>  style='color:#F00;' <?php } ?>  >
    <td width="162" align="left"><a href="employee_details.php?emp_id=<?php echo $a?>" onMouseover="ddrivetip(' Click for employee details.', 150)"; onMouseout="hideddrivetip()"><?php echo $a0." ".$a1 ?></a></td>
    <td width="86" align="left"><?php echo $a4 ?></td>
    <td width="77" align="left"><?php echo $a5 ?></td>
    <td width="86" align="center"><?php echo date("d-m-Y", strtotime($a6 )) ?></td>
    <td width="101" align="center"><?php  if ($a10<$today) {echo '<font color=red>('.date("d-m-Y", strtotime($a10)).')</font>';} ?>
	<?php  if ($a7<"2030-01-01") {echo date("d-m-Y", strtotime($a7 ));} else { echo 'n/a'; } ?></td>
    <td width="101" align="left"><?php echo $a8  ?></td>
    <td width="101" align="center"><?php  if ($a9!="2030-01-01") {echo date("d-m-Y", strtotime($a9 ));} ?></td>
    <td width="95" align="left"><?php echo $a6 ?></td>
    <td width="32" align="left"><?php echo $a7 ?></td>
    </tr>
  <?php
  $i++;
}
?>
</table>

</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>