<?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:12px; }
<p style="font-size:10px;"></p>
</style>

<h2>ΚΑΤΑΓΓΕΛΙΕΣ</h2>
<?php
require "dbconnect.php";
$usr=$_SESSION['usr'];

$sql = mysqli_query($con,"SELECT * FROM kataggelia WHERE (bd='$usr' ) or (kataggelon='$usr' )" );
$c=mysqli_num_rows($sql);


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>
</tr>";	
if ($c==0){ 
  echo "<tr>";
  echo " ΔΕΝ ΥΠΑΡΧΟΥΝ ΚΑΤΑΓΓΕΛΙΕΣ ";
  echo "</tr>";}
else
{

while ($row = mysqli_fetch_array($sql)) {
	
$mitroo=$row['mitroo'];
$aranaforas= $row['aranaforas'];	
$vdid=   $row['bd'];
$kataggelon= $row['kataggelon'];
$datekata= $row['datekata'];
$perigrafi=$row['perigrafi'];
$arsimp = $row['arsimperiforas'];
$datetimo = $row['datetimo'];
$etimo = $row['eidostimo'];
$periodoi = $row['periodoi'];
$katastasi = $row['katastasi'];
$timcode=$row['timoriacode'];

$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'];

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

$sql3 = mysqli_query($con,"SELECT perigrafi FROM eidostimorias  WHERE  code='$timcode'" );
$row3 = mysqli_fetch_array($sql3);
$eidostimo = $row3['perigrafi'];

$sql4 = mysqli_query($con,"SELECT perigrafi,metro FROM paraptoma  WHERE  code='$arsimp'" );
$row4 = mysqli_fetch_array($sql3);
$perpara = $row4['perigrafi'];
$metro = $row4['metro'];

echo "<tr>";
echo "<td>" . "<a href=\"paraptoma2.php?data=".$aranaforas."\">"."<b>".$aranaforas."</b>". "</a>". "</td>";
echo "<td>". $datekata . "</td>";
echo "<td>". $stname . "</td>";
echo "<td>". $perigrafi . "</td>";
echo "<td>". $periodoi ." "."περ.". "</td>";
echo "<td>". $datetimo . "</td>";
if($etimo == 0 ) echo "<td>". "ΜΕ ΑΝΑΣΤΟΛΗ/ΑΛΛΗ" . "</td>"; 
if($etimo == 1 ) echo "<td>". "ΚΑΤ΄ ΟΙΚΟΝ" . "</td>";
if($etimo == 2 ) echo "<td>". "ΑΠΟΒΟΛΗ" . "</td>"; 
$katastasi = $row['katastasi'];
if($katastasi<2)
{echo "<td>". "ΕΚΚΡΕΜΕΙ" . "</td>"; }
else
{echo "<td>". "ΟΛΟΚΛΗΡ." . "</td>";}
echo "</tr>"; 
}
}
$query = mysqli_query($con,"SELECT MAX(aranaforas) FROM kataggelia ");
$results = mysqli_fetch_array($query);
$aranaforas = $results['MAX(aranaforas)'] + 1;
echo "<tr>";
echo "<td>" . $aranaforas. "</td>";
echo "<td colspan= '7' >" . "<a href=\"epilogimathiti.php?data=".$aranaforas."\">"."<b>"."ΝΕΑ ΚΑΤΑΓΓΕΛΙΑ"."</b>". "</a>". "</td>";

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

 ?>

<br /><br /><br /><br />

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