<?php
session_start();
$menu=$_SESSION['menu'];
include $menu;
?><head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<style type="text/css">
table.myTable { border-collapse:collapse; }
table.myTable td, table.myTable th { border:1px solid black;padding:2px;font-size:11px; }
<p style="font-size:09px;"></p>
</style>

<h4>ΑΝΑΦΟΡΑ ΔΡΑΣΤΗΡΙΟΤΗΤΩΝ ΑΝΑΠΛΗΡΩΣΕΩΝ</h4>
<?php
require "dbconnect.php";
$usr=$_SESSION['usr'];
$access=$_SESSION['access'];
$gym=$_SESSION['gym'];

$sql = mysqli_query($con,"SELECT DISTINCT an.*,s.perigrafi from anaplirosi as an,apousies as ap, syllabi as s
 where (an.date=ap.dateout and an.date=s.date and an.teacher=ap.teacher and ap.teacher=s.pmp and an.period=ap.period and ap.period=s.per and an.period < '$gym' )" );
$c=mysqli_num_rows($sql);

if ($c == 0 ){ 
      echo " ΔΕΝ ΥΠΑΡΧΟΥΝ ΑΝΑΠΛΗΡΩΣΕΙΣ";}
else
{
echo "<table class='myTable' >
<tr style='border:1px solid black;font-size:9px' bgcolor='#ffcc00'  >
<th>Α/A</th>
<th>ΗΜΕΡΟΜΗΝΙΑ</th>
<th>ΠΕΡ.</th>
<th>ΚΑΘΗΓΗΤΗΣ</th>
<th>ΤΜΗΜΑ</th>
<th>ΑΠΟΥΣΙΑΖΕΙ</th>
<th>ΔΡΑΣΤΗΡΙΟΤΗΤΑ</th>
</tr>";	

$i=1;	
while ($row=mysqli_fetch_array($sql))
{
$dat=$row['date'];
$tmima=$row['mathima'];
$perigrafi=$row['perigrafi'];
$teach=$row['teacher'];
$per=$row['period'];
$apon=$row['aponid'];
$tid=$row['tid'];
if ($apon <> $tid)
{
$sql3 = mysqli_query($con,"SELECT Name FROM teachers  WHERE  PMP='$teach'" );
$row3 = mysqli_fetch_array($sql3);
$anapliron = $row3['Name'];
$sql4 = mysqli_query($con,"SELECT Teacher FROM timetable  WHERE  id='$apon'" );
$row4 = mysqli_fetch_array($sql4);
$apont = $row4['Teacher'];
echo "<tr>";
echo "<td>" .$i. "</td>";
if ($dat <> $d1)
{
echo "<td>". date('d-m-Y', strtotime($dat)). "</td>";
}
else echo "<td>". " ". "</td>";
	
echo "<td>". $per . "</td>";
echo "<td>". $anapliron. "</td>";
echo "<td>". $tmima . "</td>";
echo "<td>". $apont . "</td>";
echo "<td>". $perigrafi . "</td>";
echo "</tr>"; 
$d1=$dat;
$i++;
}
}

echo "</table>";
//............
echo "<br>";

}
 ?>
<br /><br /><br />
<a  href=<?php echo $menu;?> style="color:blue "  > <button> Επιστροφή στο Μενού   </a> 
</body>
</html>