<?php require'includes/head2.php';

$d=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`<='$d' and `status`=0 order by `date`";
$r=$conn->query($p);
echo"<table border=4 width='800px'  style='margin-top:10px'>
		<tr>
			<th>Name</th><th>Mobile</th><th width=60px>Age</th><th>Date</th><th>Payment</th><th width='70px'><a href='app_new.php'><img align='center' src='../images/13.png'width='40px' height=''></a></th><th colspan='2'></th>
		</tr>";
while($row=mysqli_fetch_array($r))
{
	$col='#EDEDED';
	if($row['payment']==0)
	{
		$payment='not payed';
		$col='red';
	}
	else $payment='payed';
	echo"<tr>
			<td>".$row['p_name']."</td><td>".$row['p_mobile']."</td><td style='text-align:center'>".$row['p_age']."</td>
			<td>".$row['date']."</td><td bgcolor=".$col.">".$payment."</td>
			<td style='text-align:center'><a href='app_delete.php?app_id=".$row['app_id']."'><img align='center' src='../images/9.png'width='40px' height=''></a></td>
			<td style='text-align:center'><a href='app_pay.php?app_id=".$row['app_id']."'><img align='center' src='../images/14.png'width='40px' height=''></a></td>";
			if($row['payment']==1)
			{echo"<td style='text-align:center'><a href='app_enter.php?app_id=".$row['app_id']."'><img align='center' src='../images/15.png'width='40px' height=''></a></td>";}
		echo"</tr>";
}
echo"</table>";
require 'includes/foot.php';?>

