<?php
session_start();
if($_SESSION["username"]=="")
{
 	echo "You are not Logged in Please <a href='index.html'>Sign in </a> First ";
}
else
{


?>
<!doctype html>
<!--[if lt IE 7]>      <html class="no-js lt-ie9 lt-ie8 lt-ie7" lang=""> <![endif]-->
<!--[if IE 7]>         <html class="no-js lt-ie9 lt-ie8" lang=""> <![endif]-->
<!--[if IE 8]>         <html class="no-js lt-ie9" lang=""> <![endif]-->
<!--[if gt IE 8]><!-->
<html class="no-js" lang="en">
<!--<![endif]-->

<head>
   <?php include("includes/header.php") ?>
</head>

<body>


    <!-- Left Panel -->

   <!-- /#left-panel -->

    <!-- Left Panel -->

    <!-- Right Panel -->

    <div id="right-panel" class="right-panel">

        <!-- Header-->
        <header id="header" class="header">

          

        </header><!-- /header -->
        <!-- Header-->

        

        <div class="content mt-3">

           


          
<div class="col-md-12">
                        <div class="card">
                          
<strong class="card-title"> <center> <img src="logo1.jpg" align="middle" /></center></strong>
                                <strong class="card-title"> <center> <h1><? echo "" . $_SESSION["userid"]; ?></h1></center></strong>
								 <strong class="card-title"><center>Class Result Sheet</center></strong>
								  
                            </div>
                            <div class="card-body">
							<?php

include 'dbc.php';

$term=$_POST["term"];
$asses=$_POST["asses"];
$month_name=$_POST["month_name"];
$sess1=$_POST["sess1"];
$class_name=$_POST["class_name"];
$cls_sec=$_POST["cls_sec"];
$userid=$_SESSION["userid"];

$sql2 = "SELECT * FROM adclass where  user_id='$userid'";
$result2=$conn->query($sql2);
while($row2 = $result2->fetch_assoc())
 
  {
  
  $cname=$row2['cname'] ;
  $sql1 = "SELECT * FROM term where  user_id='$userid'";
$result1=$conn->query($sql1);
while($row1 = $result1->fetch_assoc())
 
  {
  $tname=$row1['tname'] ;
  $sql = "SELECT * FROM result where  term='$term' and asses='$asses' and sess1='$sess1' and class_name='$cname' and user_id='$userid'";
  $result=$conn->query($sql);
while($row = $result->fetch_assoc())
{
?>
                                <table id="bootstrap-data-table-export" class="table table-striped table-bordered">
                                    <thead>
									<?php
                                       echo "<tr>";
echo "<th colspan=4 bgcolor=#00FF00><center> $term  </center> </th>";
echo "<th colspan=4 bgcolor=#33FFFF><center> $month_name  </center> </th>";
echo "<th colspan=4 bgcolor=#FFFF66><center> $sess1 </center> </th>";
echo "<th colspan=4 bgcolor=#FF9966><center> $class_name</center> </th>";
echo "<th colspan=4 bgcolor=#FF66FF><center> $cls_sec</center> </th>";
echo "</tr>";
echo "<tr>";

echo "<th bgcolor=#000066><font face=arial size=3 color=white> Total Mark</font></th>";
echo "<th bgcolor=#000066><font face=arial size=3 color=white> Obt Mark</font></th>";
echo "<th bgcolor=#000066><font face=arial size=3 color=white> Per%</font></th>";
echo "<th bgcolor=#000066><font face=arial size=3 color=white> Status</font></th>";
echo "<th bgcolor=#000066><font face=arial size=3 color=white> Grade</font></th>";
echo "<th bgcolor=#000066><font face=arial size=3 color=white> Remarks</font></th>";
echo "</tr>";


echo "</tr>";
?>
                                    </thead>
									
                                    <tbody>
									<?php
                                      
  $id = $row['id'];	
  
$tomark1=$tomark1 + $row['omark1'];
$ttmark1=$ttmark1 + $row['tmark1'];
$tomark2=$tomark2 + $row['omark2'];
$ttmark2=$ttmark2 + $row['tmark2'];
$tomark3=$tomark3 + $row['omark3'];
$ttmark3=$ttmark3 + $row['tmark3'];

$tomark4=$tomark4 + $row['omark4'];
$ttmark4=$ttmark4 + $row['tmark4'];
$tomark5=$tomark5 + $row['omark5'];
$ttmark5=$ttmark5 + $row['tmark5'];
$tomark6=$tomark6 + $row['omark6'];
$ttmark6=$ttmark6 + $row['tmark6'];
$tomark7=$tomark7 + $row['omark7'];
$ttmark7=$ttmark7 + $row['tmark7'];
$tomark8=$tomark8 + $row['omark8'];
$ttmark8=$ttmark8 + $row['tmark8'];
$tomark9=$tomark9 + $row['omark9'];
$ttmark9=$ttmark9 + $row['tmark9'];
$tomark10=$tomark10 + $row['omark10'];
$ttmark10=$ttmark10 + $row['tmark10'];
$tobtmark=$tobtmark + $row['obtmark'];
$ttotalmark=$ttotalmark + $row['totalmark'];
$trecord=$trecord + 1;
 
  
		
  ?>
                                       
                                    </tbody>
                                </table>
								 <?php 
}
$per = $tobtmark / $ttotalmark * 100;
if ($per >= 90)
{
$grd="A+";
$remk="Exceptional, Exceeds expectations with the quality of his /her work & Keep it up.";
}
elseif ($per >= 80)
{
$grd="A";
$remk="Excellent, Admirable progress in all academic area";
}
elseif ($per >= 70)
{
$grd="B+";
$remk="Very Good, Making Steady Progress Academically";
}
elseif ($per >= 60)
{
$grd="B";
$remk="Good,  Needs to pay attention for the quality of work";
}
elseif ($per >= 50)
{
$grd="C+";
$remk="Fair,Needs to increase skills in all written work & reading";
}
elseif ($per >= 40)
{
$grd="C";
$remk="Undertaking,Needs to demonstrate improvement in academic work ";
}
elseif ($per >= 33)
{
$grd="D";
$remk="Result is Unsatisfactory & the student is required to work hard";
}

else
{
$grd="E";
$remk="Fail";
}

  $per1 = $tomark1 / $ttmark1 * 100;
if ($per1 >= 90)
{
$grd1="A+";
$remk1="Exceptional, Exceeds expectations with the quality of his /her work & Keep it up.";
}
elseif ($per1 >= 80)
{
$grd1="A";
$remk1="Excellent, Admirable progress in all academic area";
}
elseif ($per1 >= 70)
{
$grd1="B+";
$remk1="Very Good, Making Steady Progress Academically";
}
elseif ($per1 >= 60)
{
$grd1="B";
$remk1="Good,  Needs to pay attention for the quality of work";
}
elseif ($per1 >= 50)
{
$grd1="C+";
$remk1="Fair,Needs to increase skills in all written work & reading";
}
elseif ($per1 >= 40)
{
$grd1="C";
$remk1="Undertaking,Needs to demonstrate improvement in academic work ";
}
elseif ($per1 >= 33)
{
$grd1="D";
$remk1="Result is Unsatisfactory & the student is required to work hard";
}

else
{
$grd1="E";
$remk1="Fail";
}

$per2 = $tomark2 / $ttmark2 * 100;
if ($per2 >= 90)
{
$grd2="A+";
$remk2="Exceptional, Exceeds expectations with the quality of his /her work & Keep it up.";
}
elseif ($per2 >= 80)
{
$grd2="A";
$remk2="Excellent, Admirable progress in all academic area";
}
elseif ($per2 >= 70)
{
$grd2="B+";
$remk2="Very Good, Making Steady Progress Academically";
}
elseif ($per2 >= 60)
{
$grd2="B";
$remk2="Good,  Needs to pay attention for the quality of work";
}
elseif ($per2 >= 50)
{
$grd2="C+";
$remk2="Fair,Needs to increase skills in all written work & reading";
}
elseif ($per2 >= 40)
{
$grd2="C";
$remk2="Undertaking,Needs to demonstrate improvement in academic work ";
}
elseif ($per2 >= 33)
{
$grd2="D";
$remk2="Result is Unsatisfactory & the student is required to work hard";
}

else
{
$grd2="E";
$remk2="Fail";
}

$per3 = $tomark3 / $ttmark3 * 100;
if ($per3 >= 90)
{
$grd3="A+";
$remk3="Exceptional, Exceeds expectations with the quality of his /her work & Keep it up.";
}
elseif ($per3 >= 80)
{
$grd3="A";
$remk3="Excellent, Admirable progress in all academic area";
}
elseif ($per3 >= 70)
{
$grd3="B+";
$remk3="Very Good, Making Steady Progress Academically";
}
elseif ($per3 >= 60)
{
$grd3="B";
$remk3="Good,  Needs to pay attention for the quality of work";
}
elseif ($per3 >= 50)
{
$grd3="C+";
$remk3="Fair,Needs to increase skills in all written work & reading";
}
elseif ($per3 >= 40)
{
$grd3="C";
$remk3="Undertaking,Needs to demonstrate improvement in academic work ";
}
elseif ($per3 >= 33)
{
$grd3="D";
$remk3="Result is Unsatisfactory & the student is required to work hard";
}

else
{
$grd3="E";
$remk3="Fail";
}


$per4 = $tomark4 / $ttmark4 * 100;
if ($per4 >= 90)
{
$grd4="A+";
$remk4="Exceptional, Exceeds expectations with the quality of his /her work & Keep it up.";
}
elseif ($per4 >= 80)
{
$grd4="A";
$remk4="Excellent, Admirable progress in all academic area";
}
elseif ($per4 >= 70)
{
$grd4="B+";
$remk4="Very Good, Making Steady Progress Academically";
}
elseif ($per4 >= 60)
{
$grd4="B";
$remk4="Good,  Needs to pay attention for the quality of work";
}
elseif ($per4 >= 50)
{
$grd4="C+";
$remk4="Fair,Needs to increase skills in all written work & reading";
}
elseif ($per4 >= 40)
{
$grd4="C";
$remk4="Undertaking,Needs to demonstrate improvement in academic work ";
}
elseif ($per4 >= 33)
{
$grd4="D";
$remk4="Result is Unsatisfactory & the student is required to work hard";
}

else
{
$grd4="E";
$remk4="Fail";
}


$per5 = $tomark5 / $ttmark5 * 100;
if ($per5 >= 90)
{
$grd5="A+";
$remk5="Exceptional, Exceeds expectations with the quality of his /her work & Keep it up.";
}
elseif ($per5 >= 80)
{
$grd5="A";
$remk5="Excellent, Admirable progress in all academic area";
}
elseif ($per5 >= 70)
{
$grd5="B+";
$remk5="Very Good, Making Steady Progress Academically";
}
elseif ($per5 >= 60)
{
$grd5="B";
$remk5="Good,  Needs to pay attention for the quality of work";
}
elseif ($per5 >= 50)
{
$grd5="C+";
$remk5="Fair,Needs to increase skills in all written work & reading";
}
elseif ($per5 >= 40)
{
$grd5="C";
$remk5="Undertaking,Needs to demonstrate improvement in academic work ";
}
elseif ($per5 >= 33)
{
$grd5="D";
$remk5="Result is Unsatisfactory & the student is required to work hard";
}

else
{
$grd5="E";
$remk5="Fail";
}


$per6 = $tomark6 / $ttmark6 * 100;
if ($per6 >= 90)
{
$grd3="A+";
$remk6="Exceptional, Exceeds expectations with the quality of his /her work & Keep it up.";
}
elseif ($per6 >= 80)
{
$grd6="A";
$remk6="Excellent, Admirable progress in all academic area";
}
elseif ($per6 >= 70)
{
$grd6="B+";
$remk6="Very Good, Making Steady Progress Academically";
}
elseif ($per6 >= 60)
{
$grd6="B";
$remk6="Good,  Needs to pay attention for the quality of work";
}
elseif ($per6 >= 50)
{
$grd6="C+";
$remk6="Fair,Needs to increase skills in all written work & reading";
}
elseif ($per6 >= 40)
{
$grd6="C";
$remk6="Undertaking,Needs to demonstrate improvement in academic work ";
}
elseif ($per6 >= 33)
{
$grd6="D";
$remk6="Result is Unsatisfactory & the student is required to work hard";
}

else
{
$grd6="E";
$remk6="Fail";
}


$per7 = $tomark7 / $ttmark7 * 100;
if ($per7 >= 90)
{
$grd7="A+";
$remk7="Exceptional, Exceeds expectations with the quality of his /her work & Keep it up.";
}
elseif ($per7 >= 80)
{
$grd7="A";
$remk7="Excellent, Admirable progress in all academic area";
}
elseif ($per7 >= 70)
{
$grd7="B+";
$remk7="Very Good, Making Steady Progress Academically";
}
elseif ($per7 >= 60)
{
$grd7="B";
$remk7="Good,  Needs to pay attention for the quality of work";
}
elseif ($per7 >= 50)
{
$grd7="C+";
$remk7="Fair,Needs to increase skills in all written work & reading";
}
elseif ($per7 >= 40)
{
$grd7="C";
$remk7="Undertaking,Needs to demonstrate improvement in academic work ";
}
elseif ($per7 >= 33)
{
$grd7="D";
$remk7="Result is Unsatisfactory & the student is required to work hard";
}

else
{
$grd7="E";
$remk7="Fail";
}


$per8 = $tomark8 / $ttmark8 * 100;
if ($per8 >= 90)
{
$grd8="A+";
$remk8="Exceptional, Exceeds expectations with the quality of his /her work & Keep it up.";
}
elseif ($per8 >= 80)
{
$grd8="A";
$remk8="Excellent, Admirable progress in all academic area";
}
elseif ($per8 >= 70)
{
$grd8="B+";
$remk8="Very Good, Making Steady Progress Academically";
}
elseif ($per8 >= 60)
{
$grd8="B";
$remk8="Good,  Needs to pay attention for the quality of work";
}
elseif ($per8 >= 50)
{
$grd8="C+";
$remk8="Fair,Needs to increase skills in all written work & reading";
}
elseif ($per8 >= 40)
{
$grd8="C";
$remk8="Undertaking,Needs to demonstrate improvement in academic work ";
}
elseif ($per8 >= 33)
{
$grd8="D";
$remk8="Result is Unsatisfactory & the student is required to work hard";
}

else
{
$grd8="E";
$remk8="Fail";
}


$per9 = $tomark9 / $ttmark9 * 100;
if ($per9 >= 90)
{
$grd9="A+";
$remk9="Exceptional, Exceeds expectations with the quality of his /her work & Keep it up.";
}
elseif ($per9 >= 80)
{
$grd9="A";
$remk9="Excellent, Admirable progress in all academic area";
}
elseif ($per9 >= 70)
{
$grd9="B+";
$remk9="Very Good, Making Steady Progress Academically";
}
elseif ($per9 >= 60)
{
$grd9="B";
$remk9="Good,  Needs to pay attention for the quality of work";
}
elseif ($per9 >= 50)
{
$grd9="C+";
$remk9="Fair,Needs to increase skills in all written work & reading";
}
elseif ($per9 >= 40)
{
$grd9="C";
$remk9="Undertaking,Needs to demonstrate improvement in academic work ";
}
elseif ($per9 >= 33)
{
$grd9="D";
$remk9="Result is Unsatisfactory & the student is required to work hard";
}

else
{
$grd9="E";
$remk9="Fail";
}

 $per10 = $tomark10 / $ttmark10 * 100;
if ($per10 >= 90)
{
$grd10="A+";
$remk10="Exceptional, Exceeds expectations with the quality of his /her work & Keep it up.";
}
elseif ($per10 >= 80)
{
$grd10="A";
$remk10="Excellent, Admirable progress in all academic area";
}
elseif ($per10 >= 70)
{
$grd10="B+";
$remk10="Very Good, Making Steady Progress Academically";
}
elseif ($per10 >= 60)
{
$grd10="B";
$remk10="Good,  Needs to pay attention for the quality of work";
}
elseif ($per10 >= 50)
{
$grd10="C+";
$remk10="Fair,Needs to increase skills in all written work & reading";
}
elseif ($per10 >= 40)
{
$grd10="C";
$remk10="Undertaking,Needs to demonstrate improvement in academic work ";
}
elseif ($per10 >= 33)
{
$grd10="D";
$remk10="Result is Unsatisfactory & the student is required to work hard";
}

else
{
$grd10="E";
$remk10="Fail";
}

	 
	   echo "<tr>";
	echo "<td colspan=3 align=right bgcolor=#000066><font face=arial size=3 color=white><b>" ."Total Records::". $trecord ."</b></font></td>";
		echo "<td bgcolor=#000066><font face=arial size=3 color=white><b>" .$tomark1 . "/" . $ttmark1 . "</b></font></td>";
		echo "<td bgcolor=#000066><font face=arial size=3 color=white><b>" .$tomark2 . "/" . $ttmark2 . "</b></font></td>";
		echo "<td bgcolor=#000066><font face=arial size=3 color=white><b>" .$tomark3 . "/" . $ttmark3 . "</b></font></td>";
		echo "<td bgcolor=#000066><font face=arial size=3 color=white><b>" .$tomark4 . "/" . $ttmark4 . "</b></font></td>";
		echo "<td bgcolor=#000066><font face=arial size=3 color=white><b>" .$tomark5 . "/" . $ttmark5 . "</b></font></td>";
		echo "<td bgcolor=#000066><font face=arial size=3 color=white><b>" .$tomark6 . "/" . $ttmark6 . "</b></font></td>";
		echo "<td bgcolor=#000066><font face=arial size=3 color=white><b>" .$tomark7 . "/" . $ttmark7 . "</b></font></td>";
		echo "<td bgcolor=#000066><font face=arial size=3 color=white><b>" .$tomark8 . "/" . $ttmark8 . "</b></font></td>";
		echo "<td bgcolor=#000066><font face=arial size=3 color=white><b>" .$ttotalmark  . "</b></font></td>";
		echo "<td bgcolor=#000066><font face=arial size=3 color=white><b>" .$tobtmark  . "</b></font></td>";
		echo "<td bgcolor=#000066><font face=arial size=3 color=white><b>" .$per  . "</b></font></td>";
		echo "<td bgcolor=#000066><font face=arial size=3 color=white></font></td>";
		echo "<td bgcolor=#000066><font face=arial size=3 color=white><b>" .$grd  . "</b></font></td>";
		echo "<td bgcolor=#000066><font face=arial size=3 color=white><b>" .$remk  . "</b></font></td>";
		echo "</tr>";
		echo "<tr>";
	echo "<td colspan=3 align=right bgcolor=#33FFFF><b>" ."Perentage" ."</b></td>";
		echo "<td bgcolor=#33FFFF><b>" .round($per1,2) . "</b></td>";
		echo "<td bgcolor=#33FFFF><b>" .round($per2,2) . "</b></td>";
		echo "<td bgcolor=#33FFFF><b>" .round($per3,2) . "</b></td>";
		echo "<td bgcolor=#33FFFF><b>" .round($per4,2) . "</b></td>";
		echo "<td bgcolor=#33FFFF><b>" .round($per5,2) . "</b></td>";
		echo "<td bgcolor=#33FFFF><b>" .round($per6,2) . "</b></td>";
		echo "<td bgcolor=#33FFFF><b>" .round($per7,2) . "</b></td>";
		echo "<td bgcolor=#33FFFF><b>" .round($per8,2) . "</b></td>";
		echo "<td bgcolor=#33FFFF></td>";
		echo "<td bgcolor=#33FFFF></td>";
		echo "<td bgcolor=#33FFFF></td>";
		echo "<td bgcolor=#33FFFF></td>";
		echo "<td bgcolor=#33FFFF></td>";
		echo "<td bgcolor=#33FFFF></td>";
		echo "</tr>";
		echo "<tr>";
	echo "<td colspan=3 align=right bgcolor=#FFFF66><b>" ."Grade" ."</b></td>";
		echo "<td bgcolor=#FFFF66><b>" .$grd1 . "</b></td>";
		echo "<td bgcolor=#FFFF66><b>" .$grd2 . "</b></td>";
		echo "<td bgcolor=#FFFF66><b>" .$grd3 . "</b></td>";
		echo "<td bgcolor=#FFFF66><b>" .$grd4 . "</b></td>";
		echo "<td bgcolor=#FFFF66><b>" .$grd5 . "</b></td>";
		echo "<td bgcolor=#FFFF66><b>" .$grd6 . "</b></td>";
		echo "<td bgcolor=#FFFF66><b>" .$grd7 . "</b></td>";
		echo "<td bgcolor=#FFFF66><b>" .$grd8 . "</b></td>";
		echo "<td bgcolor=#FFFF66></td>";
		echo "<td bgcolor=#FFFF66></td>";
		echo "<td bgcolor=#FFFF66></td>";
		echo "<td bgcolor=#FFFF66></td>";
		echo "<td bgcolor=#FFFF66></td>";
		echo "<td bgcolor=#FFFF66></td>";
		echo "</tr>";
  }
  
  }



?>
                            </div>
                        </div>
                    </div>
            


        </div> <!-- .content -->
    </div><!-- /#right-panel -->

    <!-- Right Panel -->

   <?php include("includes/footermenu.php") ?>

</body>

</html>
<?php
}
?>