<?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';
$rollno=$_REQUEST["rollno"];
$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 -->

    <!-- /#left-panel -->

    <!-- Left Panel -->

    <!-- Right Panel -->

    <div id="right-panel" class="right-panel">

        <!-- Header-->
        <header id="header" class="header">

            

        </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>Open Attendance For Absent</strong><small> Form</small></div>
                            <div class="card-body card-block">
							<form action="Attendance_Report_Date.php" method="post" enctype="multipart/form-data" class="form-group">
							
							
																
												<div class="col-3">
        <div class="form-group"><label for="feedisc1" class=" form-control-label">Class Rollno</label><input type="text" id="rollno" name="rollno" placeholder="Rollno" class="form-control" value="<? echo $rollno ?>"></div>
								</div>
								
												
																
							
								
								
								
								<div class="col-3">
                                <div class="form-group"><label for="feedisc1" class=" form-control-label">From Date </label><input type="date" id="fdate" name="fdate" placeholder="Session" class="form-control" value="<? echo $today ?>" ></div>
								</div>
								
								<div class="col-3">
                                <div class="form-group"><label for="feedisc1" class=" form-control-label">To Date</label><input type="date" id="tdate" name="tdate" placeholder=" 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> Open Attednace
                                                        </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"];
$sql3p = "select * from attendence where rollno='$rollno' and status='P' and user_id='$userid'";
  $result3p=$conn->query($sql3p);

while($row3p = $result3p->fetch_assoc())
  {
 $p=$p +1;
   
  } 
  $sql3l = "select * from attendence where rollno='$rollno' and status='L' and user_id='$userid'";
   $result3l=$conn->query($sql3l);

while($row3l = $result3l->fetch_assoc())
  {
 $l=$l +1;
   
  } 
  $sql3a = "select * from attendence where rollno='$rollno' and status='A' and user_id='$userid'";
  $result3a=$conn->query($sql3a);

while($row3a = $result3a->fetch_assoc())
  {
 $a=$a +1;
   
  } 
   $sql3late = "select * from attendence where rollno='$rollno' and status='H' and user_id='$userid'";
  $result3late=$conn->query($sql3late);

while($row3late = $result3late->fetch_assoc())
  {
 $h=$h +1;
   
  } 

$sql11 = "SELECT * FROM attendence where rollno='$rollno' and user_id='$userid' order by id desc";
$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 > 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["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 Days    :     " .$cnt . "</th>";
 echo "</tr>";
   echo "<tr>";
 echo "<th  colspan=8>" ."Toatl Present    :     " .$p . "</th>";
 echo "</tr>";
  echo "<tr>";
 echo "<th  colspan=8>" ."Toatl Absent    :     " .$a . "</th>";
 echo "</tr>";
  echo "<tr>";
 echo "<th  colspan=8>" ."Toatl Leave    :     " .$l . "</th>";
 echo "</tr>";
  echo "<tr>";
 echo "<th  colspan=8>" ."Toatl Holiday    :     " .$h . "</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
}

?>