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

   
							<?php

include 'dbc.php';

$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"];
$sql1 = "SELECT * FROM resultnote where user_id='$userid'";
$result1=$conn->query($sql1);
$row1 = $result1->fetch_assoc();
$notice=$row1['notice'] ;


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


  {
  $std_rollno=$row['std_rollno'] ;
$father_name=$row['father_name'] ;
$std_name=$row['std_name'] ;
$sub7=$row['sub7'] ;
$a=0;
$p=0;
$l=0;
$sqla = "SELECT * FROM attendence where rollno='$std_rollno' and date between '$fdate' and '$tdate' and status='A' and user_id='$userid'";
$resulta=$conn->query($sqla);
while($rowa = $resulta->fetch_assoc())	 
{
$a=$a + 1;
}
$sqlp = "SELECT * FROM attendence where rollno='$std_rollno' and date between '$fdate' and '$tdate' and status='P' and user_id='$userid'";
$resultp=$conn->query($sqlp);
while($rowp = $resultp->fetch_assoc())	 
{
$p=$p + 1;
}
$sqll = "SELECT * FROM attendence where rollno='$std_rollno' and date between '$fdate' and '$tdate' and status='L' and user_id='$userid'";
$resultl=$conn->query($sqll);
while($rowl = $resultl->fetch_assoc())	 
{
$l=$l + 1;
}
   ?>
                                <table id="bootstrap-data-table-export" 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>
                                    <thead>
									<?php
 echo "<tr>";
echo "<th colspan=2 bgcolor=#0099FF>$term </th>";
echo "<th colspan=2 bgcolor=#0099FF>$asses </th>";
echo "<th colspan=2 bgcolor=#0099FF>$month_name </th>";
echo "<th colspan=2 bgcolor=#0099FF>$sess1 </th>";

echo "</tr>";
echo "<tr>";
echo "<th colspan=2 bgcolor=#0099FF>$std_rollno </th>";
echo "<th colspan=2 bgcolor=#0099FF>$std_name </th>";
echo "<th colspan=2 bgcolor=#0099FF>$father_name </th>";
echo "<th colspan=2 bgcolor=#0099FF>$class_name: $cls_sec</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>" . $row['sub1'] . "</th>";
   echo "<th colspan=2 align=center><center>" .$row['tmark1'] . "</th>";

echo "<th colspan=2 align=center><center>" .$row['omark1'] . "</th>";
echo "<th colspan=2 align=center><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>";
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=4>Attendacne Record </th>";
echo "<th>" ."Present:" . $pp . "</th>";
echo "<th>" ."Absent:" . $aa . "</th>";
echo "<th>" ."Leave:" . $ll . "</th>";

echo "</tr>";
 
 echo "<tr>";
echo "<th colspan=8  align=left bgcolor=#FFFFFF><font face=arial size=3>$notice<font></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>";
  }
  ?>
                                       
                                    </tbody>
                                </table>
                          

    <!-- Right Panel -->

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

</body>

</html>
<?php
}
?>