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

else
{

?>
<HTML>
<HEAD>
<TITLE>MIND TECH SOLUTION</TITLE>
<link rel="stylesheet" type="text/css" href="ddlevelsfiles/ddlevelsmenu-base.css" />
<link rel="stylesheet" type="text/css" href="ddlevelsfiles/ddlevelsmenu-topbar.css" />
<link rel="stylesheet" type="text/css" href="ddlevelsfiles/ddlevelsmenu-sidebar.css" />
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js"></script>

<style type="text/css">
<!--
.style1 {font-weight: bold}
.style2 {color: #FFFFFF}
.style3 {font-size: 36px}
.style4 {
	font-family: Tahoma;
	font-size: 12px;
	font-weight: bold;
}
-->
</style>
<script type="text/javascript" src="ddlevelsfiles/ddlevelsmenu.js">

/***********************************************
* All Levels Navigational Menu- (c) Dynamic Drive DHTML code library (http://www.dynamicdrive.com)
* This notice MUST stay intact for legal use
* Visit Dynamic Drive at http://www.dynamicdrive.com/ for full source code
***********************************************/

</script>
</HEAD>
<BODY BGCOLOR=#FFFFFF LEFTMARGIN=0 TOPMARGIN=0 MARGINWIDTH=0 MARGINHEIGHT=0>
<!-- ImageReady Slices (home final.psd) -->
<TABLE WIDTH=1000 BORDER=0 CELLPADDING=0 CELLSPACING=0 align=center>
  <TR>
    <TD COLSPAN=3 bgcolor="#2365ED"><div align="center"><img src="logo copy.jpg" width="134" height="130"></div></TD>
    <TD COLSPAN=9 bgcolor="#2365ED"><table width="561" border="0" align="left">
	<tr>
        <td width="555" height="60" align="center" valign="middle"><p align="center" class="style28"><span class="style37 style3"><h1><font face="Palatino Linotype" color="#000000">DREAMLAND INTERNATIONAL SCHOOLS</font> </h1></span></p></td>
      </tr>
      <tr>
        <td width="555" height="123" align="center" valign="middle"><p align="center" class="style28"><span class="style37 style3"><strong><h1><font face="Palatino Linotype" color="#FFFFFF"><? echo "" . $_SESSION["userid"]; ?></font></h1></strong></span></p></td>
      </tr>
    </table></TD>
    <TD COLSPAN=2><a href="http://www.facebook.com"></a></TD>
    <TD bgcolor="#2365ED"><a href="signin.php">Signout</a><a href="http://www.twitter.com"></a></TD>
    <TD><a href="http://www.youtube.com"></a></TD>
  </TR>
  <TR>
    <TD COLSPAN=16 bgcolor="#2365ED"><div id="ddtopmenubar" class="mattblackmenu">
<?php include("includes/menu.php") ?></TD>
  </TR>
  <TR>
    <TD COLSPAN=16 align=center></TD>
  </TR>
  <TR>
    <TD COLSPAN=16 bgcolor="#2365ED">&nbsp;</TD>
  </TR>
  <TR>
    <TD height="26" COLSPAN=16 bgcolor="#000045"><p align="center" class="style36 style2"><strong> FINAL RESULT SHEET </strong></p></TD>
  </TR>

<?php
include 'dbc.php';


$userid=$_SESSION["userid"];
$today=date("d-m-Y");
$std_rollno=$_POST["std_rollno"];
$month_name1=$_POST["month_name1"];
$month_name2=$_POST["month_name2"];
$month_name3=$_POST["month_name3"];
$class_name=$_POST["class_name"];

$sql = "select * from 1st_term where std_rollno='$std_rollno' and class_name='$class_name' and month_name='$month_name1' and user_id='$userid'";
$std_ledger=mysql_query($sql) or die("Error : " . mysql_error());
$app=mysql_fetch_array($std_ledger);
   $std_name=$app["std_name"];
   $father_name=$app["father_name"];
    
   echo "<table border=1 width=78% align=center bgcolor=#FFFF66>";
   echo "<tr bgcolor=red>";
    echo "<th align=center colspan=5> First Term Exame</th>";
	echo "</tr>";
   echo "<tr>";
   echo "<th  align=left> Student Name </th>";
   echo "<td >"  .$std_name . "</td>" ;
   echo "<th  colspan=2 align=left> Student Roll No </th>";
   echo "<td >"  .$std_rollno . "</td>" ;
   echo "</tr>";
   echo "<tr>";   
   echo "<th align=left> Father Name </th>";
   echo "<td >"  .$father_name . "</td>" ;
echo "<th align=left colspan=2> Class Name </th>";
   echo "<td >"  .$class_name . "</td>" ;
    echo "</tr>";
	 echo "<tr>";
   
  
    echo "</tr>";
      
   echo "<tr>";
   echo "</tr>";
   echo "<tr>";
   echo "</tr>";
   echo "</table>";
    echo "<table border=1 width=78% align=center bgcolor=white>";
echo "<tr>";
echo "<th bgcolor=yellow width=40%> Subject Name </th>";
echo "<th bgcolor=yellow width=10%> Obtained Marks </th>";
echo "<th bgcolor=yellow width=10%> Total Marks </th>";
echo "<th bgcolor=yellow width=10%> Per % </th>";
echo "<th bgcolor=yellow width=10%> Status </th>";

echo "</tr>";
$sql4 = "select * from 1st_term where std_rollno='$std_rollno' and class_name='$class_name' and month_name='$month_name1' and user_id='$userid'";
$std_ledger4=mysql_query($sql4) or die("Error : " . mysql_error());
while($ppp=mysql_fetch_array($std_ledger4))
{   
   echo "<tr>";
   
   echo "<td width=40%>"  .$ppp["sub_name"] . "</td>" ; 
   echo "<td width=10%>"  .$ppp["obt_mark"] . "</td>" ;
    echo "<td width=10%>"  .$ppp["total_mark"] . "</td>" ;
	 echo "<td width=10%>"  .$ppp["percentage"] . "</td>" ;
	  echo "<td width=10%>"  .$ppp["status"] . "</td>" ;
	  
   echo "</tr>";
   
   $total_obt_mark=$total_obt_mark + $ppp["obt_mark"] ;
   $total_total_mark=$total_total_mark + $ppp["total_mark"] ;
   $total_per=$total_obt_mark / $total_total_mark * 100;
   if ($total_per >=33)
   {
   $status= "Pass";
   }
   else
   {
   $status= "Fail";
   }
   }
   
   echo "<tr>";
   echo "<th bgcolor=yellow width=40%> Total </th>";
   echo "<td  bgcolor=yellow width=10%>" ."<b>" .$total_obt_mark . "</td>" ;
   echo "<td  bgcolor=yellow width=10%>" ."<b>" .$total_total_mark . "</td>" ;
   echo "<td  bgcolor=yellow width=10%>" ."<b>" .$total_per . "</td>" ;
   echo "<td  bgcolor=yellow width=10%>" ."<b>" .$status . "</td>" ;
   echo "</tr>";
    echo "<tr>";
	echo "</tr>";
   echo "</table>";
  
   
   
      $sql1 = "select * from 1st_term where std_rollno='$std_rollno' and class_name='$class_name' and month_name='$month_name2' and user_id='$userid'";
$std_ledger1=mysql_query($sql1) or die("Error : " . mysql_error());
$app1=mysql_fetch_array($std_ledger1);
  
   echo "<table border=1 width=78% align=center bgcolor=white>";
   echo "<tr bgcolor=red>";
    echo "<th align=center colspan=5> Second Term Exame</th>";
	echo "</tr>";
echo "<tr>";
echo "<th bgcolor=yellow width=40%> Subject Name </th>";
echo "<th bgcolor=yellow width=10%> Obtained Marks </th>";
echo "<th bgcolor=yellow width=10%> Total Marks </th>";
echo "<th bgcolor=yellow width=10%> Per % </th>";
echo "<th bgcolor=yellow width=10%> Status </th>";

echo "</tr>";
$sql15 = "select * from 1st_term where std_rollno='$std_rollno' and class_name='$class_name' and month_name='$month_name2' and user_id='$userid'";
$std_ledger15=mysql_query($sql15) or die("Error : " . mysql_error());
while($ppp1=mysql_fetch_array($std_ledger15))
{
   
   echo "<tr>";
   
   echo "<td width=40%>"  .$ppp1["sub_name"] . "</td>" ; 
   echo "<td width=10%>"  .$ppp1["obt_mark"] . "</td>" ;
    echo "<td width=10%>"  .$ppp1["total_mark"] . "</td>" ;
	 echo "<td width=10%>"  .$ppp1["percentage"] . "</td>" ;
	  echo "<td width=10%>"  .$ppp1["status"] . "</td>" ;
   echo "</tr>";
   
   $total_obt_mark1=$total_obt_mark1 + $ppp1["obt_mark"] ;
   $total_total_mark1=$total_total_mark1 + $ppp1["total_mark"] ;
   $total_per1=$total_obt_mark1 / $total_total_mark1 * 100;
   if ($total_per1 >=33)
   {
   $status1= "Pass";
   }
   else
   {
   $status1= "Fail";
   }
   }
   echo "<tr>";
   echo "<th bgcolor=yellow width=40%> Total </th>";
   echo "<td  bgcolor=yellow width=10%>" ."<b>" .$total_obt_mark1 . "</td>" ;
   echo "<td  bgcolor=yellow width=10%>" ."<b>" .$total_total_mark1 . "</td>" ;
   echo "<td  bgcolor=yellow width=10%>" ."<b>" .$total_per1 . "</td>" ;
   echo "<td  bgcolor=yellow width=10%>" ."<b>" .$status1 . "</td>" ;
   echo "</tr>";
   echo "</table>";
   
      $sql2 = "select * from 1st_term where std_rollno='$std_rollno' and class_name='$class_name' and month_name='$month_name3' and user_id='$userid'";
$std_ledger2=mysql_query($sql2) or die("Error : " . mysql_error());
$app2=mysql_fetch_array($std_ledger2);
  
   echo "<table border=1 width=78% align=center bgcolor=white>";
   echo "<tr bgcolor=red>";
    echo "<th align=center colspan=5> Final Term Exame</th>";
	echo "</tr>";
echo "<tr>";
echo "<th bgcolor=yellow width=40%> Subject Name </th>";
echo "<th bgcolor=yellow width=10%> Obtained Marks </th>";
echo "<th bgcolor=yellow width=10%> Total Marks </th>";
echo "<th bgcolor=yellow width=10%> Per % </th>";
echo "<th bgcolor=yellow width=10%> Status </th>";

echo "</tr>";
 $sql26 = "select * from 1st_term where std_rollno='$std_rollno' and class_name='$class_name' and month_name='$month_name3' and user_id='$userid'";
$std_ledger26=mysql_query($sql26) or die("Error : " . mysql_error());
while($ppp2=mysql_fetch_array($std_ledger26))
{
   
   echo "<tr>";
   
   echo "<td width=40%>"  .$ppp2["sub_name"] . "</td>" ; 
   echo "<td width=10%>"  .$ppp2["obt_mark"] . "</td>" ;
    echo "<td width=10%>"  .$ppp2["total_mark"] . "</td>" ;
	 echo "<td width=10%>"  .$ppp2["percentage"] . "</td>" ;
	  echo "<td width=10%>"  .$ppp2["status"] . "</td>" ;
   echo "</tr>";
   
   $total_obt_mark2=$total_obt_mark2 + $ppp2["obt_mark"] ;
   $total_total_mark2=$total_total_mark2 + $ppp2["total_mark"] ;
   $total_per2=$total_obt_mark2 / $total_total_mark2 * 100;
   if ($total_per2 >=33)
   {
   $status2= "Pass";
   }
   else
   {
   $status2= "Fail";
   }
   }
   echo "<tr>";
   echo "<th bgcolor=yellow width=40%> Total </th>";
   echo "<td  bgcolor=yellow width=10%>" ."<b>" .$total_obt_mark2 . "</td>" ;
   echo "<td  bgcolor=yellow width=10%>" ."<b>" .$total_total_mark2 . "</td>" ;
   echo "<td  bgcolor=yellow width=10%>" ."<b>" .$total_per2 . "</td>" ;
   echo "<td  bgcolor=yellow width=10%>" ."<b>" .$status2 . "</td>" ;
   echo "</tr>";
   
   $total_obt_mark3 = $total_obt_mark2 + $total_obt_mark1 + $total_obt_mark ;
 
   $total_total_mark3=$total_total_mark2 + $total_total_mark1 + $total_total_mark ;
   $total_per3=$total_obt_mark3 / $total_total_mark3 * 100;
   if ($total_per3 >=33)
   {
   $status3= "Pass";
   }
   else
   {
   $status3= "Fail";
   }
   echo "<tr>";
   echo "<th width=40%> Total Terms </th>";
   echo "<td   width=10%>" ."<b>" .$total_obt_mark3 . "</td>" ;
   echo "<td  width=10%>" ."<b>" .$total_total_mark3 . "</td>" ;
   echo "<td   width=10%>" ."<b>" .$total_per3 . "</td>" ;
   echo "<td   width=10%>" ."<b>" .$status3 . "</td>" ;
   echo "</tr>";
   echo "</table>";
  
?>
<table width="78%" align="center" bgcolor="#010044">
<tr>
  <td height="46" colspan="2" bgcolor="#010044">&nbsp;</td>
  <td width="580" rowspan="2" bgcolor="#010044">&nbsp;</td>
</tr>
      <tr>
        <td height="52" bgcolor="#010044">&nbsp;</td>
        <td bgcolor="#010044">&nbsp;</td>
      </tr>
    </table>
</body>
</html>
<?php
}
?>