<?php
$id=$_GET['id'];
$from_date=$_GET['from_date'];
$to_date=$_GET['to_date'];

		include 'includes/conn.php';
		$sql1="SELECT * FROM employees WHERE employee_id=$id";
		$query1 = $conn->query($sql1);
		$row1 = $query1->fetch_assoc();



	
?>
<style>
body{text-align:center;
      }
caption {color: #005200;}
table { 
  border: 2px solid #787878;
        width: 800px;
  border-spacing: 0; 
        margin: auto; }
th {background-color: #00BE3F;}
td, th { padding: 25px; 
         font-family: Arial, sans-serif;  } 
caption { font-family: Verdana, sans-serif;
           font-size: 2.0em;
           font-weight: bold; 
		   padding-bottom: 5px;}
tr:nth-of-type(even) { background-color:#FFF5CC; } 
tr:first-of-type { background-color:#009900; 
                   color: #0D0D0D; }
</style>
<html lang="en">
<head>
<title> Financial Statement</title>
<meta charset="utf-8">
  </head>
  <body style="margin: 100px;">
    <p style="text-align: left; ">
      Dear <?php echo $row1['firstname'].$row1['lastname'] ;?>,
    </p>
    <br>
    <p >
      We are pleased to provide you with your salary statement for the period <?php echo $from_date;?> to <?php echo $to_date ;?>. This statement presents a comprehensive overview of your compensation during the specified period. You will get the absent days, present days and salary monthly wise.
    </p>
 <table summary="A description of the specialty coffee menu items with one item listed in each row. The first column contains the name of the menu item. The second column describes the specialty coffee. The third column contains the price."><br>
 <h3> Financial Statement of <?php echo $row1['firstname'].$row1['lastname'] ;?></h3>

   <tr>
     <th>Month</th>
	 <th>Salary</th>
     <th>Bonus</th>
     <th>Present</th>
     <th>Absent</th>
  </tr>

  <?php

/*$sql="SELECT COUNT(e_id), salary, gross, bonus,  name, absent FROM attendance INNER JOIN salary WHERE attendance.e_id='$id' ";*/
$sql = "SELECT * FROM salary WHERE employee_id = $id AND dates BETWEEN $from_date AND $to_date";
//echo $sql;
	$query = $conn->query($sql);
                    while($row = $query->fetch_assoc()){


  ?>
  <tr>
  	<td><?php echo $row['month']?></td>
     <td><?php echo $row['salary']?></td>
     <td><?php echo $row['bonus']?></td>
	 <td><?php echo 26-$row['absent']?></td>
	  <td><?php echo $row['absent']?></td>
  </tr>
 <?php
}
 ?>
</table>
<p>
  We strive to ensure the accuracy and transparency of your salary statement. If you have any queries or concerns regarding your salary or any of the provided details, please feel free to contact the Human Resources department.

Thank you for your dedication and hard work. We appreciate your contribution to the company's success.

Best regards,
</p>
</body>
</html>