<?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
{
include 'dbc.php';

$userid=$_SESSION['userid'];
$username=$_SESSION['username'];
$sql4="Select * from chartofaccounts where acc_type='CASH' and user_id='$userid'";

$data4=mysql_query($sql4) or die ("Error:" . mysql_error());

$rows4=mysql_num_rows($data4);

$std_rollno=$_POST["std_rollno"];
$month_name2=$_POST["month_name2"];
$result = mysql_query("SELECT * FROM issueslip WHERE monthname = '$month_name2' and rollno='$std_rollno' and user_id  = '$userid'");
$test = mysql_fetch_array($result);
if (!$result) 
		{
		die("Error: Data not found..");
		}
				$id=$test['id'] ;
?>
<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">
<!--
.style2 {color: #FFFFFF}
.style3 {font-size: 36px}
.style4 {
	font-family: Tahoma;
	font-size: 12px;
	font-weight: bold;
}
.style5 {color: #FFFF66}
.style6 {color: #000000}
-->
</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("class_name").value=="")
{
alert("Field is Compulsary");
document.getElementById("class_name").focus();
}

else if(document.getElementById("amount").value=="")
{
alert("Field is Compulsary");
document.getElementById("amount").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="#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="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 bgcolor="#2365ED"><a href="signin.php">Signout</a><a href="http://www.twitter.com"></a></TD>
    <TD><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> Monthly Fee Received From Student </strong></p></TD>
  </TR>

<?php
include 'dbc.php';


$userid=$_SESSION["userid"];
date_default_timezone_set("Asia/Karachi");
$today=date("Y-m-d");
$class_name=$_POST["class_name"];
$std_rollno=$_POST["std_rollno"];
$month = date("m",strtotime($today));
		$year = date("Y",strtotime($today));
		 $month_name = date("F", mktime(0, 0, 0, $month, 10));
		 $my=$month_name . " " . $year;

$sql = "select * from admission where std_rollno='$std_rollno' and user_id='$userid'";
$data=mysql_query($sql);
$found=mysql_num_rows($data);
$founddata="";
 if($found==1)
 {
 $founddata=mysql_fetch_array($data);
    $sql1 = "select * from admission where std_rollno='$std_rollno' and user_id='$userid'";
   $appl=mysql_query($sql1) or die("Error : " . mysql_error());
   $app=mysql_fetch_array($appl);
   $bal=$app["bal"];
   $stdname=$app["std_name"];
   $std_rollno=$app["std_rollno"];
   $class_name=$app["class_name"];
    $finebal=$app["finebal"];
	 $curfine=$app["fine"];
	  $allied_code=$app["allied_code"];
	   $barcode=$app["barcode"];
	   $anbal=$app["anbal"];
	   $admbal=$app["admbal"];
	   $regbal=$app["regbal"];
	   $acbal=$app["acbal"];
	   $securitybal=$app["securitybal"];
	   $othersbal=$app["othersbal"];
	   $monthly_fee=$app["monthly_fee"];
	   
   
echo "<table border=1 width=50% align=center bgcolor=white>";
echo "<tr>";
echo "<td>"  .$std_rollno ."  :  " .$stdname ."  :  " .$class_name ."  : Receivable Amount: " .$bal ."  : Previouos Fine Bal: " .$finebal ."  : Current Fine: " .$curfine . "</td>";
echo "</tr>";
echo "<tr>";
echo "<td>" ."Adm bal:" .$admbal .": Annual Bal: " .$anbal ." :Reg Bal: " .$regbal ."  : AC Bal: " .$acbal ."  :Security Bal: " .$securitybal ."  :Others Bal: " .$othersbal . "</td>";
echo "</tr>";
echo "</table>";
?>
<style type="text/css">
<!--
.style2 {color: #FFFFFF}
.style4 {	font-family: Tahoma;
	font-size: 12px;
	font-weight: bold;
}
-->
</style>
<table width="1000" border="0" align="center" cellpadding="0" cellspacing="0">
  <tr>
    <td height="26" colspan="16" bgcolor="#000045"><p class="style36 style2"><strong>Received  Monthly Fee </strong></p></td>
  </tr>
  <tr>
    <td height="254" colspan="16" valign="top" bgcolor="#FFFF66"><form action="rec_fee2.php" method="post" name="app_form" id="app_form">
      <p align="center" class="style4">&nbsp;</p>
      <p align="left" class="style4">Month  Name <span class="style5">..</span> <span class="style5">:</span>
        <input name="month_name" type="text" id="month_name" value="<? echo $my ?>" size="25">
      </p>
      <p align="left" class="style4">Received Date  :
        <input name="rec_date" type="text" id="rec_date" value="<? echo $today ?>" size="25">
      </p>
      <p align="left" class="style4">Admission #:
         ... 
         <input name="std_rollno" type="text" id="std_rollno" size="25" value="<? echo $std_rollno ?>"/>
         Portal Code  #:.
         <input name="allied_code" type="text" id="allied_code" size="25" value="<? echo $allied_code ?>"/>
      </p>
      <p align="left" class="style4">Student Class:   <span class="style5">.</span>
        <input name="class_name" type="text" id="class_name" size="25" value="<? echo $class_name ?>" />
      Roll  #:............
         <input name="barcode" type="text" id="barcode" size="25" value="<? echo $barcode ?>"/>
      </p>
      <p align="left" class="style4">Student Name: <span class="style5">.</span>
        <input name="sdt_name" type="text" id="sdt_name" size="25" value="<? echo $stdname ?>" />
Monthly fee :.
         
        <input name="monthly_fee" type="text" id="monthly_fee" size="25" value="<? echo $monthly_fee ?>"/>
      </p>
      <p align="left" class="style4">Receive Type<span class="style5">:....</span>
        <select name="acc_name_dr" id="acc_name_dr">
        <?php

  while($user_data4=mysql_fetch_array($data4))

  {

  ?>
        <option value="<? echo $user_data4['acc_name']; ?>"><? echo $user_data4["acc_name"]; ?></option>
        <?php

  }

  ?>
      </select>
      </p>
      <p align="left" class="style4">Admbal<span class="style5">:</span>
        <input name="admbal" type="text" id="admbal" size="7" value="0" />
        Anuual bal
        <span class="style5">:</span>
        <input name="anbal" type="text" id="anbal" size="7" value="0" />
      Reg bal <span class="style5">:</span>
      <input name="regbal" type="text" id="regbal" size="7" value="0" />
      AC<span class="style5">:</span>
      <input name="acbal" type="text" id="acbal" size="7" value="0" />
      Security Bl <span class="style5">:</span>
      <input name="secbal" type="text" id="secbal" size="7" value="0" />
      Others<span class="style5">:</span>
      <input name="othersbal" type="text" id="othersbal" size="7" value="0" />
      </p>
      <p align="left" class="style4">Fee Received<span class="style5">:</span>
        <input name="amount" type="text" id="amount" size="15" value="<? echo $bal ?>" />
        Current Fine<span class="style5"> <span class="style6">rec</span>:</span>
        <select name="stdfine" id="stdfine">
          <option selected>0</option>
          <option>50</option>
          <option>100</option>
          <option>150</option>
        </select>
Current <span class="style6">Fine pending</span><span class="style5">:</span>
<input name="finepending" type="text" id="finepending" size="10" value="0" />
Pre Fine Bal Rec <span class="style5">:</span>
<input name="prefine" type="text" id="prefine" size="10" value="0" />
      </p>
      <p align="left" class="style4">Challan No  <span class="style5">.......</span>
        <input name="fine" type="text" id="fine" value="<? echo $id ?>" size="15" /> 
        Receipt No
<span class="style5">:</span>
<input name="rec_no" type="text" id="rec_no" size="10" />
      <input name="rname" type="text" id="rname" value="<? echo $username ?>" size="17" readonly=""/>
      </p>
      <p align="left" class="style4">&nbsp;</p>
      </form>
        <div align="center">
          <input type="submit" name="Submit" value="Received" onClick="check_data()" />
          <input type="reset" name="Submit2" value="Refresh" />
          </p>
          </form>
    </div></td>
  </tr>
</table>
<?php
}
else
{
echo "wrong student no";
}
?>
<a href="rec_fee.php">back</a>


<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>
<?php
}
?>