<?php 
// include ('pdf_header_reverse.php');
include('pdf_header.php');
include ('includes/config/config.php');
// include ('includes/functions.php');
include("pdf_ohc_header.php");
include ('log_entry.php');
// include('pop_up_top.php');
?>

<table width="100%" >
<tr><div style="font-size:12px">
<td width="25%" align="left"> Run Date : <?php  echo date("d-M-Y"); ?></td>
<td width="50%" align="center" style="font-size:20px"><strong>Visitor Examination List</strong></td>
<td width="25%" align="center"> User : <?php  echo $username ?></td>
</tr>
</table>

<table width="100%" border="1" cellspacing="0" cellpadding="0"
	style="font: Arial, Helvetica, sans-serif; font-size: XX-SMALL;">
<?php 

// echo $filterkey;
$sql_visitor = base64_decode($filterkey);
// echo $sql_visitor;
error_log($filterkey);
error_log($sql_visitor);
$results_visitor = mysqli_query ($sql_visitor);

?>
 <style>
td {
	font-size: 8px;
}
</style>
	<tr bgcolor="#eeeeee">
		<td width="2%">Sr.</td>
		<td width="10%">Visitor Date</td>
		<td width="12%">Visitor's Name</td>
		<td width="12%">Father's Name</td>
		<td width="5%">Age</td>
		<td width="5%">Gender</td>
		<td width="9%">Gate Pass No.</td>
		<td width="9%">Phone</td>
		<td width="13%">Remarks</td>
		<td width="13%">Doctor's Remarks</td>
	</tr>
  
  <?php 
		$count = 0;
		
		while ( $row_visitor = mysqli_fetch_assoc ( $results_visitor ) ) {
			// extract ( $row_visitor );
			$age = date_diff(date_create($row_visitor['dob']), date_create('now'))->y;
			$appointment_date = date('d-m-Y g:i a', strtotime($row_visitor['appointment_date']));

			?> 
			<?php 
			$count = $count + 1;
			?>
	
		
  
  <tr>
		<td><?php  echo $count?></td>
		<td><?php  echo  $appointment_date?></td>
		<td><?php  echo $row_visitor['patient_name']?></td>
		<td><?php  echo  $row_visitor['father_name']?></td>
		<td><?php  echo  $age?></td>
		<td><?php  echo  $row_visitor['gender']?></td>
		<td><?php  echo  $row_visitor['emp_code']?></td>
		<td><?php  echo  $row_visitor['personal_phone']?></td>
		<td><?php  echo  $row_visitor['remarks']?></td>
		<td><?php  echo  $row_visitor['reviewer_comment']?></td>

	</tr>
	<?php 
		}
		?>
</table>
</body>
<?php 
include ('pdf_footer.php');
?>