<?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=100% 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="100%" border="0" align="left">
	
      <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> Month Wise Fee Summary </strong></p></TD>
  </TR>

<?php

include 'dbc.php';

$month_name=$_POST["month_name"];

$userid=$_SESSION["userid"];
echo "<table border=1 width=100% align=center bgcolor=#FFFF66>";
  echo "<tr>";
 echo "<th width=10% colspan=15>" .$month_name. "</th>";
 echo "</tr>";
  echo "<tr>";
 echo "<th width=10% >" ."Class". "</th>";
 
 echo "<th width=5% >" ."No of Students". "</th>";
  echo "<th width=5% >" ."Total fee". "</th>";
  echo "<th width=5% >" ."Pre Bal". "</th>";
   echo "<th width=5% >" ."Pre Fine". "</th>";
    echo "<th width=5% >" ."Current Fine". "</th>";
	echo "<th width=5% >" ." Adm Fee". "</th>";
	echo "<th width=5% >" ."Annual Fee ". "</th>";
	echo "<th width=5% >" ."Reg Fee ". "</th>";
	echo "<th width=5% >" ."Sec Fee ". "</th>";
	echo "<th width=5% >" ." AC". "</th>";
	 echo "<th width=5% >" ."Total Receivable". "</th>";
	  echo "<th width=5% >" ."Deposit Fee". "</th>";
	  echo "<th width=5% >" ."Remainig Bal". "</th>";
   
 echo "</tr>";
 $ttrec=0;
 $trembal=0;
 $tadm_fee=0;
  $tpaper_fee=0;
$treg_fee=0;
$tsecurity_fee=0;
$tgfee=0;

$sql = "select * from addclass where user_id='$userid'";
   $std_ledger1=mysql_query($sql) or die("Error : " . mysql_error());

while($row = mysql_fetch_array($std_ledger1))
 
  {
  $cname=$row["subname"];
   $amounts4=0;
 $std=0;
 $prebal=0;
  $fine=0;
  $prefine=0;
 
 $trec=0;
 $amounts5=0;
 
 $rembal=0;
 $adm_fee=0;
 $reg_fee=0;
 $paper_fee=0;
 $security_fee=0;
 $gfee=0;
 $an_fee=0;

 $sql4 = "select * from issueslip where cname = '$cname' and monthname = '$month_name' and user_id='$userid'";
   $std_ledger14=mysql_query($sql4) or die("Error : " . mysql_error());

while($row4 = mysql_fetch_array($std_ledger14))
 
  {
 $amounts4=$amounts4 + $row4["mfee"];
 $prebal=$prebal + $row4["bal"];
 $prefine=$prefine + $row4["prefine"];
 $fine=$fine + $row4["fine"];
 $adm_fee=$adm_fee + $row4["adm_fee"];
  $an_fee=$an_fee + $row4["afee"];
 $reg_fee=$reg_fee + $row4["reg_fee"];

 $security_fee=$security_fee + $row4["security_fee"];
 $gfee=$gfee + $row4["gfee"];
 $std=$std + 1;
 $trec=$amounts4 + $prebal + $prefine + $fine +$adm_fee +$reg_fee  +$security_fee +$gfee + $an_fee;
 
  }
   $sql5 = "select * from rec_fee where class_name = '$cname' and month_name = '$month_name' and user_id='$userid'";
   $std_ledger15=mysql_query($sql5) or die("Error : " . mysql_error());

while($row5 = mysql_fetch_array($std_ledger15))
 
  {
 $amounts5=$amounts5 + $row5["paid_fee"];
 $anbal=$anbal + $row5["anbal"];
 $admbal=$admbal + $row5["admbal"];
 $regbal=$regbal + $row5["regbal"];
 $acbal=$acbal + $row5["acbal"];
 $securitybal=$securitybal + $row5["securitybal"];
 $netrec=$amounts5 +$anbal +$admbal +$regbal +$acbal +$securitybal;
  }
  $rembal=$trec - $netrec;
 
  echo "<tr>";
 echo "<th width=10%>" .$cname. "</th>";
    echo "<th width=5%>" .$std. "</th>";
  echo "<th width=5%>" .$amounts4. "</th>";
   echo "<th width=5%>" .$prebal. "</th>";
    echo "<th width=5%>" .$prefine. "</th>";
	echo "<th width=5%>" .$fine. "</th>";
	 echo "<th width=5%>" .$adm_fee. "</th>";
	  echo "<th width=5%>" .$an_fee. "</th>";
	  echo "<th width=5%>" .$reg_fee. "</th>";
	   echo "<th width=5%>" .$security_fee. "</th>";
	  echo "<th width=5%>" .$gfee. "</th>";
	   
	   
		 
		  
	 echo "<th width=5%>" .$trec. "</th>";
	  echo "<th width=5%>" .$amounts5. "</th>";
	  echo "<th width=5%>" .$rembal. "</th>";
 echo "</tr>";
  $tadm_fee=$tadm_fee + $adm_fee;
  $tpaper_fee=$tpaper_fee + $an_fee;
$treg_fee=$treg_fee + $reg_fee;
$tsecurity_fee=$tsecurity_fee + $security_fee;
$tgfee=$tgfee + $gfee;

 $tamounts=$tamounts + $amounts4;
 $tamounts5=$tamounts5 + $amounts5;
 $tprebal=$tprebal + $prebal;
 $tprefine=$tprefine + $prefine;
 $tfine=$tfine + $fine;
 $tstd=$tstd + $std;
 $ttrec=$ttrec + $trec;
 $trembal=$trembal + $rembal;
 
  }
  
  echo "<tr>";
 echo "<th width=10% bgcolor=#FFFFFF>" ."Total". "</th>";
 echo "<th width=5% bgcolor=#FFFFFF>" .$tstd. "</th>";
  echo "<th width=5% bgcolor=#FFFFFF>" .$tamounts. "</th>";
  echo "<th width=5% bgcolor=#FFFFFF>" .$tprebal. "</th>";
   echo "<th width=5% bgcolor=#FFFFFF>" .$tprefine. "</th>";
    echo "<th width=5% bgcolor=#FFFFFF>" .$tfine. "</th>";
	echo "<th width=5% bgcolor=#FFFFFF>" .$tadm_fee. "</th>";
	echo "<th width=5% bgcolor=#FFFFFF>" .$tpaper_fee. "</th>";
	echo "<th width=5% bgcolor=#FFFFFF>" .$treg_fee. "</th>";
	echo "<th width=5% bgcolor=#FFFFFF>" .$tsecurity_fee. "</th>";
	echo "<th width=5% bgcolor=#FFFFFF>" .$tgfee. "</th>";
	 echo "<th width=5% bgcolor=#FFFFFF>" .$ttrec. "</th>";
	 echo "<th width=5% bgcolor=#FFFFFF>" .$tamounts5. "</th>";
	  echo "<th width=5% bgcolor=#FFFFFF>" .$trembal. "</th>";
   
 echo "</tr>";
 
echo "</table>";
?>
<table width="100%" 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>
<?php
}
?>