<?php 
session_start(); 

							
							
include 'dbc.php';
$userid=$_SESSION["userid"];

$fromdate=$_POST["fromdate"];
$todate=$_POST["todate"];
$class_name=$_POST["class_name"];
$camp=$_POST["camp"];
$mnth=date("m");

$month_num =$mnth; 
  $month_name = date("F", mktime(0, 0, 0, $month_num, 10)); 
$yr=date("Y");
$my=$month_name . $yr;

$result = mysql_query("SELECT * FROM admission WHERE class_name  = '$class_name' and user_id='$userid' order by std_rollno");
//$test = mysql_fetch_array($result);
while($test=mysql_fetch_array($result))
{

  
 
   

				$std_name=$test['std_name'] ;
				$std_rollno=$test['std_rollno'] ;
				$father_name=$test['father_name'] ;
				$camp=$test['allied_code'] ;
				
				
				 echo "<h1 align=center>$userid </h1>";
				  echo "<h2 align=center>Student Attendance Progress Report</h2>";
echo "<table border=1 width=100% align=center bgcolor=#FFCC33>";
echo "<tr>";
echo "<th> Student Name </th>";
echo "<td> $std_name </td>";
echo "<th> Student Roll # </th>";
echo "<td> $std_rollno </td>";
echo "<th> Class Name </th>";
echo "<td> $class_name </td>";

echo "</tr>";
echo "<tr>";
echo "<th> Father Name </th>";
echo "<td> $father_name </td>";
echo "<th> Portal No </th>";
echo "<td> $camp </td>";
echo "<th> Month </th>";
echo "<td> $my </td>";

echo "</tr>";
echo "<tr>";
echo "<th colspan=6 align=center bgcolor=#FFFFFF> Attendance Detail</th>";
echo "</tr>";
echo "</table>";
 

echo "<table border=1 width=100%>";

echo "<tr>";

echo "<th bgcolor=yellow> Date </th>";
echo "<th bgcolor=yellow> Time </th>";
echo "<th bgcolor=#00FF00> Status </th>";
echo "</tr>";
$p=0;
$l=0;
$a=0;
 $sql3p = "select * from atten where std_rollno='$std_rollno' and class_name='$class_name' and obt_mark='P'  and date between '$fromdate' and '$todate' and user_id='$userid'";
   $std_ledger13p=mysql_query($sql3p) or die("Error : " . mysql_error());

while($row3p = mysql_fetch_array($std_ledger13p))
  {
 $p=$p +1;
   
  } 
  $sql3l = "select * from atten where std_rollno='$std_rollno' and class_name='$class_name' and obt_mark='L'  and date between '$fromdate' and '$todate' and user_id='$userid'";
   $std_ledger13l=mysql_query($sql3l) or die("Error : " . mysql_error());

while($row3l = mysql_fetch_array($std_ledger13l))
  {
 $l=$l +1;
   
  } 
  $sql3a = "select * from atten where std_rollno='$std_rollno' and class_name='$class_name' and obt_mark='A'  and date between '$fromdate' and '$todate' and user_id='$userid'";
   $std_ledger13a=mysql_query($sql3a) or die("Error : " . mysql_error());

while($row3a = mysql_fetch_array($std_ledger13a))
  {
 $a=$a +1;
   
  } 
   

  $sql3 = "select * from atten where std_rollno='$std_rollno' and class_name='$class_name'  and date between '$fromdate' and '$todate' and user_id='$userid'";
   $std_ledger13=mysql_query($sql3) or die("Error : " . mysql_error());

while($row3 = mysql_fetch_array($std_ledger13))
  {
  $date=$row3["date"];
$obt_mark=$row3["obt_mark"];
$ttime=$row3["ttime"];
  echo "<tr>";
  echo "<td bgcolor=#00FF00> $date </td>";
   echo "<td bgcolor=#00FF00> $ttime </td>";
   echo "<td bgcolor=#00FF00> $obt_mark </td>";
 echo "</tr>";
   
  } 
  
 
  
  

  
  echo "</tr>";


 

 echo "<tr>";
 
   echo "<td bgcolor=#00FF00>" ."Total Present:" . $p ."</td>";
  echo "<td bgcolor=#00FF00>" ."Total Leave:" . $l ."</td>";
 echo "<td bgcolor=#00FF00>" ."Total Absent:" . $a ."</td>";
  
  
   echo "</tr>";
  
echo "</table>";


 echo "<br>";
 echo "Remarks:-______________________________________________________________________________________________________________________";
 
 echo "<br>";
 echo "_____________________________________________________________________________________________________________________________";
 
 echo "<br>";
 echo"______________________________________________________________________________________________________________________________";
  echo "<br>";
  echo "<br>";
  echo "<br>";
 echo "Teacher Signature:___________________&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Head Academics:___________________";
 }
?>

	<table width="69%" border="0" align="center">
  <tr>
    <td width="51%">&nbsp;</td>
    <td width="49%">&nbsp;</td>
  </tr>
 
</table>
