<?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> ";
}
elseif($_SESSION["usertype"]=="Teacher")
{
 	echo "You are not Authorized This Page <a href='admission_form_raheem.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>
<style type="text/css">
<!--
.style1 {font-weight: bold}
.style2 {color: #FFFFFF}
.style3 {
	color: #FF0000;
	font-weight: bold;
}
.style4 {
	color: #0000FF;
	font-weight: bold;
}
.style5 {
	color: #00FF00;
	font-weight: bold;
	font-size: 36px;
}
-->
</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>
<script type="text/javascript">
function check_data()
{
if(document.getElementById("std_rollno").value=="")
{
alert("Field is Compulsary");
document.getElementById("std_rollno").focus();
}
else if(document.getElementById("std_name").value=="")
{
alert("Field is Compulsary");
document.getElementById("std_name").focus();
}

else if(document.getElementById("father_name").value=="")
{
alert("Field is Compulsary");
document.getElementById("father_name").focus();
}

else if(document.getElementById("adm_no").value=="")
{
alert("Field is Compulsary");
document.getElementById("adm_no").focus();
}

else if(document.getElementById("adm_date").value=="")
{
alert("Field is Compulsary");
document.getElementById("adm_date").focus();
}

else if(document.getElementById("home_adress").value=="")
{
alert("Field is Compulsary");
document.getElementById("home_adress").focus();
}


else if(document.getElementById("cell_1").value=="")
{
alert("Field is Compulsary");
document.getElementById("cell_1").focus();
}

else if(document.getElementById("monthly_fee").value=="")
{
alert("Field is Compulsary");
document.getElementById("monthly_fee").focus();
}

else if(document.getElementById("annual_fee").value=="")
{
alert("Field is Compulsary");
document.getElementById("annual_fee").focus();
}

else
{
document.getElementById("app_form").submit();
}
}
</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="#2564E5"><div align="center"><img src="logo copy.jpg" width="134" height="130"></div></TD>
    <TD COLSPAN=9 bgcolor="#2564E5"><table width="561" border="0" align="left">
      <tr>
        <td width="555" height="97" align="center" valign="middle"><p align="center" class="style28">
		<h1><font face="Palatino Linotype" color="#FFFFFF"><? echo "" . $_SESSION["userid"]; ?></font></h1>
		</p></td>
      </tr>
      <tr>
        <td height="49" align="center" valign="middle"><a href="signin.php"></a></td>
      </tr>
    </table></TD>
    <TD COLSPAN=2 bgcolor="#2564E5"><a href="http://www.facebook.com"></a></TD>
    <TD width="49" bgcolor="#2564E5"><a href="http://www.twitter.com"></a></TD>
    <TD width="56" bgcolor="#2564E5"><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="#2564E5">&nbsp;</TD>
  </TR>
  <TR>
    <TD height="26" COLSPAN=16 bgcolor="#000045"><p align="center" class="style36 style2"><strong>Welcome to Admin Dashboard </strong></p></TD>
  </TR>
  <TR>
    <TD height="393" colspan="16" valign="top" bgcolor="#FFFF66">
	
      <table width="607" border="10" align="center">
	  <form action="save_app.php" method="post" name="app_form" id="app_form">
        <tr>
          <td colspan="4" bgcolor="#FF00FF"><div align="center" class="style5">Today Over All Campus Revenue Details </div></td>
          </tr>
        <tr>
          <td colspan="4" bgcolor="#FFFFCC"><?php
include 'dbc.php';


$userid=$_SESSION["userid"];
$today=date("Y-m-d");
$sqlall = "select * from issueslip where  date='$today'";
   $std_ledger1all=mysql_query($sqlall) or die("Error : " . mysql_error());

while($rowall = mysql_fetch_array($std_ledger1all))
 
  {
 $amountsall=$amountsall + $rowall["nettotal"];
  }
  
  $sql4all = "select * from rec_fee where date='$today'";
   $std_ledger14all=mysql_query($sql4all) or die("Error : " . mysql_error());

while($row4all = mysql_fetch_array($std_ledger14all))
 
  {
 $amounts4all=$amounts4all + $row4all["paid_fee"];
  }
  
   $sql5all = "select * from expense_voucher where date='$today' and month_name='Expense'";
   $std_ledger15all=mysql_query($sql5all) or die("Error : " . mysql_error());

while($row5all = mysql_fetch_array($std_ledger15all))
 
  {
 $amounts5all=$amounts5all + $row5all["amount"];
  }
  
  $sql1all = "select * from admission";
$rec_feeall=mysql_query($sql1all) or die("Error : " . mysql_error());

while($pppall=mysql_fetch_array($rec_feeall))
{
  $amounts1all=$amounts1all + $pppall["bal"];
 }
 $totalexpall=$amounts1all + $amounts4all;
$profitall=$amounts1all - $totalexpall;


echo "<table border=1 width=78% align=center bgcolor=#FFFF66>";
  echo "<tr>";
 echo "<th width=20% colspan=4>" ."Toatl Payable    :     " .$totalexpall . "</th>";
 echo "</tr>";
 echo "<tr>";
 echo "<th width=20% colspan=4>" ."Toatl Received    :     " .$amounts4all . "</th>";
 echo "</tr>";
 echo "<tr>";
 echo "<th width=20% colspan=4>" ."Net Balance    :     " .$amounts1all . "</th>";
 echo "</tr>";
 echo "<tr>";
 echo "<th width=20% colspan=4>" ."Total Exp    :     " .$amounts5all . "</th>";
 echo "</tr>";
echo "</table>";


?> </td>
          </tr>
        
        <tr>
          <td width="127" bgcolor="#FFFFCC">&nbsp;</td>
          <td width="150" bgcolor="#FFFFCC">&nbsp;</td>
          <td width="132" bgcolor="#FFFFCC">&nbsp;</td>
          <td width="180" bgcolor="#FFFFCC">&nbsp;</td>
        </tr>
        <tr>
          <td colspan="4" bgcolor="#00FFFF"><div align="center"><strong>Allied School Classic Campus Revenue Details</strong></div></td>
          </tr>
        <tr>
          <td colspan="4" bgcolor="#FFFFCC"><?php
include 'dbc.php';


$userid=$_SESSION["userid"];
$today=date("Y-m-d");
$sql = "select * from issueslip where  date='$today' and user_id='Allied School Classic Campus'";
   $std_ledger1=mysql_query($sql) or die("Error : " . mysql_error());

while($row = mysql_fetch_array($std_ledger1))
 
  {
 $amounts=$amounts + $row["nettotal"];
  }
  
  $sql4 = "select * from rec_fee where date='$today' and user_id='Allied School Classic Campus'";
   $std_ledger14=mysql_query($sql4) or die("Error : " . mysql_error());

while($row4 = mysql_fetch_array($std_ledger14))
 
  {
 $amounts4=$amounts4 + $row4["paid_fee"];
  }
  
   $sql5 = "select * from expense_voucher where date='$today' and month_name='Expense' and user_id='Allied School Classic Campus'";
   $std_ledger15=mysql_query($sql5) or die("Error : " . mysql_error());

while($row5 = mysql_fetch_array($std_ledger15))
 
  {
 $amounts5=$amounts5 + $row5["amount"];
  }
  
  $sql1 = "select * from admission where user_id='Allied School Classic Campus'";
$rec_fee=mysql_query($sql1) or die("Error : " . mysql_error());

while($ppp=mysql_fetch_array($rec_fee))
{
  $amounts1=$amounts1 + $ppp["bal"];
 }
 $totalexp=$amounts1 + $amounts4;
$profit=$amounts1 - $totalexp;


echo "<table border=1 width=78% align=center bgcolor=#FFFF66>";
  echo "<tr>";
 echo "<th width=20% colspan=4>" ."Toatl Payable    :     " .$totalexp . "</th>";
 echo "</tr>";
 echo "<tr>";
 echo "<th width=20% colspan=4>" ."Toatl Received    :     " .$amounts4 . "</th>";
 echo "</tr>";
 echo "<tr>";
 echo "<th width=20% colspan=4>" ."Net Balance    :     " .$amounts1 . "</th>";
 echo "</tr>";
 echo "<tr>";
 echo "<th width=20% colspan=4>" ."Total Exp    :     " .$amounts5 . "</th>";
 echo "</tr>";
echo "</table>";

$sql11 = "select * from users where usertype='Sub User' and userid='Allied School Classic Campus'";
$rec_fee1=mysql_query($sql11) or die("Error : " . mysql_error());

while($ppp1=mysql_fetch_array($rec_fee1))
{
$rname= $ppp1["username"];
$amounts6=0;
 $sql6 = "select * from rec_fee where date='$today' and rname='$rname' and user_id='Allied School Classic Campus'";
   $std_ledger16=mysql_query($sql6) or die("Error : " . mysql_error());

while($row6 = mysql_fetch_array($std_ledger16))
 
  {
 $amounts6=$amounts6 + $row6["paid_fee"];
  }
  echo "<table border=1 width=78% align=center bgcolor=#FFFF66>";
  echo "<tr>";
 echo "<th width=50% colspan=2>" . $rname  .  "</th>";
 echo "<th width=28% colspan=2>"  . $amounts6 . "</th>";
 echo "</tr>";


  }
   echo "<tr>";
 echo "<th width=50% colspan=2> Total Received  </th>";
 echo "<th width=28% colspan=2>"  . $amounts4 . "</th>";
 echo "</tr>";
 echo "</table>";

?>  </td>
          </tr>
        
        <tr>
          <td bgcolor="#FFFFCC">&nbsp;</td>
          <td bgcolor="#FFFFCC">&nbsp;</td>
          <td bgcolor="#FFFFCC">&nbsp;</td>
          <td bgcolor="#FFFFCC">&nbsp;</td>
        </tr>
        <tr>
          <td colspan="4" bgcolor="#FFFFFF"><div align="center" class="style4">Allied School Fatehghar Campus Revenue Details</div></td>
          </tr>
        <tr>
          <td colspan="4" bgcolor="#FFFFCC"><?php
include 'dbc.php';


$userid=$_SESSION["userid"];
$today=date("Y-m-d");
$sqlsp = "select * from issueslip where  date='$today' and user_id='Allied School Salamat pura Campus'";
   $std_ledger1sp=mysql_query($sqlsp) or die("Error : " . mysql_error());

while($rowsp = mysql_fetch_array($std_ledger1sp))
 
  {
 $amountssp=$amountssp + $rowsp["nettotal"];
  }
  
  $sql4sp = "select * from rec_fee where date='$today' and user_id='Allied School Salamat pura Campus'";
   $std_ledger14sp=mysql_query($sql4sp) or die("Error : " . mysql_error());

while($row4sp = mysql_fetch_array($std_ledger14sp))
 
  {
 $amounts4sp=$amounts4sp + $row4sp["paid_fee"];
  }
  
   $sql5sp = "select * from expense_voucher where date='$today' and month_name='Expense' and user_id='Allied School Salamat pura Campus'";
   $std_ledger15sp=mysql_query($sql5sp) or die("Error : " . mysql_error());

while($row5sp = mysql_fetch_array($std_ledger15sp))
 
  {
 $amounts5sp=$amounts5sp + $row5sp["amount"];
  }
  
  $sql1sp = "select * from admission where user_id='Allied School Salamat pura Campus'";
$rec_feesp=mysql_query($sql1sp) or die("Error : " . mysql_error());

while($pppsp=mysql_fetch_array($rec_feesp))
{
  $amounts1sp=$amounts1sp + $pppsp["bal"];
 }
 $totalexpsp=$amounts1sp + $amounts4sp;
$profitsp=$amounts1sp - $totalexpsp;


echo "<table border=1 width=78% align=center bgcolor=#FFFF66>";
  echo "<tr>";
 echo "<th width=20% colspan=4>" ."Toatl Payable    :     " .$totalexpsp . "</th>";
 echo "</tr>";
 echo "<tr>";
 echo "<th width=20% colspan=4>" ."Toatl Received    :     " .$amounts4sp . "</th>";
 echo "</tr>";
 echo "<tr>";
 echo "<th width=20% colspan=4>" ."Net Balance    :     " .$amounts1sp . "</th>";
 echo "</tr>";
 echo "<tr>";
 echo "<th width=20% colspan=4>" ."Total Exp    :     " .$amounts5sp . "</th>";
 echo "</tr>";
echo "</table>";

$sql11sp = "select * from users where usertype='Sub User' and userid='Allied School Salamat pura Campus'";
$rec_fee1sp=mysql_query($sql11sp) or die("Error : " . mysql_error());

while($ppp1sp=mysql_fetch_array($rec_fee1sp))
{
$rnamesp= $ppp1sp["username"];
$amounts6sp=0;
 $sql6sp = "select * from rec_fee where date='$today' and rname='$rnamesp' and user_id='Allied School Salamat pura Campus'";
   $std_ledger16sp=mysql_query($sql6sp) or die("Error : " . mysql_error());

while($row6sp = mysql_fetch_array($std_ledger16sp))
 
  {
 $amounts6sp=$amounts6sp + $row6sp["paid_fee"];
  }
  echo "<table border=1 width=78% align=center bgcolor=#FFFF66>";
  echo "<tr>";
 echo "<th width=50% colspan=2>" . $rnamesp  .  "</th>";
 echo "<th width=28% colspan=2>"  . $amounts6sp . "</th>";
 echo "</tr>";


  }
   echo "<tr>";
 echo "<th width=50% colspan=2> Total Received  </th>";
 echo "<th width=28% colspan=2>"  . $amounts4sp . "</th>";
 echo "</tr>";
 echo "</table>";

?></td>
          </tr>
        
        <tr>
          <td height="31" bgcolor="#FFFFCC">&nbsp;</td>
          <td colspan="3" bgcolor="#FFFFCC">&nbsp;</td>
          </tr>
        <tr>
          <td colspan="4" bgcolor="#00FF00"><div align="center" class="style3">Allied School Fatehghar Campus Revenue Details</div></td>
          </tr>
        <tr>
          <td colspan="4" bgcolor="#FFFFCC"><?php
include 'dbc.php';


$userid=$_SESSION["userid"];
$today=date("Y-m-d");
$sqlfg = "select * from issueslip where  date='$today' and user_id='Allied School Fatehghar Campus'";
   $std_ledger1fg=mysql_query($sqlfg) or die("Error : " . mysql_error());

while($rowfg = mysql_fetch_array($std_ledger1fg))
 
  {
 $amountsfg=$amountsfg + $rowfg["nettotal"];
  }
  
  $sql4fg = "select * from rec_fee where date='$today' and user_id='Allied School Fatehghar Campus'";
   $std_ledger14fg=mysql_query($sql4fg) or die("Error : " . mysql_error());

while($row4fg = mysql_fetch_array($std_ledger14fg))
 
  {
 $amounts4fg=$amounts4fg + $row4fg["paid_fee"];
  }
  
   $sql5fg = "select * from expense_voucher where date='$today' and month_name='Expense' and user_id='Allied School Fatehghar Campus'";
   $std_ledger15fg=mysql_query($sql5fg) or die("Error : " . mysql_error());

while($row5fg = mysql_fetch_array($std_ledger15fg))
 
  {
 $amounts5fg=$amounts5fg + $row5fg["amount"];
  }
  
  $sql1fg = "select * from admission where user_id='Allied School Fatehghar Campus'";
$rec_feefg=mysql_query($sql1fg) or die("Error : " . mysql_error());

while($pppfg=mysql_fetch_array($rec_feefg))
{
  $amounts1fg=$amounts1fg + $pppfg["bal"];
 }
 $totalexpfg=$amounts1fg + $amounts4fg;
$profitfg=$amounts1fg - $totalexpfg;


echo "<table border=1 width=78% align=center bgcolor=#FFFF66>";
  echo "<tr>";
 echo "<th width=20% colspan=4>" ."Toatl Payable    :     " .$totalexpfg . "</th>";
 echo "</tr>";
 echo "<tr>";
 echo "<th width=20% colspan=4>" ."Toatl Received    :     " .$amounts4fg . "</th>";
 echo "</tr>";
 echo "<tr>";
 echo "<th width=20% colspan=4>" ."Net Balance    :     " .$amounts1fg . "</th>";
 echo "</tr>";
 echo "<tr>";
 echo "<th width=20% colspan=4>" ."Total Exp    :     " .$amounts5fg . "</th>";
 echo "</tr>";
echo "</table>";

$sql11fg = "select * from users where usertype='Sub User' and userid='Allied School Fatehghar Campus'";
$rec_fee1fg=mysql_query($sql11fg) or die("Error : " . mysql_error());

while($ppp1fg=mysql_fetch_array($rec_fee1fg))
{
$rnamefg= $ppp1fg["username"];
$amounts6fg=0;
 $sql6fg = "select * from rec_fee where date='$today' and rname='$rnamefg' and user_id='Allied School Fatehghar Campus'";
   $std_ledger16fg=mysql_query($sql6fg) or die("Error : " . mysql_error());

while($row6fg = mysql_fetch_array($std_ledger16fg))
 
  {
 $amounts6fg=$amounts6fg + $row6fg["paid_fee"];
  }
  echo "<table border=1 width=78% align=center bgcolor=#FFFF66>";
  echo "<tr>";
 echo "<th width=50% colspan=2>" . $rnamefg  .  "</th>";
 echo "<th width=28% colspan=2>"  . $amounts6fg . "</th>";
 echo "</tr>";


  }
   echo "<tr>";
 echo "<th width=50% colspan=2> Total Received  </th>";
 echo "<th width=28% colspan=2>"  . $amounts4fg . "</th>";
 echo "</tr>";
 echo "</table>";

?></td>
          </tr>
		</form>
        <tr>
          <td bgcolor="#FFFFCC">&nbsp;</td>
          <td bgcolor="#FFFFCC">&nbsp;</td>
          <td bgcolor="#FFFFCC">&nbsp;</td>
          <td bgcolor="#FFFFCC">&nbsp;</td>
        </tr>
        <tr>
          <td colspan="4" bgcolor="#FFFFCC">&nbsp;</td>
        </tr>
		
		
		
		
		
		
		<td colspan="4" bgcolor="#00FF00"><div align="center" class="style3">Allied School Defence Campus Revenue Details</div></td>
          </tr>
        <tr>
          <td colspan="4" bgcolor="#FFFFCC"><?php
include 'dbc.php';



$today=date("d-m-Y");

  $sql417 = "select * from rec_fee where date='$today' and user_id='Allied School Defence Campus'";
   $std_ledger1417=mysql_query($sql417) or die("Error : " . mysql_error());

while($row417 = mysql_fetch_array($std_ledger1417))
 
  {
 $amounts417=$amounts417 + $row417["paid_fee"];
  }
  
  
  $sql117 = "select * from admission where user_id='Allied School Defence Campus'";
$rec_fee17=mysql_query($sql117) or die("Error : " . mysql_error());

while($ppp17=mysql_fetch_array($rec_fee17))
{
  $amounts117=$amounts117 + $ppp17["bal"];
 }
 $totalexp=$amounts + $amounts4;
$profit=$amounts1 - $totalexp;


echo "<table border=1 width=78% align=center bgcolor=#FFFF66>";
  
 echo "<tr>";
 echo "<th width=20% colspan=4>" ."Total Fee Received    :     " .$amounts417 . "</th>";
 echo "</tr>";
 echo "<tr>";
 echo "<th width=20% colspan=4>" ."Total Pending Fee    :     " .$amounts117 . "</th>";
 echo "</tr>";
echo "</table>";
?></td>
        </tr>
		<td bgcolor="#FFFFCC"></form>
        <tr>
          <td bgcolor="#FFFFCC">&nbsp;</td>
          <td bgcolor="#FFFFCC">&nbsp;</td>
          <td bgcolor="#FFFFCC">&nbsp;</td>
          <td bgcolor="#FFFFCC">&nbsp;</td>
        </tr>
        <tr>
          <td colspan="4" bgcolor="#FFFFCC">&nbsp;</td>
        </tr>
		
		
		
		
		<td colspan="4" bgcolor="#00FF00"><div align="center" class="style3">Efa School Classic Campus Revenue Details</div></td>
          </tr>
        <tr>
          <td colspan="4" bgcolor="#FFFFCC"><?php
include 'dbc.php';



$today=date("d-m-Y");

  $sql418 = "select * from rec_fee where date='$today' and user_id='Efa School Classic Campus'";
   $std_ledger1418=mysql_query($sql418) or die("Error : " . mysql_error());

while($row418 = mysql_fetch_array($std_ledger1418))
 
  {
 $amounts418=$amounts418 + $row418["paid_fee"];
  }
  
  
  $sql118 = "select * from admission where user_id='Efa School Classic Campus'";
$rec_fee18=mysql_query($sql118) or die("Error : " . mysql_error());

while($ppp18=mysql_fetch_array($rec_fee18))
{
  $amounts118=$amounts118 + $ppp18["bal"];
 }
 $totalexp=$amounts + $amounts4;
$profit=$amounts1 - $totalexp;


echo "<table border=1 width=78% align=center bgcolor=#FFFF66>";
  
 echo "<tr>";
 echo "<th width=20% colspan=4>" ."Total Fee Received    :     " .$amounts418 . "</th>";
 echo "</tr>";
 echo "<tr>";
 echo "<th width=20% colspan=4>" ."Total Pending Fee    :     " .$amounts118 . "</th>";
 echo "</tr>";
echo "</table>";
?></td>
        </tr>
		<td bgcolor="#FFFFCC"></form>
        <tr>
          <td bgcolor="#FFFFCC">&nbsp;</td>
          <td bgcolor="#FFFFCC">&nbsp;</td>
          <td bgcolor="#FFFFCC">&nbsp;</td>
          <td bgcolor="#FFFFCC">&nbsp;</td>
        </tr>
        <tr>
          <td colspan="4" bgcolor="#FFFFCC">&nbsp;</td>
        </tr>
      </table>
      </form>    </TD>
  </TR>
  <TR>
    <TD COLSPAN=16 bgcolor="#2564E5">&nbsp;</TD>
  </TR>
  
  <TR>
    <TD COLSPAN=16><table width="998" border="0" bgcolor="#000144">
      
      
    </table></TD>
  </TR>
  
</TABLE>
<!-- End ImageReady Slices -->
</BODY>
</HTML>
<?Php
}
?>