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

$userid=$_SESSION["userid"];

?>
<!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">
                            <div class="card-header">
                              <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>Consolidated Student Test Report</center></strong>
								  <strong class="card-title"><center><? echo $class_name .":" . $cls_sec; ?></center></strong>
								   <strong class="card-title"><center><? echo $sess1; ?></center></strong>
                            </div>
                            <div class="card-body">
							<?php

include 'dbc.php';





$sql = "SELECT * FROM mtest where sess1='$sess1' and std_rollno='$std_rollno' and user_id='$userid' order by std_rollno";
$result=$conn->query($sql);
$sql2 = "SELECT * FROM addsubject where class_name='$class_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'] ;
$sub9=$row2['sub9'] ;
$sub10=$row2['sub10'] ;

?>
                                <table id="bootstrap-data-table-export" class="table table-striped table-bordered">
                                    <thead>
									<?php
								
                                       echo "<tr>";
echo "<th colspan=5 bgcolor=#0099FF><center> $std_rollno </center> </th>";
echo "<th colspan=6  bgcolor=#0099FF><center> $std_name</center> </th>";
echo "<th colspan=7 bgcolor=#0099FF><center> $father_name</center> </th>";
echo "</tr>";
echo "<tr>";
echo "<th bgcolor=#000066><font face=arial size=3 color=white> Test Date </font></th>";
echo "<th bgcolor=#000066><font face=arial size=3 color=white> Term Name </font></th>";
echo "<th bgcolor=#000066><font face=arial size=3 color=white> $sub1</font></th>";
echo "<th bgcolor=#000066><font face=arial size=3 color=white> $sub2</font></th>";
echo "<th bgcolor=#000066><font face=arial size=3 color=white> $sub3</font></th>";
echo "<th bgcolor=#000066><font face=arial size=3 color=white> $sub4</font></th>";
echo "<th bgcolor=#000066><font face=arial size=3 color=white> $sub5</font></th>";
echo "<th bgcolor=#000066><font face=arial size=3 color=white> $sub6</font></th>";
echo "<th bgcolor=#000066><font face=arial size=3 color=white> $sub7</font></th>";
echo "<th bgcolor=#000066><font face=arial size=3 color=white> $sub8</font></th>";
echo "<th bgcolor=#000066><font face=arial size=3 color=white> $sub9</font></th>";
echo "<th bgcolor=#000066><font face=arial size=3 color=white> $sub10</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>";


echo "</tr>";
?>
                                    </thead>
									
                                    <tbody>
									<?php
                                       while($row = $result->fetch_assoc())
 
  {
  $id = $row['id'];	
  $productname[]  = $row['term']  ;
  
            $sales[] = $row['per'];
   echo "<tr>";
    echo "<td>" .$row['date'] . "</td>";
   echo "<td>" .$row['term'] . "</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['omark9'] . "/" . $row['tmark9'] . "</td>";
echo "<td>" .$row['omark10'] . "/" . $row['tmark10'] . "</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>";

 
 

  }
 

         $sql11 ="SELECT * FROM mtest where sess1='$sess1' and std_rollno='$std_rollno'";
        $result11=$conn->query($sql11);
         $chart_data="";
     while($row11 = $result11->fetch_assoc())
 { 
 
          
			$std_name = $row11['std_name'];
       
 }
 

  ?>
		
		


   <div style="width:60%;hieght:20%;text-align:center">
            <h2 class="page-header" >Analytics Reports </h2>
            <div><?php
    echo $std_name;
   
?> </div>
            <canvas  id="chartjs_bar"></canvas> 
        </div>
		
		<script src="//code.jquery.com/jquery-1.9.1.js"></script>
  <script src="//cdnjs.cloudflare.com/ajax/libs/Chart.js/2.4.0/Chart.min.js"></script>
<script type="text/javascript">
      var ctx = document.getElementById("chartjs_bar").getContext('2d');
                var myChart = new Chart(ctx, {
                    type: 'bar',
                    data: {
                        labels:<?php echo json_encode($productname); ?>,
                        datasets: [{
                            backgroundColor: [
                               "#5969ff",
                                "#ff407b",
                                "#25d5f2",
                                "#ffc750",
                                "#2ec551",
                                "#7040fa",
                                "#ff004e"
                            ],
                            data:<?php echo json_encode($sales); ?>,
                        }]
                    },
                    options: {
                           legend: {
                        display: true,
                        position: 'bottom',
 
                        labels: {
                            fontColor: '#71748d',
                            fontFamily: 'Circular Std Book',
                            fontSize: 14,
                        }
                    },
 
 
                }
                });
    </script>


                                       
                                    </tbody>
                                </table>
                            </div>
                        </div>
                    </div>
            


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

    <!-- Right Panel -->

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

</body>

</html>
<?php
}
?>