

							<?php session_start(); 
							
include 'dbc.php';
$userid=$_SESSION["userid"];

$class_name=$_POST["class_name"];
$month_name=$_POST["month_name"];
$camp=$_POST["camp"];
echo "<h1 align=center> Studnet Attendence Report </h1>";
echo "<table border=1 width=100% align=center bgcolor=#FFFF66>";	
			  echo "<tr>";
			  
  echo "<th width=18%> Student Name </th>";
   echo "<th width=10%> Roll No </th>";
    echo "<th width=15%> Father Name </th>";
	 echo "<th width=10%> Class </th>";
	   echo "<th width=10%> Cell 2 </th>";
	    echo "<th width=10%> Cell 1 </th>";
		echo "<th width=5%> Campus </th>";
		echo "<th width=5%>  Days </th>";
		echo "<th width=5%>  Absent </th>";
		echo "<th width=5%>  Present </th>";
		echo "<th width=5%> Per% </th>";
  echo "</tr>";	
  

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

				$std_name=$test['std_name'] ;
				$std_rollno=$test['std_rollno'] ;
				$father_name=$test['father_name'] ;
				$cell_1=$test['cell_1'] ;
				$cell_2=$test['cell_2'] ;
				


$result=mysql_query("SELECT count(*) as rollno from attendence where rollno='$std_rollno' and cname='$class_name' and month_name='$month_name' and camp='$camp' and user_id='$userid'");
$data=mysql_fetch_assoc($result);
$totaldays=$data['rollno'];




$result1=mysql_query("SELECT count(*) as status from attendence where rollno='$std_rollno' and cname='$class_name' and month_name='$month_name' and camp='$camp' and status='A' and user_id='$userid'");
$data1=mysql_fetch_assoc($result1);
$totalabsent=$data1['status'];
  

$result2=mysql_query("SELECT count(*) as status from attendence where rollno='$std_rollno' and cname='$class_name' and month_name='$month_name' and camp='$camp' and status='P' and user_id='$userid'");
$data2=mysql_fetch_assoc($result2);
$totalpresent=$data2['status'];

  $netper=$totalabsent / $totaldays *100;
  if ($netper < 1)
  {
  $netper=100;
  
  }
 
	
			  echo "<tr>";
  echo "<td width=20%>" .$std_name. "</td>";
   echo "<td width=10%>" .$std_rollno. "</td>";
    echo "<td width=20%>" .$father_name. "</td>";
	 echo "<td width=10%>" .$class_name. "</td>";
	   echo "<td width=5%>" .$cell_2. "</td>";
	    echo "<td width=5%>" .$cell_1. "</td>";
		echo "<td width=5%>" .$camp. "</td>";
		echo "<td width=5%>" .$totaldays. "</td>";
		echo "<td width=5%>" .$totalabsent. "</td>";
		echo "<td width=5%>" .$totalpresent. "</td>";
		echo "<td width=5%>" .$netper. "</td>";
  echo "</tr>";	
 

 }
 echo "</table>";		
?>

	
