<?php $PageSecurity = 3;
ob_start();
session_name('CAKEPHP'); session_start();
 include ('includes/session.inc');
include ('includes/function_lib.php');
include('includes/fun-php.php');
$years=$_SESSION['payyear'];
$month=$_SESSION['paymonth'];	
$_SESSION['payyear']=$years;
$_SESSION['paymonth']=$month;
$_REQUEST['site']=$_SESSION['emp_salprocess_site'];

global $db;
  echo '<link href="'.$rootpath. '/css/'. $_SESSION['Theme'] .'/default.css" rel="stylesheet" type="text/css" />';
?>
<script type="text/javascript" language="javascript">
  function toggle_visibility(id) {
       var e = document.getElementById(id);
	       e.style.display = 'none';
		       //alert(e.style.display);
			   window.print();
    }
</script>
<?php 
    $GetRecord=	 $_SESSION['EMP_BONUS'] ;
     $ResultData = DB_query($GetRecord,$db);
  
 
$data ='
<table width="100%" border="0">
 <tr align="left">
    <td colspan="6"><h2><center>'.stripslashes($_SESSION['CompanyRecord']['CompanyName']).'<br />Employee Bonus Report</center></h2></td>
	 
  </tr> 
  <tr align="left">
    <td>SNo.</td>
	    <td>Employee Name</td>
			    <td>Month</td>
					    <td>Year</td>
		    <td>Total Basic</td>
			    <td>Bonus Amount</td>
  </tr>';
   
  $k=1; 
  while($RowData = DB_fetch_array($ResultData))
   	  {  
	 	$s=new db_query();	
	   $emp_site=$s->GetFieldValue('empmaster',"id='".$RowData['emp_id']."'" ,'emp_site');
	  
	  
	  
 $data.=' <tr align="left">
    <td>'.$k++.'</td>';
 
    $data.='<td>';
	 $data.=$s->GetFieldValue('empmaster',"id='".$RowData['emp_id']."'" ,'emp_name');
	 
	 $data.= " (".$s->GetFieldValue('empmaster',"id='".$RowData['emp_id']."'" ,'emp_code').")" .'</td>';
	   $data.='<td>'.GetMonth($RowData['payslip_month']).'</td>';
	    $data.='<td>'.$RowData['payslip_year'].'</td>';
    $data.='<td>'.$RowData['EMPBASIC'].'</td>';
    $data.='<td>'."  ".round($RowData['EMPBASIC']*8.33*.01)."  ";
	
	 $data.='</td>';
  $data.='</tr>';
  }   
  

  $data.='</table>';
$header=''; 
 $fname="ReportEmpBonous";
 header("Content-type: application/x-msdownload"); 
header("Content-Disposition: attachment; filename=$fname.xls"); 
header("Pragma: no-cache"); 
header("Expires: 0"); 
print "$header\n$data";  
 ?>
 