<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<!--style sheets-->
<link rel="stylesheet" type="text/css" href="../css/scroll_table.css" />


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



<?php
include ("../navigation/header.php");
include('../include/period_select_date.php');	
	
	
$table_name2 = $_SESSION['db_prefix']."_warnings";
$warning_query = "SELECT warning_id, warning, offence, emp_id, warning_date, exp_date, warning_text FROM $table_name2 WHERE warning_date >= '".$start."' AND warning_date <= '".$end."' ";
$warning_result = $con->query($warning_query);


?>

</head>

<body>
<?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="809" border="0" cellspacing="0" cellpadding="0">
          <tr>
            <td><label class="label_page_head">Issued warnings</label></td>
            <td width="171" align="right">&nbsp;</td>
          </tr>
        </table>
      </div>
 <br />
<br />
<br />
<br />
<div class="page_middle_frame">
<?php
$page='warnings_list.php';
$reference_name='';
$reference='';
$reference_name_2='';
$reference_2='';
include('../include/period_select_block.php');
?>

<div class="page_inside_frame" style="width:680px;">
<!--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, "desc" ]],
					"aoColumns": [
								{"iDataSort": 5},
                              	{"bSortable": true},
                             	{"bSortable": true},
								{"bSortable": true},
								{"iDataSort": 6},
								{"bVisible": false},
								{"bVisible": false}
								 ]
				} );
			} );
		</script>
<table width="680" id="scroll_table" class="data_display"  >
  <thead>
   <tr>
    <th>date</th>
    <th>employee</th>
    <th>warning</th>
    <th>offence </th>
    <th>exp date</th>
    <th>&nbsp;</th>
    <th>&nbsp;</th>
    </tr>
  </thead>
<?php 

while($row = $warning_result->fetch_assoc()) {

	$a =  $row["warning_id"];
	$a0 = $row["warning_date"];
	$a1 = $row["emp_id"];
	$a2 = $row["warning"];
	$a3 = $row["offence"];
	$a4 = $row["exp_date"];
	$a5 = $row["warning_text"];
	
	
	   	$table_name = $_SESSION['db_prefix']."_employee";
    	$employee_query = "SELECT emp_first_name, emp_last_name, department  FROM $table_name WHERE emp_id = $a1 ";
		$employee_result = $con->query($employee_query);
		$row = mysqli_fetch_assoc($employee_result);
		$a1a = $row["emp_first_name"]." ".$row["emp_last_name"];
		$a7 = $row["department"];
        	
	
	$employeeTT = "<label class=tip_text_label>".$a1a."</label><br><label class=tip_click_label>Click for details</label>";  
	$warningTT = "<label class=tip_text_label>".substr($a5, 0, 350)." ........</label><br><label class=tip_click_label>Click to view warning</label>";  
	?>
    
  
  
  <tr>
    <td width="72" align="left"><?php echo date("d-m-Y", strtotime($a0 )) ?></td>
    <td width="182" align="left"><a href="employee_details.php?emp_id=<?php echo $a1?>" onMouseover="ddrivetip('<?php echo $employeeTT ?>  ', 150)"; onMouseout="hideddrivetip()"><?php echo $a1a ?></a></td>
    <td width="101" align="left"><?php echo $a2 ?></td>
    <td width="146" align="left"><a href="warning_details.php?warning_id=<?php echo $a ?> " onMouseover="ddrivetip('<?php echo $warningTT ?>', 250)"; onMouseout="hideddrivetip()"> <?php echo $a3 ?>  </a></td>
    <td width="101" align="left"><?php echo date("d-m-Y", strtotime($a4 )) ?></td>
    <td width="23" align="left"><?php echo $a0 ?></td>
    <td width="23" align="left"><?php echo $a4 ?></td>
    </tr>
  <?php
}
?>

</table>
<div align="left"><label class="label_end">end of list</label></div>
</div>
</div> 
</div>
</body>
<?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'); ?>
</html>