<?php
include "scrinit.php";
include "logo.php";
?>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Επιστολή για Καθυστερήσεις</title>
<style type="text/css">
table.myTable { border-collapse:collapse; }
table.myTable td, table.myTable th { border:1px solid black;padding:1px;font-size:11pt; }
<p style="font-size:11px;"></p>
</style>
</head>

<body>
<?php
include "dbconnect.php";
$dat=$_SESSION['dat']; 
$gym=$_SESSION['gym']; 
$code=$_GET['cod'];
$s=$dbcon->prepare("select onoma from ekdilosi where code=?");
$s->execute([$code]);
$row=$s->fetch(PDO::FETCH_ASSOC);
$ekd=$row['onoma'];
?>
<h2><center>ΑΝΑΚΟΙΝΩΣΗ</center></h2>
<h3><center>Κατάλογος μαθητών/τριων για <?php echo $ekd;?></center></h3> 
<?php
echo "ΗΜΕΡΟΜΗΝΙΑ: ".$dat;
echo "<br>";echo "<br>";

$result = $dbcon->prepare("SELECT pmp,tmima,p1,p2,p3,p4,p5,p6,p7,p8,p9 FROM ekdilosistu WHERE code =?");
$result->execute([$code]);
$rowcount=$result->rowCount();

if($rowcount <= 0)
{
    echo "ΔΕΝ ΕΧΟΥΝ ΕΠΙΛΕΓΕΙ ΜΑΘΗΤΕΣ";
    include "epmathnew.php";
}
else 
{
echo "<table class='myTable' >
<tr style='border:1px solid black' >
<tr>
<th>Α/Α</th>
<th>ΜΗΤΡΩΟ</th>
<th>ΤΜΗΜΑ</th>
<th>ΜΑΘΗΤΗΣ / ΤΡΙΑ</th>
<th>ΠΑΡΟΥΣΙΑ</th>";
for ($i=1;$i<=$gym;$i++)
{
	$titep="Περ".$i;
	echo "<th>".$titep."</th>";
}
echo "</tr>";
$i=1;
while($row = $result->fetch(PDO::FETCH_ASSOC))
{
	 $mt=$row['pmp'];
	 $tm=$row['tmima'];
	 $pr[1]=$row['p1'];$pr[2]=$row['p2'];$pr[3]=$row['p3'];$pr[4]=$row['p4'];$pr[5]=$row['p5'];
	 $pr[6]=$row['p6'];$pr[7]=$row['p7'];$pr[8]=$row['p8'];$pr[9]=$row['p9'];
	 $sql1 = "SELECT eponimo, onoma FROM allstudentinfo WHERE mitroo =?";
     $rt = $dbcon->prepare($sql1);
	 $rt->execute([$mt]);
	 $row1 = $rt->fetch(PDO::FETCH_ASSOC);
	 $eponm=$row1['eponimo']." ".$row1['onoma'];;
	 echo "<tr>";
	 echo "<td>" .$i;
	 echo "<td>". "<input type='text' name='mt[]' value='$mt' size=12>" . "</td>";
	  echo "<td>". "<input type='text' name='tm[]' value='$tm' size=12 >" . "</td>";
	 echo "<td>". "<input type='text' name='epo[]' value='$eponm' >" . "</td>";
	 ?>
     <td>
     <input type='checkbox' name='ok[]' value='$ok' checked /> 
     </td>
     
   <?php
     for ($j=1;$j<=$gym;$j++)
	 {
	   ?>
       <td>
       <input type='checkbox' name='p[]' value='$pr[$j]'   <?php if($pr[$j]==1) {echo 'checked';} else echo 'unchecked'; ?> /> 
       </td>
	   <?php
	 }
	 echo "</tr>";
	 $i++;
}
echo "</table>";
}

echo "<br>";

echo "O/Η Υπεύθυνος "."<br>"."<br>"."<br>";
echo "................................"."<br>";
echo $_SESSION['n']."<br>";
?>
<h4>ΕΓΚΡΙΣΗ ΑΠΟ ΔΙΕΥΘΥΝΣΗ: ..................................    Ημερομηνία:..................  </h4>
<br><br><br>
<button onClick="window.print()">ΕΚΤΥΠΩΣΗ ΟΘΟΝΗΣ</button>
<input type="button" name="epistrofi" value="Επιστροφή" onClick="self.close()">
</body>
</html>