<?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';
$username=$_SESSION["username"];
$current_file_name = basename($_SERVER['PHP_SELF']);
$sql = "SELECT * FROM adduser where feedisc2 = '$current_file_name' and uname = '$username'";
$result=$conn->query($sql);
$row = $result->fetch_assoc();
$status=$row['feedisc3'] ;

if ($status =="")
{
echo "You are not Authorized This Page <a href='maindashboard.php'>Back </a> ";
}
else
{
include 'dbc.php';
$class_name=$_REQUEST["cname"];
$userid=$_SESSION["userid"];
$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;
		 
		
?>
<!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> Attendance Daily Report</strong><small> Form</small></div>
                            <div class="card-body card-block">
							<form action="Attendance_Report_Daily.php" method="post" enctype="multipart/form-data" class="form-group">
							
							<div class="row form-group">
                                                                    <div class="col col-md-3"><label for="select" class=" form-control-label">Attndance Status</label></div>
                                                                    <div class="col-12 col-md-4">
                                                                        <select name="status" id="status" class="form-control">
                                                                           
                                                                            <option value="P">P</option>
                                                                            <option value="L">L</option>
																			<option value="H">H</option>
																			<option value="A">A</option>
                                                                           
                                                                        </select>
                                                                    </div>
                                                                </div>
																
												<div class="col-3">
                                <div class="form-group"><label for="feedisc1" class=" form-control-label">Class Name</label><input type="text" id="class_name" name="class_name" placeholder="Class Name" class="form-control" value="<? echo $class_name ?>"></div>
								</div>
												
																
							<div class="col-3">
                                <div class="form-group"><label for="feedisc1" class=" form-control-label">Attendance Month</label><input type="text" id="month_name" name="month_name" placeholder="Attendance Month" class="form-control" value="<? echo $my ?>" ></div>
								</div>
								
								
								
								<div class="col-3">
                                <div class="form-group"><label for="feedisc1" class=" form-control-label">To Date </label><input type="text" id="tdate" name="tdate" placeholder="To Date" class="form-control" value="<? echo $today ?>" ></div>
								</div>
								
								<div class="col-3">
                                <div class="form-group"><label for="feedisc1" class=" form-control-label"> From Date</label><input type="text" id="fdate" name="fdate" placeholder="From Date" class="form-control" value="<? echo $today ?>"></div>
								</div>
								
								
								
								
								
								
								
								
								
									
										
				
													
                                                    </div>
													<div class="card-footer">
                                                        <button type="submit" class="btn btn-primary btn-sm">
                                                            <i class="fa fa-dot-circle-o"></i> Report Preview
                                                        </button>
														 <button type="submit" class="btn btn-primary btn-sm">
                                                            <i class="fa fa-dot-circle-o"></i><a href="Genrate_Attendance_Reports.php"> Back</a>
                                                        </button>
														
                                                       
                                                    </div>
													
													</form>
                                                </div>
                                            </div>
<div class="col-md-14">
                        <div class="card">
                            <div class="card-header">
                                <strong class="card-title"> Student Attendance Report</strong>
                            </div>
                            <div class="card-body">
							<?php

include 'dbc.php';


$userid=$_SESSION["userid"];
$status=$_REQUEST["status"];
$month_name=$_REQUEST["month_name"];
$class_name=$_REQUEST["class_name"];
$fdate=$_REQUEST["fdate"];
$tdate=$_REQUEST["tdate"];
$sql11 = "SELECT * FROM attendence where class_name='$class_name' and month_name='$month_name' and status='$status' and date between '$fdate' and '$tdate' and user_id='$userid' order by cls_sec";
$result11=$conn->query($sql11);
?>
                                <table id="bootstrap-data-table-export" class="table table-striped table-bordered">
                                    <thead>
									<?php
                                       echo "<tr>";
echo "<th > Date </th>";
echo "<th > Time </th>";
echo "<th > Portal No </th>";
echo "<th > Student Roll No </th>";
echo "<th > Student Name </th>";
echo "<th > Father Name </th>";
echo "<th > Class Name </th>";
echo "<th > Cell No </th>";
echo "<th > Attendance Status </th>";


echo "</tr>";
?>
                                    </thead>
									
                                    <tbody>
									<?php
                                       while($ppp = $result11->fetch_assoc())
 
  {
  echo "<tr>";
    echo "<td >"  .$ppp["date"] . "</td>" ;
	 echo "<td >"  .$ppp["ttime"] . "</td>" ;
   echo "<td >"  .$ppp["portal_id"] . "</td>" ;
   
   echo "<td >"  .$ppp["rollno"] . "</td>" ;
   echo "<td >"  .$ppp["stdname"] . "</td>" ;
   echo "<td >"  .$ppp["fname"] . "</td>" ;
    echo "<td >"  .$ppp["class_name"] . "</td>" ;
    echo "<td >"  .$ppp["cell"] . "</td>" ;
	   
   echo "<td >"  .$ppp["status"] . "</td>" ;
 
	 
   

   echo "</tr>";
    $cnt=$cnt + 1;
   }
   echo "<tr>";
 echo "<th  colspan=8>" ."Toatl Student    :     " .$cnt . "</th>";
 echo "</tr>";
 
   echo "</table>";


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


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

    <!-- Right Panel -->

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

</body>

</html>
<?php
}
}
?>