<?php
include "scrinit.php";
include "logo.php";
require "dbconnect.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:2px;font-size:12pt; }
<p style="font-size:14px;"></p>
</style>
</head>

<body>

<?php
$dt=$_SESSION['dt'];
$mitroo=$_GET['mit'];
$sql = "SELECT tmima,eponimo,onoma  FROM allstudentinfo WHERE mitroo='$mitroo'";
$result = mysqli_query($con,$sql);
$row = mysqli_fetch_array($result);
$tmima = $row['tmima'];
$nm=$row['eponimo']." ".$row['onoma'];
echo" ".  $nm. " , ( ".$tmima." )"."<br>";
$sql = mysqli_query($con,"SELECT dateout, period FROM apousies WHERE mitroo='$mitroo' AND apousia=1  ORDER BY dateout,period " );
$row = mysqli_fetch_array($sql);
	
// Print out result
echo "<table class='myTable' >
<tr style='border:1px solid black' bgcolor='#d6ff73'  >
<th>Ημερομηνία</th>
<th>Περ1</th>
<th>Περ2</th>
<th>Περ3</th>
<th>Περ4</th>
<th>Περ5</th>
<th>Περ6</th>
<th>Περ7</th>
</tr>";	
$ap=0;
$totap=array();
while(!empty($row)) {
      $per1=array();
	  $dt=$row['dateout'];
	  $ddisp= date('d-m-Y', strtotime($dt));
	  echo "<td>". $ddisp . "</td>"; 	 
	  while ($dt==$row['dateout'])
	  {
	     $per1[$row['period']]="?";
	     $ap++;
		 $totap[$row['period']]++;
	     $row = mysqli_fetch_array($sql);
	  }
    

     $i=1;    
     while($i<=7){
		 echo "<td>". "<b>".$per1[$i]. "</b>". "</td>";$i++;}
     echo "</tr>"; 
}
echo "<td>"." ΣΥΝΟΛΟ ". "</td>";
$i=1;    
     while($i<=7){
		 echo "<td>". $totap[$i] . "</td>";$i++;}
     echo "</tr>"; 
echo "</table>";	
echo "<br>"."<br>";
echo "ΣΥΝΟΛΟ ΜΗ ΧΑΡΑΚΤΗΡΙΣΜΕΝΩΝ ΑΠΟΥΣΙΩΝ : ".$ap;

 ?>


<br /><br />
<input type="button" name="epistrofi" value="Επιστροφή" onClick="self.close()"> 
</body>
</html>