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


<?php
include('../include/session.php');
$today = date("Y-m-d");
$emp_id = $_GET['emp_id'];
$emp_name = $_GET['emp_name'];
$start = $_GET['start'];
$end = $_GET['end'];


$table_name2 = $_SESSION['db_prefix']."_leave_records";
$leave_query = "SELECT * FROM $table_name2 WHERE emp_id = '".$emp_id."' AND rec_date BETWEEN '".$start."' AND '".$end."' ";
$leave_result = mySQL_query($leave_query);
$leave_num = mysql_num_rows($leave_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"); 

$report_name='Leave records<br>'.$emp_name;
include('../include/print_report_header.php');
?>

</head>


<body   onload="window.print();" onFocus="window.close();">

<div class="print_standard_frame">       
      
<table width="655" id="print_tableprint"  class="sortable-onload-0 rowstyle-alt no-arrow ">
  <thead>
  <tr>
    <th>Date</th>
    <th>Plus</th>
    <th>Minus</th>
    <th>Balance</th>
    <th>reason</th>
    <th>Notes</th>
    </tr>
    </thead>
<?php 

$i=0;
$a3_total=0;
$a6_total=0;
while ($i<$leave_num) {
	$a1 = mysql_result($leave_result, $i, "rec_date");
	$a2 = mysql_result($leave_result, $i, "days_plus");
	$a3 = mysql_result($leave_result, $i, "days_minus");
	$a4 = mysql_result($leave_result, $i, "balance");
	$a5 = mysql_result($leave_result, $i, "reason");
	$a6 = mysql_result($leave_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="101" align="left"><?php echo $a5 ?></td>
    <td width="235" align="left"><?php echo $a6 ?></td>
    </tr>
  
  <?php
  $i++;
}
?>
<tfoot>
</tfoot>
</table>
</div>

</body>
</html>