<?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';


$userid=$_SESSION["userid"];
$from_date=$_POST["from_date"];
$to_date=$_POST["to_date"];
$sql = "SELECT * FROM admission where  adm_date between '$from_date' and '$to_date' and user_id='$userid' order by std_rollno";
$result=$conn->query($sql);

									echo "<table width =100% border=1>";
									echo "<tr>";
									echo "<th colspan=14> <h1>$userid</h1> </th>";
									echo "</tr>";
                                       echo "<tr>";
									echo "<th colspan=14> <h4>New Admission For the Month of:$month</h4> </th>";
									echo "</tr>";
                                       echo "<tr>";
echo "<th bgcolor=#0099FF> Adm# </th>";
echo "<th bgcolor=#0099FF> Roll No </th>";
echo "<th bgcolor=#0099FF> B-Form</th>";
echo "<th bgcolor=#0099FF> Studnet Name </th>";
echo "<th bgcolor=#0099FF> Father Name </th>";
echo "<th bgcolor=#0099FF> Class Name </th>";
echo "<th bgcolor=#0099FF> Sec </th>";
echo "<th bgcolor=#0099FF> Cell 1 </th>";
echo "<th bgcolor=#0099FF> Adm Date</th>";
echo "<th bgcolor=#0099FF> DOB</th>";
echo "<th bgcolor=#0099FF> Nic No</th>";
echo "<th bgcolor=#0099FF> Status</th>";
echo "<th bgcolor=#0099FF> Fee</th>";
echo "<th bgcolor=#0099FF> Concession</th>";
echo "<th bgcolor=#0099FF> Remarks</th>";

echo "</tr>";
?>
                                    </thead>
									
                                    <tbody>
									<?php
                                       while($row = $result->fetch_assoc())
 
  {
 
   echo "<tr>";
echo "<td>" .$row['adm_no'] . "</td>";
echo "<td>" .$row['std_rollno'] . "</td>";
 echo "<td>" .$row['portal_id'] .  "</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['cell_1'] .  "</td>";
  echo "<td>" .$row['adm_date'] .  "</td>";
 echo "<td>" .$row['dob'] .  "</td>";
 echo "<td>" .$row['fnic'] .  "</td>";
 echo "<td>" .$row['status'] .  "</td>";
 echo "<td>" .number_format($row['mfee']) .  "</td>";
 echo "<td>" .number_format($row['consfee']) .  "</td>";
 echo "<td>" .$row['remarks'] .  "</td>";
  echo "</tr>";

$trecord=$trecord + 1;
$tmfee=$tmfee + $row['mfee'];
$tconsfee=$tconsfee + $row['consfee'];
  }
   echo "<tr>";
	echo "<td colspan=12 align=right><b>" ."Total Records::". $trecord ."</b></td>";
	echo "<td><b>" .number_format($tmfee) . "</b></td>";
	  	echo "<td><b>" .number_format($tconsfee) . "</b></td>";
	  echo "</tr>";
	   echo "</table>";
  
}
?>