<?php session_start(); 
if($_SESSION["username"]=="")
{
 	echo "You are not Logged in Please <a href='signin.php'>Sign in </a> First ";
}
elseif($_SESSION["usertype"]=="Parents")
{
 	echo "You are not Authorized This Page <a href='parents.php'>Back </a> ";
}
else
{

?>
<HTML>
<HEAD>
<TITLE>MIND TECH SOLUTION</TITLE>
<link rel="stylesheet" type="text/css" href="ddlevelsfiles/ddlevelsmenu-base.css" />
<link rel="stylesheet" type="text/css" href="ddlevelsfiles/ddlevelsmenu-topbar.css" />
<link rel="stylesheet" type="text/css" href="ddlevelsfiles/ddlevelsmenu-sidebar.css" />
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js"></script>

<style type="text/css">
<!--
.style1 {font-weight: bold}
.style2 {color: #FFFFFF}
.style3 {font-size: 36px}
.style4 {
	font-family: Tahoma;
	font-size: 12px;
	font-weight: bold;
}
-->
</style>
<script type="text/javascript" src="ddlevelsfiles/ddlevelsmenu.js">

/***********************************************
* All Levels Navigational Menu- (c) Dynamic Drive DHTML code library (http://www.dynamicdrive.com)
* This notice MUST stay intact for legal use
* Visit Dynamic Drive at http://www.dynamicdrive.com/ for full source code
***********************************************/

</script>
</HEAD>
<BODY BGCOLOR=#FFFFFF LEFTMARGIN=0 TOPMARGIN=0 MARGINWIDTH=0 MARGINHEIGHT=0>
<!-- ImageReady Slices (home final.psd) -->
<TABLE WIDTH=1000 BORDER=0 CELLPADDING=0 CELLSPACING=0 align=center>
  <TR>
    <TD COLSPAN=3 bgcolor="#2365ED"><div align="center"><img src="logo copy.jpg" width="134" height="130"></div></TD>
    <TD COLSPAN=9 bgcolor="#2365ED"><table width="561" border="0" align="left">
	<tr>
        <td width="555" height="60" align="center" valign="middle"><p align="center" class="style28"><span class="style37 style3"><h1><font face="Palatino Linotype" color="#000000">DREAMLAND INTERNATIONAL SCHOOLS</font> </h1></span></p></td>
      </tr>
      <tr>
        <td width="555" height="123" align="center" valign="middle"><p align="center" class="style28"><span class="style37 style3"><strong><h1><font face="Palatino Linotype" color="#FFFFFF"><? echo "" . $_SESSION["userid"]; ?></font></h1></strong></span></p></td>
      </tr>
    </table></TD>
    <TD COLSPAN=2><a href="http://www.facebook.com"></a></TD>
    <TD><a href="http://www.twitter.com"></a></TD>
    <TD bgcolor="#2365ED"><a href="signin.php">Signout</a><a href="http://www.youtube.com"></a></TD>
  </TR>
  <TR>
    <TD COLSPAN=16 bgcolor="#2365ED"><div id="ddtopmenubar" class="mattblackmenu">
<?php include("includes/menu.php") ?></TD>
  </TR>
  <TR>
    <TD COLSPAN=16 align=center></TD>
  </TR>
  <TR>
    <TD COLSPAN=16 bgcolor="#2365ED">&nbsp;</TD>
  </TR>
  <TR>
    <TD height="26" COLSPAN=16 bgcolor="#000045"><p align="center" class="style36 style2"><strong> Student Ledger Report</strong></p></TD>
  </TR>
<?php
include 'dbc.php';

$id =$_REQUEST['id'];
$userid=$_SESSION["userid"];
$result = mysql_query("SELECT * FROM rec_fee WHERE id  = '$id'");
$test = mysql_fetch_array($result);
if (!$result) 
		{
		die("Error: Data not found..");
		}
				$std_name=$test['std_name'] ;
				$std_rollno= $test['std_rollno'] ;					
				
				$class_name=$test['class_name'] ;
	
     $sql = "select * from issueslip where rollno='$std_rollno' and cname='$std_name' and user_id='$userid'";
   $std_ledger1=mysql_query($sql) or die("Error : " . mysql_error());
   $app=mysql_fetch_array($std_ledger1);
   $fname=$app["fname"];
   $cname=$app["cname"];
   $monthname=$app["monthname"];
    $issue=$app["total"];

 $sql11 = "select * from rec_fee where std_name='$std_name' and user_id='$userid'";
   $std_ledger111=mysql_query($sql11) or die("Error : " . mysql_error());
   $app11=mysql_fetch_array($std_ledger111);

   $monthname=$app11["month_name"];
    $recfee=$app11["paid_fee"];


 


	  echo "<table border=10 width=80% align=center bgcolor=#FFFF66>";
	  echo "<h2 align=center> Fee Issue </h2>";
echo "<tr>";
echo "<th bgcolor=yellow width=10%> Date </th>";
echo "<th bgcolor=yellow width=5%> R.No </th>";
echo "<th bgcolor=yellow width=10%> Student Roll# </th>";
echo "<th bgcolor=yellow width=10%> Student Name </th>";
echo "<th bgcolor=yellow width=10%> Class Name </th>";
echo "<th bgcolor=yellow width=10%> Month Name </th>";
echo "<th bgcolor=yellow width=15%> Discription </th>";
echo "<th bgcolor=yellow width=10%> Fee Issue </th>";
echo "<th bgcolor=yellow width=10%> Fee Receipt </th>";
echo "<th bgcolor=yellow width=5%> Balance </th>";
echo "<th bgcolor=yellow width=5%> Fine </th>";
echo "</tr>";
echo "</table>";
 $sql121 = "select * from issueslip where fname='$fname' and stdname='$std_name' and user_id='$userid' order by id";
   $std_ledger1121=mysql_query($sql121) or die("Error : " . mysql_error());
while($app121=mysql_fetch_array($std_ledger1121))
{
  echo "<table border=10 width=80% align=center bgcolor=#FFFF66>";
   echo "<tr>";
   echo "<td width=10%>"  .$app121["date"] . "</td>" ;
   echo "<td width=5%>"  .$app121["id"] . "</td>" ;
   echo "<td width=10%>"  .$app121["rollno"] . "</td>" ;
   echo "<td width=10%>"  .$app121["stdname"] . "</td>" ;
    
   echo "<td width=10%>"  .$app121["cname"] . "</td>" ;
   echo "<td width=10%>"  .$app121["monthname"] . "</td>" ;
   echo "<td width=15%> Fee Issue & fine </td>" ;
   echo "<td width=10%>"  . $app121["nettotal"] . "</td>" ;
   echo "<td width=10%>  </td>" ;
   echo "<td width=5%>"  .$app121["nettotal"] . "</td>" ;
   echo "<td width=5%>"  .$app121["fine"] . "  </td>" ;
   

   echo "</tr>";
   echo "</table>";
 
    
 }

echo "<h2 align=center> Fee Receipt </h2>";
	  echo "<table border=10 width=80% align=center bgcolor=#FFFF66>";
echo "<tr>";
echo "<th bgcolor=yellow width=10%> Date </th>";
echo "<th bgcolor=yellow width=5%> R.No </th>";
echo "<th bgcolor=yellow width=10%> Student Roll# </th>";
echo "<th bgcolor=yellow width=10%> Student Name </th>";
echo "<th bgcolor=yellow width=10%> Class Name </th>";
echo "<th bgcolor=yellow width=10%> Month Name </th>";
echo "<th bgcolor=yellow width=15%> Discription </th>";
echo "<th bgcolor=yellow width=10%> Fee Issue </th>";
echo "<th bgcolor=yellow width=10%> Fee Receipt </th>";
echo "<th bgcolor=yellow width=5%> Balance </th>";
echo "<th bgcolor=yellow width=5%> Fine </th>";
echo "</tr>";
echo "</table>";
 $sql12 = "select * from rec_fee where std_name='$std_name' and user_id='$userid' order by id";
   $std_ledger112=mysql_query($sql12) or die("Error : " . mysql_error());
while($app12=mysql_fetch_array($std_ledger112))
{
  echo "<table border=10 width=80% align=center bgcolor=#FFFF66>";
   echo "<tr>";
   echo "<td width=10%>"  .$app12["date"] . "</td>" ;
   echo "<td width=5%>"  .$app12["id"] . "</td>" ;
   echo "<td width=10%>"  .$app12["std_rollno"] . "</td>" ;
   echo "<td width=10%>"  .$app12["std_name"] . "</td>" ;
    
   echo "<td width=10%>"  .$app12["class_name"] . "</td>" ;
   echo "<td width=10%>"  .$app12["month_name"] . "</td>" ;
   echo "<td width=15%>"  .$app12["rt"] . "</td>" ;
   echo "<td width=10%>"  . $app12["total_fee"] . "</td>" ;
   echo "<td width=10%>"  .$app12["paid_fee"] . "</td>" ;
   echo "<td width=5%>"  .$app12["bal_fee"] . "</td>" ;
   echo "<td width=5%>"  .$app12["fine"] . "</td>" ;
   

   echo "</tr>";
   echo "</table>";
 
    
 }
 echo "<h2 align=center> Opening Ending Balance </h2>";
echo "<table border=10 width=80% align=center bgcolor=#FFFF66>";
 
echo "<tr>";
echo "<th bgcolor=yellow width=10%> Date </th>";
echo "<th bgcolor=yellow width=5%> R.No </th>";
echo "<th bgcolor=yellow width=10%> Student Roll# </th>";
echo "<th bgcolor=yellow width=10%> Student Name </th>";
echo "<th bgcolor=yellow width=10%> Class Name </th>";
echo "<th bgcolor=yellow width=10%> Month Name </th>";
echo "<th bgcolor=yellow width=15%> Discription </th>";
echo "<th bgcolor=yellow width=10%> Fee Issue </th>";
echo "<th bgcolor=yellow width=10%> Fee Receipt </th>";
echo "<th bgcolor=yellow width=5%> Balance </th>";
echo "<th bgcolor=yellow width=5%> Fine </th>";
echo "</tr>";
echo "</table>";
 $sql13 = "select * from admission where father_name='$fname' and std_name='$std_name' and user_id='$userid' order by id";
   $std_ledger113=mysql_query($sql13) or die("Error : " . mysql_error());
while($app13=mysql_fetch_array($std_ledger113))
{
  echo "<table border=10 width=80% align=center bgcolor=#FFFF66>";
   echo "<tr>";
   echo "<td width=10%>"  .$app13["date"] . "</td>" ;
   echo "<td width=5%>"  .$app13["id"] . "</td>" ;
   echo "<td width=10%>"  .$app13["std_rollno"] . "</td>" ;
   echo "<td width=10%>"  .$app13["std_name"] . "</td>" ;
    
   echo "<td width=10%>"  .$app13["class_name"] . "</td>" ;
   echo "<td width=10%>   </td>" ;
   echo "<td width=15%> Opeing / Ending Bal </td>" ;
   echo "<td width=10%>"  . $app13["bal"] . "</td>" ;
   echo "<td width=10%>  </td>" ;
   echo "<td width=5%>"  .$app13["bal"] . "</td>" ;
   echo "<td width=5%>   </td>" ;
   

   echo "</tr>";
   echo "</table>";
}

}

?>


<table width="78%" align="center" bgcolor="#010044">
<tr>
  <td height="46" colspan="2" bgcolor="#010044">&nbsp;</td>
  <td width="580" rowspan="2" bgcolor="#010044">&nbsp;</td>
</tr>
      <tr>
        <td height="52" bgcolor="#010044">&nbsp;</td>
        <td bgcolor="#010044">&nbsp;</td>
      </tr>
    </table>
</body>
</html>
