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

include 'dbc.php';
date_default_timezone_set("Asia/Karachi");
$today=date("Y-m-d");
$month = date("m",strtotime($today));
		$year = date("Y",strtotime($today));
		 $month_name = date("F", mktime(0, 0, 0, $month, 10));
		 $my=$month_name . " " . $year;
$userid=$_SESSION["userid"];
$id=$_REQUEST["id"];
$sql = "SELECT * FROM addsubject where id = '$id' and user_id='$userid'";
$result=$conn->query($sql);
$row = $result->fetch_assoc();
$class_name=$row['class_name'] ;
$sql3="Select * from term where user_id='$userid'";
$result1 = $conn->query($sql3);
$sql31="Select * from term_exam1 where user_id='$userid'";
$result1 = $conn->query($sql31);
?>
<!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 -->

    <?php include("includes/menu.php") ?><!-- /#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-lg-12">
                        <div class="card">
                            <div class="card-header"><strong>Print Result Card</strong><small> Report</small></div>
                            <div class="card-body card-block">
							<form action="Print_Result_Card_Save_Ind.php" method="post" enctype="multipart/form-data" class="form-group">
							           
                                                                    
                                                              
							
								<div class="col-3">
                                <div class="form-group"><label for="cname" class=" form-control-label">Attendance From Date</label><input type="date" id="fdate" name="fdate" class="form-control" value="<? echo $today ?>"></div>
								</div>
								<div class="col-3">
                                <div class="form-group"><label for="cname" class=" form-control-label">Attendance To Date</label><input type="date" id="tdate" name="tdate" class="form-control" value="<? echo $today ?>"></div>
								</div>
								<div class="col-3">
                                <div class="form-group"><label for="cname" class=" form-control-label">  No</label><input type="text" id="id" name="id" class="form-control" value="<? echo $id ?>"></div>
								</div>
								
							
									
									
								
				
													
                                                    </div>
													<div class="card-footer">
                                                        <button type="submit" class="btn btn-primary btn-sm">
                                                            <i class="fa fa-dot-circle-o"></i> Open Result Sheet
                                                        </button>
                                                        
                                                    </div>
													
													</form>
                                                </div>
                                            </div>

            <div class="content mt-3">
            <div class="animated fadeIn">
                <div class="row">

                    <div class="col-md-14">
                        <div class="card">
                            <div class="card-header">
                                <strong class="card-title">Result Card Print</strong>
                            </div>
                            <div class="card-body">
							<?php

include 'dbc.php';


$userid=$_SESSION["userid"];
$cname=$_REQUEST["cname"];
$sql = "SELECT * FROM result where  sess1='$year' and class_name='$class_name' and month_name='$my' and user_id='$userid' order by class_name,std_rollno";
$result=$conn->query($sql);
?>
                                <table id="bootstrap-data-table-export" class="table table-striped table-bordered">
                                    <thead>
									<?php
                                       echo "<tr>";
echo "<th >  No </th>";
echo "<th > Roll No </th>";
echo "<th > Studnet Name </th>";
echo "<th > Father Name </th>";
echo "<th > Class Name </th>";
echo "<th > Sec </th>";
echo "<th > Assessment </th>";
echo "<th > Month</th>";
echo "<th > Session</th>";


echo "</tr>";
?>
                                    </thead>
									
                                    <tbody>
									<?php
                                       while($row = $result->fetch_assoc())
 
  {
  $id = $row['id'];	
   echo "<tr>";

echo "<td>" .$row['id'] . "</td>";
 echo "<td>" .$row['std_rollno'] . "</td>";
  echo "<td>" .$row['std_name'] .  "</td>";
 echo "<td>" .$row['fname'] . "</td>";
 echo "<td>" .$row['class_name'] .  "</td>";
 echo "<td>" .$row['cls_sec'] .  "</td>";
 echo "<td>" .$row['term'] .  "</td>";
 echo "<td>" .$row['month_name'] .  "</td>";
 echo "<td>" .$row['sess1'] .  "</td>";
 


		 ?>
		 
		  
		 <?php
		  echo"<th> <a href ='Print_Ind_Result_Card.php?id=$id'>"?><button type="button" class="btn btn-primary">  Print Result Card </button><?php "</a>";
		   
		   
		 
		  
	
  echo "</tr>";


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


                </div>
            </div><!-- .animated -->
        </div>


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

    <!-- Right Panel -->

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

</body>

</html>
<?php
}
?>