<?php
include "scrinit.php";
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'];
include "maketimorep.php";

$sql=mysqli_query($con,"SELECT *  FROM timoreport ORDER BY tmima,mitroo,datetimo " );
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 style='width: 400px' >Περιγραφή Παραπτώματος</th>
<th>Καταγγελία από:</th>
<th>ΑΝΑΣΤΟΛΗ</th>
<th>ΑΛΛΗ</th>
<th>ΚΑΤΟΙΚΟΝ</th>
<th>ΑΠΟΒΟΛΗ</th>
</tr>";	

$row = mysqli_fetch_array($sql);
while (!empty($row)){
$sum1=0;$sumk=0;$suma=0;
$i=1;
$mitroo=$row['mitroo'];
while ($mitroo==$row['mitroo']) {
$tmima=$row['tmima'];
$student=$row['student'];
$anafora= $row['anafora'];	
$apovd= $row['apovd'];
$perigrafi=$row['perigrafi'];
$datetimo = $row['datetimo'];
$timo = $row['timo'];
$eidos=$row['eidostimo'];

echo "<tr>";
echo "<td>" .$i. "</td>";
if ($anafora == 0) 
{
	echo "<td>" . " ". "</td>"; 
} 
elseif ($access==4) 
{
	echo "<td>" . "<a href=\"paraptoma2.php?data=".$anafora."\">"."<b>".$anafora."</b>". "</a>". "</td>";
}
else
{
	echo "<td>".$anafora."</td>";	
}
echo "<td>". $tmima . "</td>";
echo "<td>". $datetimo . "</td>";
echo "<td>". $student . "</td>";
echo "<td style='width: 400px' >". $perigrafi . "</td>";
echo "<td>". $apovd . "</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>"; 
$mitroo1=$mitroo;
$i++;
$row = mysqli_fetch_array($sql);
}

echo "<tr>";
echo "<td colspan='7' 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>"; 
//$sum1=0;
//$sumk=0;
//$i=1;
}
echo "</table>";
//............
echo "<br>";

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