<?php
include "scrinit.php";
include "logo.php";
?>
<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>
<?php
require "dbconnect.php";
$usr=$_SESSION['usr'];

$sql2 = mysqli_query($con,"SELECT Name FROM teachers  WHERE  PMP='$usr'" );
$row2 = mysqli_fetch_array($sql2);
$teacher = $row2['Name'];

$sql = mysqli_query($con,"SELECT * FROM kataggelia WHERE kataggelon='$usr' ORDER BY tmima,mitroo " );
$c=mysqli_num_rows($sql);

if ($c ==0 ){ 
echo " ΔΕΝ ΥΠΑΡΧΟΥΝ ΚΑΤΑΓΓΕΛΙΕΣ";}
else
{
echo "ΚΑΤΑΓΓΕΛΙΕΣ ΑΠΟ: ". " ". "<b>".$teacher."</b>";
echo "<br>";
echo "<table class='myTable' >
<tr style='border:1px solid black;font-size:9px'  >
<tr>
<th>Αρ.</th>
<th>Τμήμα</th>
<th>Ημερομ.</th>
<th>Μαθητής/τρια</th>
<th>Περιγραφή Παραπτώματος</th>
<th>ΑΝΑΣΤΟΛΗ</th>
<th>ΑΛΛΗ</th>
<th>ΚΑΤΟΙΚΟΝ</th>
<th>ΑΠΟΒΟΛΗ</th>
</tr>";	

$row = mysqli_fetch_array($sql);
$i=1;
while ( $i <= $c ) {
$mitroo=$row['mitroo'];
$nmitroo=$mitroo;
$sql5=mysqli_query($con,"SELECT onoma,eponimo  FROM allstudentinfo  WHERE  mitroo='$mitroo' " );
$row5 = mysqli_fetch_array($sql5);
$stname = $row5['eponimo']."  ".$row5['onoma'];

$sql1=mysqli_query($con,"SELECT Name  FROM teachers  WHERE  PMP='$vdid' " );
$row1 = mysqli_fetch_array($sql1);
$vname = $row1['Name'];
$totalper=0;
while ($mitroo == $nmitroo) {
$sum1=0;$sumk=0;$suma=0;	
$tmima=$row['tmima'];
$aranaforas= $row['aranaforas'];	
$vdid=   $row['bd'];
$datekata= $row['datekata'];
$perigrafi=$row['perigrafi'];
$datetimo = $row['datetimo'];
$timo = $row['periodoi'];
$eidos=$row['eidostimo'];

echo "<tr>";
echo "<td>". $aranaforas. "</td>";
echo "<td>". $tmima . "</td>";
echo "<td>". $datekata . "</td>";
echo "<td>". $stname . "</td>";
echo "<td>". $perigrafi . "</td>";
if ($eidos==0 and $timo==0)
{
	echo "<td>". " ". "</td>";
	echo "<td>". "x" ."</td>";
	echo "<td>". " ". "</td>";
	echo "<td>". " ". "</td>";
}
elseif ($eidos==0 and $timo>0)
{
	echo "<td>". $timo. "</td>";
	echo "<td>". " ". "</td>";
	echo "<td>". " ". "</td>";
	echo "<td>". " ". "</td>";
	$sum1=$sum1+$timo;
}
elseif ($eidos==1)
{
	echo "<td>". " ". "</td>";
	echo "<td>". " ". "</td>";
	echo "<td>". $timo ."</td>";
	echo "<td>". " ". "</td>";
	$sumk=$sumk+$timo;
}
else
{
	echo "<td>". " ". "</td>";
	echo "<td>". " ". "</td>";
	echo "<td>". " ". "</td>";
	echo "<td>". $timo ."</td>";
	$suma=$suma+$timo;	
}

echo "</tr>"; 
$row = mysqli_fetch_array($sql);
$nmitroo=$row['mitroo'];
$i++;
}
echo "<tr>";
echo "<td>". " ". "</td>";
echo "<td>". " " . "</td>";
echo "<td>". " " . "</td>";
echo "<td>". " " . "</td>";
echo "<td>". "ΣΥΝΟΛΟ ΑΠΟΒΟΛΩΝ ". "</td>";
echo "<tr>";
echo "<td colspan='4' align='right'><font color='#0000FF'>" .'ΣΥΝΟΛΟ ΑΠΟΒΟΛΩΝ ΜΑΘΗΤΗ/ΤΡΙΑΣ'. "</font></td>";
echo "<td><font color='#0000FF'>"."<b>".$sum1."</b>"."</font></td>";
echo "<td><font color='#0000FF'>"."<b>"." "."</b>"."</font></td>";
echo "<td><font color='#0000FF'>"."<b>". $sumk ."</b>"."</font></td>";
echo "<td><font color='#0000FF'>"."<b>".$suma."</b>"."</font></td>";
echo "</tr>"; 
}

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