

<?php
require'header.php';

require'includes/head2.php';
$current=date('Y-m-d');
$all_app="select * from `appointment` where `payment`=1 ";
 $print_app=$conn->query($all_app);
$rowcount=mysqli_num_rows($print_app);



$p="select * from `appointment`,`patient` where `appointment`.`p_id`=`patient`.`p_id` and `date`='$current' and `status`=1 order by `date`";
$r=$conn->query($p);
echo"<table border=4 width='1000px' class='table table-striped style='margin-top:10px; font-size:16pt'>
	
		<tr>
			<th>Name</th><th>Mobile</th><th>Birth</th><th>Date</th><th colspan=4><a href='app_new.php' style='text-align:center' class='button-6'>NewAppointment</a></th>
		</tr>";
while($row=mysqli_fetch_array($r))
{
	echo"<tr>
			<td>".$row['p_name']."</td>
			<td>".$row['p_mobile']."</td>
			<td style='text-align:center'>";
			
			$dateOfBirth = $row['p_age'];
			$today = date("Y-m-d");
			$diff = date_diff(date_create($dateOfBirth), date_create($today));
			echo $diff->format('%y')." Years";
			
			echo"</td>
			<td>".$row['date']."</td>
			<td style='text-align:center'><a href='detail.php?app_id=".$row['app_id']."&&p_id=".$row['p_id']."' class='button-6'>Detail</a></td>
			<td style='text-align:center'> <a href='print_test.php?app_id=".$row['app_id']."' class='button-6'>PrintTest</a></td>
			<td style='text-align:center'><a href='print.php?app_id=".$row['app_id']."' class='button-6'>PrintTreat</a></td>
			<td style='text-align:center'><a href='finish.php?app_id=".$row['app_id']."' class='button-6'>Finish</a></td>";
		echo"</tr>";
}
echo"</table>";
require 'includes/foot.php';?>

