<?php
include "scrinit.php";
include "logo.php";
?>

<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<script type="text/javascript" src="http://code.jquery.com/jquery-1.9.1.min.js"></script>
<script type="text/javascript">

function popupCenter(pageURL, title, w, h) {
    var left = (screen.width / 2)  - (w / 2);
    var top  = (screen.height / 2) - (h / 2);
    var targetWin = window.open(pageURL, title, 'toolbar=no, location=no, directories=no, status=no, menubar=no, scrollbars=yes, resizable=no, copyhistory=no, width=900, height=300, top='+top+', left='+left);
}
</script>
<style type="text/css">
input.right{  text-align:right;  }
table.myTable { border-collapse:collapse; }
table.myTable td, table.myTable th { border:1px solid black;padding:2px;font-size:10pt; }
</style>
</head>

<body>

<h3> ΠΡΟΓΡΑΜΜΑΤΙΣΜΟΣ  ΜΑΘΗΜΑΤΟΣ </h3>
<?php
require "dbconnect.php"; 
$dt=$_SESSION['dt'];
$tetramino=$_SESSION['tetramino'];
$gym=$_SESSION['gym'];
	$math=$_GET['mathid'];
	$arr = explode("/", $math);
    $tmima = trim($arr[0]);
	$math = trim($arr[1]);
	$pmp=trim($arr[2]);
	$q=mysqli_query($con,"select mathima from kodikoimathimatos where kodikos='$math'");
	$rowq=mysqli_fetch_array($q);
	$mat=$rowq['mathima'];
	///////
	echo "ΜΑΘΗΜΑ:".$mat;
$q = mysqli_query($con,"select id FROM bathmoposo where tetramino='$tetramino' and tmima='$tmima' and mathima='$math' ");	
$row2=mysqli_fetch_array($q);
$code=$row2['id'];
$result1 = mysqli_query($con,"SELECT  * FROM bathmostetr where code='$code' ");

echo "<table class='myTable' >
<tr style='border:1px solid black' bgcolor='#d6ff73'  >
<th>α/α</th>
<th>Α.Μ</th>
<th>Τμήμα</th>
<th>Όνοματεπώνυμο</th>
<th>Γραπτή</th>
<th>Προφορ</th>
<th>Τελικός</th>
</tr>";
$i=0;$p1=40;$p2=60;
while ($row1=mysqli_fetch_array($result1))
{
	$i++;
	$mitroo=$row1['mitroo'];
	$result = mysqli_query($con,"SELECT eponimo,onoma,tmima FROM allstudentinfo WHERE mitroo='$mitroo' ORDER BY eponimo,onoma  ");
	$row = mysqli_fetch_array($result);
	$epo=$row['eponimo']." ".$row['onoma'];
	$tmimax=$row['tmima'];
	$bg=$row1['bgrapto'];
	$bp=$row1['bproforiko'];
	echo "<tr>";
    echo "<td>".$i;
    echo "<td>".$mitroo."</td>";
    echo "<td>". $tmimax . "</td>";
    echo "<td>". $epo. "</td>";
    echo "<td align='right'>".$bg."</td>";
	echo "<td align='right'>".$bp."</td>";
    $t=$bg*$p1/100+$bp*$p2/100;
    $tel=round($t);
    echo "<td align='right'><b>".$tel."</b></td>";
	echo "</tr>";
}    

echo "</table>";

?>
<br><br>
<button onClick="window.print()">	Εκτύπωση Σελίδας</button>
<input type="button" name="epistrofi" value="Επιστροφή" onClick="self.close()"> 
</body>
</html>