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

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

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

        <div class="breadcrumbs">
            <div class="col-sm-6">
                <div class="page-header float-left">
                    <div class="page-title">
                        <h1><? echo "" . $_SESSION["userid"]; ?></h1>
                    </div>
                </div>
            </div>
            <div class="col-sm-6">
                <div class="page-header float-right">
                    <div class="page-title">
                        <ol class="breadcrumb text-right">
                            <li class="active"><? echo "" . $_SESSION["username"]; ?></li>
                        </ol>
                    </div>
                </div>
            </div>
        </div>

        <div class="content mt-3">

           


          
<div class="col-md-12">
                        <div class="card">
                            <div class="card-header">
                                <strong class="card-title">Print Result Sheet</strong>
                            </div>
                            <div class="card-body">
							<?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"];
$userid=$_SESSION["userid"];

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

$sql2 = "SELECT * FROM result where  term='$term' and sess1='$sess1' and class_name='$class_name' and month_name='$month_name' and user_id='$userid'";
$result2=$conn->query($sql2);
$row2 = $result2->fetch_assoc();
$sub1=$row2['sub1'] ;
$sub2=$row2['sub2'] ;
$sub3=$row2['sub3'] ;
$sub4=$row2['sub4'] ;
$sub5=$row2['sub5'] ;
$sub6=$row2['sub6'] ;
$sub7=$row2['sub7'] ;
$sub8=$row2['sub8'] ;
?>
                                <table id="bootstrap-data-table-export" class="table table-striped table-bordered">
                                    <thead>
									<?php
                                       echo "<tr>";
echo "<th colspan=4><center> $term  </center> </th>";
echo "<th colspan=4><center> $month_name  </center> </th>";
echo "<th colspan=4><center> $sess1 </center> </th>";
echo "<th colspan=4><center> $class_name</center> </th>";
echo "<th colspan=4><center> $cls_sec</center> </th>";
echo "</tr>";
echo "<tr>";
echo "<th > Adm# </th>";
echo "<th > Student Name </th>";
echo "<th > Father Name </th>";
echo "<th > $sub1</th>";
echo "<th > $sub2</th>";
echo "<th > $sub3</th>";
echo "<th > $sub4</th>";
echo "<th > $sub5</th>";
echo "<th > $sub6</th>";
echo "<th > $sub7</th>";
echo "<th > $sub8</th>";
echo "<th > Total Mark</th>";
echo "<th > Obt Mark</th>";
echo "<th > Per%</th>";
echo "<th > Status</th>";
echo "<th > Grade</th>";
echo "<th > Remarks</th>";
echo "</tr>";


echo "</tr>";
?>
                                    </thead>
									
                                    <tbody>
									<?php
                                       while($row = $result->fetch_assoc())
 
  {
  $id = $row['id'];	
   echo "<tr>";
echo "<td>" .$row['std_rollno'] . "</td>";
echo "<td>" .$row['std_name'] . "</td>";
echo "<td>" .$row['father_name'] . "</td>";
echo "<td>" .$row['omark1'] . "/" . $row['tmark1'] . "</td>";
echo "<td>" .$row['omark2'] . "/" . $row['tmark2'] . "</td>";
echo "<td>" .$row['omark3'] . "/" . $row['tmark3'] ."</td>";
echo "<td>" .$row['omark4'] . "/" . $row['tmark4'] ."</td>";
echo "<td>" .$row['omark5'] . "/" . $row['tmark5'] ."</td>";
echo "<td>" .$row['omark6'] . "/" . $row['tmark6'] . "</td>";
echo "<td>" .$row['omark7'] . "/" . $row['tmark7'] . "</td>";
echo "<td>" .$row['omark8'] . "/" . $row['tmark8'] . "</td>";
echo "<td>" .$row['totalmark'] . "</td>";
echo "<td>" .$row['obtmark'] . "</td>";
echo "<td>" .$row['per'] . "</td>";
echo "<td>" .$row['status'] . "</td>";
echo "<td>" .$row['grade'] . "</td>";
echo "<td>" .$row['remarks'] . "</td>";
		 
		  
	
  echo "</tr>";


  }
  ?>
                                       
                                    </tbody>
                                </table>
                            </div>
                        </div>
                    </div>
            


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

    <!-- Right Panel -->

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

</body>

</html>
<?php
}
?>