<?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>
  
</head>

<body>


    <!-- Left Panel -->

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

    <!-- Left Panel -->

    <!-- Right Panel -->

   
							<?php

include 'dbc.php';
include 'table.css';

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

$sql3 = "SELECT * FROM admission where class_name='$class_name' and user_id='$userid' order by adm_no";
$result3=$conn->query($sql3);
while($row3 = $result3->fetch_assoc())
 
  {
$std_rollno=$row3['adm_no'] ;
$father_name=$row3['fname'] ;
$std_name=$row3['std_name'] ;

 
$sql = "SELECT * FROM result where std_rollno='$std_rollno' and term='Ist Term' and asses='No Assessment' and sess1='$sess1' and class_name='$class_name'  and user_id='$userid' order by std_rollno";
$result=$conn->query($sql);
while($row = $result->fetch_assoc())


  {
  
$sub7=$row['sub7'] ;
				
 echo "<table border=1 width=100%>";
 ?>
                               
								<div class="card-header">
								<div class="page-title">
								 <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>
                    </div>
                                <strong class="card-title"> <center>Student Result Card</center></strong>
                            </div>
                                   
									<?php
echo "<tr>";
 echo "<td colspan=6 bgcolor=#0099FF><font face=arial size=4 color=black>$std_name </td>";
  echo "<td colspan=2 rowspan=2 bgcolor=#0099FF align=center><font face=arial size=4 color=black>$class_name:$cls_sec </td>";
	
echo "</tr>";
echo "<tr>";
	echo "<td colspan=6 bgcolor=#0099FF><font face=arial size=4 color=black>$father_name </td>";
	
echo "</tr>";



 echo "<tr>";
   echo "<th colspan=8 align=center bgcolor=#000066><center><font face=arial size=3 color=white>Ist Term Examination</font></center> </th>";
   
echo "</tr>";
echo "<tr>";
   echo "<th colspan=8 align=center bgcolor=#000066><center><font face=arial size=3 color=white>Marks Details</font></center> </th>";
   
echo "</tr>";
echo "<tr>";
echo "<th colspan=2 bgcolor=#FFFF66>Subjects Name </th>";
echo "<th colspan=2 bgcolor=#FFFF66 align=center><center>Total Mark </center></th>";

echo "<th colspan=2 bgcolor=#FFFF66 align=center><center>Obtained Mark</center> </th>";
echo "<th colspan=2 bgcolor=#FFFF66 align=center><center> Per%</center></th>";
echo "</tr>";
 if ($row['sub1'] <> "")
{
   echo "<tr>";
   echo "<th colspan=2 width=40%>" . $row['sub1'] . "</th>";
   echo "<th colspan=2 align=center width=20%><center>" .$row['tmark1'] . "</th>";

echo "<th colspan=2 align=center width=20%><center>" .$row['omark1'] . "</th>";
echo "<th colspan=2 align=center width=20%><center>" .round($row['per1'],0) . "%" ."</th>";
echo "</tr>";
}
 if ($row['sub2'] <> "")
{
  echo "<tr>";
   echo "<th colspan=2>" . $row['sub2'] . "</th>";
   echo "<th colspan=2 align=center><center>" .$row['tmark2'] . "</th>";

echo "<th colspan=2 align=center><center>" .$row['omark2'] . "</th>";
echo "<th colspan=2 align=center><center>" .round($row['per2'],0) . "%" ."</th>";
echo "</tr>";
}
if ($row['sub3'] <> "")
{
echo "<tr>";
   echo "<th colspan=2>" . $row['sub3'] . "</th>";
   echo "<th colspan=2 align=center><center>" .$row['tmark3'] . "</th>";

	echo "<th colspan=2 align=center><center>" .$row['omark3'] . "</th>";
	echo "<th colspan=2 align=center><center>" .round($row['per3'],0) . "%" ."</th>";
echo "</tr>";
}
if ($row['sub4'] <> "")
{
echo "<tr>";
   echo "<th colspan=2>" . $row['sub4'] . "</th>";
   echo "<th colspan=2 align=center><center>" .$row['tmark4'] . "</th>";

echo "<th colspan=2 align=center><center>" .$row['omark4'] . "</th>";
echo "<th colspan=2 align=center><center>" .round($row['per4'],0) . "%" ."</th>";
echo "</tr>";
}
if ($row['sub5'] <> "")
{
echo "<tr>";
    echo "<th colspan=2>" . $row['sub5'] . "</th>";
	echo "<th colspan=2 align=center><center>" .$row['tmark5'] . "</th>";

echo "<th colspan=2 align=center><center>" .$row['omark5'] . "</th>";
echo "<th colspan=2 align=center><center>" .round($row['per5'],0) . "%" ."</th>";
echo "</tr>";
}
if ($row['sub6'] <> "")
{
echo "<tr>";
    echo "<th colspan=2>" . $row['sub6'] . "</th>";
	echo "<th colspan=2 align=center><center>" .$row['tmark6'] . "</th>";

echo "<th colspan=2 align=center><center>" .$row['omark6'] . "</th>";
echo "<th colspan=2 align=center><center>" .round($row['per6'],0) . "%" ."</th>";
echo "</tr>";
}
if ($row['sub7'] <> "")
{
echo "<tr>";
   echo "<th colspan=2>" . $row['sub7'] . "</th>";
   echo "<th colspan=2 align=center><center>" .$row['tmark7'] . "</th>";

echo "<th colspan=2 align=center><center>" .$row['omark7'] . "</th>";
echo "<th colspan=2 align=center><center>" .round($row['per7'],0) . "%" ."</th>";
echo "</tr>";
}
if ($row['sub8'] <> "")
{
echo "<tr>";
    echo "<th colspan=2>" . $row['sub8'] . "</th>";
	echo "<th colspan=2 align=center><center>" .$row['tmark8'] . "</th>";

echo "<th colspan=2 align=center><center>" .$row['omark8'] . "</th>";
echo "<th colspan=2 align=center><center>" .round($row['per8'],0) ."%" . "</th>";
echo "</tr>";
}
if ($row['sub9'] <> "")
{
echo "<tr>";
    echo "<th colspan=2>" . $row['sub9'] . "</th>";
	echo "<th colspan=2 align=center><center>" .$row['tmark9'] . "</th>";

echo "<th colspan=2 align=center><center>" .$row['omark9'] . "</th>";
echo "<th colspan=2 align=center><center>" .round($row['per9'],0) ."%" . "</th>";
echo "</tr>";
}
if ($row['sub10'] <> "")
{
echo "<tr>";
    echo "<th colspan=2>" . $row['sub10'] . "</th>";
	echo "<th colspan=2 align=center><center>" .$row['tmark10'] . "</th>";

echo "<th colspan=2 align=center><center>" .$row['omark10'] . "</th>";
echo "<th colspan=2 align=center><center>" .round($row['per10'],0) ."%" . "</th>";
echo "</tr>";
}
echo "<tr>";
 echo "<th colspan=2 bgcolor=#FFFF66>Total </th>";
 echo "<th bgcolor=#FFFF66 colspan=2 align=center><font face=arial size=4><center>" .$row['totalmark'] . "</font></th>";

echo "<th bgcolor=#FFFF66 colspan=2 align=center><font face=arial size=4><center>" .$row['obtmark'] . "</font></th>";
echo "<th bgcolor=#FFFF66 colspan=2 align=center><font face=arial size=4><center>" .round($row['per'],0) . "%" ."</font></th>";
echo "</tr>";
echo "<tr>";
 echo "<th colspan=4 bgcolor=#FFFF66> Result Status</th>";
echo "<th bgcolor=#FFFF66 colspan=2 align=center><font face=arial size=4><center>" .$row['status'] . "</font></th>";
echo "<th bgcolor=#FFFF66 colspan=2 align=center><font face=arial size=4><center>" .$row['grade'] . "</font></th>";

echo "</tr>";
echo "<tr>";

		 echo "<th colspan=8 bgcolor=#000066 align=center><font face=arial size=3 color=white><center>" .$row['remarks'] . "</font></th>";
		  
	
  echo "</tr>";
   }
   $sql1 = "SELECT * FROM result where asses='Ist Assessment' and sess1='$sess1' and std_rollno='$std_rollno' and class_name='$class_name' and user_id='$userid' order by std_rollno";
$result1=$conn->query($sql1);

								
                                       
echo "<tr>";
echo "<th bgcolor=#000066><font face=arial size=3 color=white>  Assessment </font></th>";

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>";


                                       while($row1 = $result1->fetch_assoc())
 
  {
  
   echo "<tr>";
   echo "<td align=center>" .$row1['asses'] . "</td>";
	echo "<td align=center>" .$row1['totalmark'] . "</td>";
		echo "<td align=center>" .$row1['obtmark'] . "</td>";
	echo "<td align=center>" .$row1['per'] . "</td>";
	echo "<td align=center>" .$row1['status'] . "</td>";
	echo "<td align=center>" .$row1['grade'] . "</td>";
	echo "<td align=center>" .$row1['remarks'] . "</td>";
  echo "</tr>";

  }
    
	
	$sql2 = "SELECT * FROM result where asses='2nd Assessment' and sess1='$sess1' and std_rollno='$std_rollno' and class_name='$class_name' and user_id='$userid' order by std_rollno";
$result2=$conn->query($sql2);

								
                                   


                                       while($row2 = $result2->fetch_assoc())
 
  {
  
   echo "<tr>";
   echo "<td align=center>" .$row2['asses'] . "</td>";
	echo "<td align=center>" .$row2['totalmark'] . "</td>";
		echo "<td align=center>" .$row2['obtmark'] . "</td>";
	echo "<td align=center>" .$row2['per'] . "</td>";
	echo "<td align=center>" .$row2['status'] . "</td>";
	echo "<td align=center>" .$row2['grade'] . "</td>";
	echo "<td align=center>" .$row2['remarks'] . "</td>";
  echo "</tr>";

  }
       
	   $sqlt2 = "SELECT * FROM result where  term='2nd Term' and asses='No Assessment' and std_rollno='$std_rollno' and sess1='$sess1' and class_name='$class_name'  and user_id='$userid' order by std_rollno";
$resultt2=$conn->query($sqlt2);
while($rowt2 = $resultt2->fetch_assoc())


  {
  
$sub7t2=$rowt2['sub7'] ;
 


 echo "<tr>";
   echo "<th colspan=8 align=center bgcolor=#000066><center><font face=arial size=3 color=white>2nd Term Examination</font></center> </th>";
   
echo "</tr>";
echo "<tr>";
   echo "<th colspan=8 align=center bgcolor=#000066><center><font face=arial size=3 color=white>Marks Details</font></center> </th>";
   
echo "</tr>";
echo "<tr>";
echo "<th colspan=2 bgcolor=#FFFF66>Subjects Name </th>";
echo "<th colspan=2 bgcolor=#FFFF66 align=center><center>Total Mark </center></th>";

echo "<th colspan=2 bgcolor=#FFFF66 align=center><center>Obtained Mark</center> </th>";
echo "<th colspan=2 bgcolor=#FFFF66 align=center><center> Per%</center></th>";
echo "</tr>";
 if ($rowt2['sub1'] <> "")
{
   echo "<tr>";
   echo "<th colspan=2>" . $rowt2['sub1'] . "</th>";
   echo "<th colspan=2 align=center><center>" .$rowt2['tmark1'] . "</th>";

echo "<th colspan=2 align=center><center>" .$rowt2['omark1'] . "</th>";
echo "<th colspan=2 align=center><center>" .round($rowt2['per1'],0) . "%" ."</th>";
echo "</tr>";
}
 if ($rowt2['sub2'] <> "")
{
  echo "<tr>";
   echo "<th colspan=2>" . $rowt2['sub2'] . "</th>";
   echo "<th colspan=2 align=center><center>" .$rowt2['tmark2'] . "</th>";

echo "<th colspan=2 align=center><center>" .$rowt2['omark2'] . "</th>";
echo "<th colspan=2 align=center><center>" .round($rowt2['per2'],0) . "%" ."</th>";
echo "</tr>";
}
if ($rowt2['sub3'] <> "")
{
echo "<tr>";
   echo "<th colspan=2>" . $rowt2['sub3'] . "</th>";
   echo "<th colspan=2 align=center><center>" .$rowt2['tmark3'] . "</th>";

echo "<th colspan=2 align=center><center>" .$rowt2['omark3'] . "</th>";
echo "<th colspan=2 align=center><center>" .round($rowt2['per3'],0) . "%" ."</th>";
echo "</tr>";
}
if ($rowt2['sub4'] <> "")
{
echo "<tr>";
   echo "<th colspan=2>" . $rowt2['sub4'] . "</th>";
   echo "<th colspan=2 align=center><center>" .$rowt2['tmark4'] . "</th>";

echo "<th colspan=2 align=center><center>" .$rowt2['omark4'] . "</th>";
echo "<th colspan=2 align=center><center>" .round($rowt2['per4'],0) . "%" ."</th>";
echo "</tr>";
}
if ($rowt2['sub5'] <> "")
{
echo "<tr>";
    echo "<th colspan=2>" . $rowt2['sub5'] . "</th>";
	echo "<th colspan=2 align=center><center>" .$rowt2['tmark5'] . "</th>";

echo "<th colspan=2 align=center><center>" .$rowt2['omark5'] . "</th>";
echo "<th colspan=2 align=center><center>" .round($rowt2['per5'],0) . "%" ."</th>";
echo "</tr>";
}
if ($rowt2['sub6'] <> "")
{
echo "<tr>";
    echo "<th colspan=2>" . $rowt2['sub6'] . "</th>";
	echo "<th colspan=2 align=center><center>" .$rowt2['tmark6'] . "</th>";

echo "<th colspan=2 align=center><center>" .$rowt2['omark6'] . "</th>";
echo "<th colspan=2 align=center><center>" .round($rowt2['per6'],0) . "%" ."</th>";
echo "</tr>";
}
if ($rowt2['sub7'] <> "")
{
echo "<tr>";
   echo "<th colspan=2>" . $rowt2['sub7'] . "</th>";
   echo "<th colspan=2 align=center><center>" .$rowt2['tmark7'] . "</th>";

echo "<th colspan=2 align=center><center>" .$rowt2['omark7'] . "</th>";
echo "<th colspan=2 align=center><center>" .round($rowt2['per7'],0) . "%" ."</th>";
echo "</tr>";
}
if ($rowt2['sub8'] <> "")
{
echo "<tr>";
    echo "<th colspan=2>" . $rowt2['sub8'] . "</th>";
	echo "<th colspan=2 align=center><center>" .$rowt2['tmark8'] . "</th>";

echo "<th colspan=2 align=center><center>" .$rowt2['omark8'] . "</th>";
echo "<th colspan=2 align=center><center>" .round($rowt2['per8'],0) ."%" . "</th>";
echo "</tr>";
}
if ($rowt2['sub9'] <> "")
{
echo "<tr>";
    echo "<th colspan=2>" . $rowt2['sub9'] . "</th>";
	echo "<th colspan=2 align=center><center>" .$rowt2['tmark9'] . "</th>";

echo "<th colspan=2 align=center><center>" .$rowt2['omark9'] . "</th>";
echo "<th colspan=2 align=center><center>" .round($rowt2['per9'],0) ."%" . "</th>";
echo "</tr>";
}
if ($rowt2['sub10'] <> "")
{
echo "<tr>";
    echo "<th colspan=2>" . $rowt2['sub10'] . "</th>";
	echo "<th colspan=2 align=center><center>" .$rowt2['tmark10'] . "</th>";

echo "<th colspan=2 align=center><center>" .$rowt2['omark10'] . "</th>";
echo "<th colspan=2 align=center><center>" .round($rowt2['per10'],0) ."%" . "</th>";
echo "</tr>";
}
echo "<tr>";
 echo "<th colspan=2 bgcolor=#FFFF66>Total </th>";
 echo "<th bgcolor=#FFFF66 colspan=2 align=center><font face=arial size=4><center>" .$rowt2['totalmark'] . "</font></th>";

echo "<th bgcolor=#FFFF66 colspan=2 align=center><font face=arial size=4><center>" .$rowt2['obtmark'] . "</font></th>";
echo "<th bgcolor=#FFFF66 colspan=2 align=center><font face=arial size=4><center>" .round($rowt2['per'],0) . "%" ."</font></th>";
echo "</tr>";
echo "<tr>";
 echo "<th colspan=4 bgcolor=#FFFF66> Result Status</th>";
echo "<th bgcolor=#FFFF66 colspan=2 align=center><font face=arial size=4><center>" .$rowt2['status'] . "</font></th>";
echo "<th bgcolor=#FFFF66 colspan=2 align=center><font face=arial size=4><center>" .$rowt2['grade'] . "</font></th>";

echo "</tr>";
echo "<tr>";

		 echo "<th colspan=8 bgcolor=#000066 align=center><font face=arial size=3 color=white><center>" .$rowt2['remarks'] . "</font></th>";
		  
	
  echo "</tr>";
  } 
  $sql1t3 = "SELECT * FROM result where  asses='3rd Assessment' and sess1='$sess1' and std_rollno='$std_rollno' and class_name='$class_name' and user_id='$userid' order by std_rollno";
$result1t3=$conn->query($sql1t3);

								
                                       
echo "<tr>";
echo "<th bgcolor=#000066><font face=arial size=3 color=white>  Assessment </font></th>";

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>";


                                       while($row1t3 = $result1t3->fetch_assoc())
 
  {
  
   echo "<tr>";
   echo "<td align=center>" .$row1t3['asses'] . "</td>";
	echo "<td align=center>" .$row1t3['totalmark'] . "</td>";
		echo "<td align=center>" .$row1t3['obtmark'] . "</td>";
	echo "<td align=center>" .$row1t3['per'] . "</td>";
	echo "<td align=center>" .$row1t3['status'] . "</td>";
	echo "<td align=center>" .$row1t3['grade'] . "</td>";
	echo "<td align=center>" .$row1t3['remarks'] . "</td>";
  echo "</tr>";

  }
 $sql2t4 = "SELECT * FROM result where  asses='4th Assessment' and sess1='$sess1' and std_rollno='$std_rollno' and class_name='$class_name'  and user_id='$userid' order by std_rollno";
$result2t4=$conn->query($sql2t4);

								
                                       



                                       while($row2t4 = $result2t4->fetch_assoc())
 
  {
  
   echo "<tr>";
   echo "<td align=center>" .$row2t4['asses'] . "</td>";
	echo "<td align=center>" .$row2t4['totalmark'] . "</td>";
		echo "<td align=center>" .$row2t4['obtmark'] . "</td>";
	echo "<td align=center>" .$row2t4['per'] . "</td>";
	echo "<td align=center>" .$row2t4['status'] . "</td>";
	echo "<td align=center>" .$row2t4['grade'] . "</td>";
	echo "<td align=center>" .$row2t4['remarks'] . "</td>";
  echo "</tr>";

  }
 


  echo "<tr>";
 echo "<th colspan=3 bgcolor=#0099FF>Effort for improvement  </th>";
echo "<th bgcolor=#0099FF>Excellent  </th>";
echo "<th bgcolor=#0099FF>very Good </th>";
echo "<th bgcolor=#0099FF>Fair  </th>";
echo "<th bgcolor=#0099FF>Needs Attention 	  </th>";

echo "</tr>";
echo "<tr>";
 echo "<th colspan=3>Class behaviour 	  </th>";
echo "<th >  </th>";
echo "<th ></th>";
echo "<th >  </th>";
echo "<th >  </th>";

echo "</tr>";
echo "<tr>";
 echo "<th colspan=3>Home Assignment 	 	  </th>";
echo "<th >  </th>";
echo "<th ></th>";
echo "<th >  </th>";
echo "<th >  </th>";

echo "</tr>";
echo "<tr>";
 echo "<th colspan=3>Maintenance of uniform	 	  </th>";
echo "<th >  </th>";
echo "<th ></th>";
echo "<th >  </th>";
echo "<th >  </th>";

echo "</tr>";
echo "<tr>";
 echo "<th colspan=3>Attendance	 	  </th>";
echo "<th >  </th>";
echo "<th ></th>";
echo "<th >  </th>";
echo "<th >  </th>";

echo "</tr>";
echo "<tr>";
 echo "<th colspan=3>Remarks	 	  </th>";
echo "<th colspan=5>  </th>";


echo "</tr>";

 
 
 echo "<tr>";
 
echo "<th colspan=8  align=left bgcolor=#000066><br><br> <font face=arial size=3 color=white>Teacher Signature______________ &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Controller Examination______________ </th>";
echo "</tr>";

                          

  
        
		
		 }
		 
		 
		 
		 
		  
  echo "</table>";
  
 
  
 
  
  
  
  
  
  
  
  
  
  
  
  
  
  
 
  ?>
                                 
    <!-- Right Panel -->
</body>

</html>
<?php
}
?>