<?php
session_start();
include 'dbc.php';

$userid=$_SESSION["userid"];
$cname=$_POST["class_name"];
$month_name=$_POST["month_name"];
$accno=$_POST["accno"];
$code=$_POST["code"];
$blnk=0;

$sqladm = "SELECT * FROM users WHERE userid  = '$userid'";
$std_ledger=mysql_query($sqladm) or die("Error : " . mysql_error());
   $test=mysql_fetch_array($std_ledger);
				
				$bankname=$test['address'] ;
				$bname=$test['bankname'] ;
				$cell=$test['cell'] ;
				  $sql1 = "select * from addclass where subname='$cname' and user_id='$userid'";
   $std_ledger1=mysql_query($sql1) or die("Error : " . mysql_error());
   $test2=mysql_fetch_array($std_ledger1);
				
   $fee=$test2["fee"];
				 
$sql="select * from issueslip where monthname='$month_name' and cname='$cname' and code='$code' and nettotal > '0' and user_id='$userid' ORDER BY rollno";
$issueslip=mysql_query($sql) or die("Error : " . mysql_error());
while($ppp=mysql_fetch_array($issueslip))

{
$finebal=$ppp['curfine'] ;
$nettotal=$ppp['nettotal'] ;
$netfee=$finebal + $nettotal;
$mfee=$ppp['mfee'] ;
  $disfee=$fee - $mfee;
	echo "<table border=1 width=33% align=left bgcolor=white>";
	?>
<tr>
<td align="center" colspan="4"><img src="logo1.jpg" /></td>

</tr>
<?php
	echo "<tr>";
	echo "<td colspan=4>";
	
	echo "<h1 align=center colspan=4>$userid </h1>";
	
	 echo "<h4 align=center colspan=4>$bankname </h4>";
	 echo "<h4 align=center colspan=4>$cell </h4>";
	 echo "<h5 align=center colspan=4>$accno </h5>";
	  echo "<h6 align=center colspan=4>Al Habib Bank Allama Iqbal Road TTS </h6>";
	 echo "</td>";
echo "</tr>";
 echo "<tr>";
  echo "<th bgcolor=white align=left > Issue Date </th>";
  echo "<th colspan=3> "  .$ppp["date"] . "</th>" ;
  echo "</tr>";


echo "<tr>";
 echo "<th bgcolor=white align=left>Student Name </th>";
  echo "<th colspan=3> "  .$ppp["stdname"] . "</th>" ;
  
 echo "</tr>";
 echo "<tr>";
 echo "<th bgcolor=white align=left>Father Nic </th>";
  echo "<th colspan=3> "  .$ppp["fname"] . "</th>" ;
  
 echo "</tr>";
echo "<tr>";
  echo "<th bgcolor=white align=left> Student ID </th>";

 echo "<th colspan=3> "  .$ppp["rollno"] . "</th>" ;
  echo "</tr>";
 
   echo "<tr>";
  echo "<th bgcolor=white align=left> Class  </th>";
 echo "<td colspan=3 align=center> "  .$ppp["cname"] . "</td>" ;
  echo "</tr>";
 

 echo "<tr>";
 echo "<th bgcolor=white align=left width=30%> Fee Period </th>";
  echo "<td width=10% colspan=3> "  .$ppp["months"] . "</td>" ;
 
  

echo "</tr>";
echo "<tr>";
 echo "<th bgcolor=white align=left width=30%> Due Date </th>";
  echo "<td width=10% colspan=3> "  .$ppp["due_date"] . "</td>" ;
 
  

echo "</tr>";
echo "</tr>";
echo "<tr>";
 echo "<th bgcolor=white align=center colspan=3 > Particulars </th>";
echo "<th bgcolor=white align=center > Rs. </th>";
echo "</tr>";
echo "<tr>";
echo "<th bgcolor=white align=left colspan=3 > Standard Fee </th>";
 echo "<td width=40%> " ."Rs." .$fee .".00". "</td>" ;
echo "</tr>";
echo "<tr>";
echo "<th bgcolor=white align=left colspan=3 > Tuition Fee </th>";
 echo "<td width=40%> " ."Rs." .$ppp["mfee"] .".00". "</td>" ;
 echo "</tr>";
echo "<tr>";
echo "<th bgcolor=white align=left colspan=3 > Discount Fee </th>";
 echo "<td width=40%> " ."Rs." .$disfee .".00". "</td>" ;
echo "</tr>";
echo "<tr>";
echo "<th bgcolor=white align=left colspan=3> Admission Fee </th>";
 echo "<td width=40%> " . " Rs.0.00 " . "</td>" ;
 echo "</tr>";
echo "<tr>";
echo "<th bgcolor=white align=left colspan=3> Annual Charges </th>";
 echo "<td width=40%> " ."Rs." .$ppp["afee"] . ".00"."</td>" ;
 echo "</tr>";
 echo "<tr>";
echo "<th bgcolor=white align=left colspan=3> Ac Charges </th>";
 echo "<td width=40%> " ."Rs." .$ppp["gfee"] . ".00"."</td>" ;
 echo "</tr>";
echo "<tr>";
echo "<th bgcolor=white align=left colspan=3>"  .$ppp["feedisc"] . "</th>";
 echo "<td width=40%> " ."Rs." .$ppp["feeamount"] . ".00"."</td>" ;
 echo "</tr>";
echo "</tr>";
echo "<tr>";
echo "<th bgcolor=white align=left colspan=3> Pre. Balance </th>";
echo "<td width=40%> " ."Rs" .$ppp["bal"] . ".00"."</td>" ;
echo "</tr>";
 echo "<tr>";
echo "<th bgcolor=white align=left colspan=3> Previous Fine </th>";
 echo "<td width=40%> " ."Rs." .$ppp["curfine"] . ".00"."</td>" ;
 echo "</tr>";
  
  echo "<tr>";
echo "<th bgcolor=white align=left colspan=3> Misc fee </th>";
 echo "<td width=40%> " . " Rs.0.00 " . "</td>" ;
 echo "</tr>";
 echo "<tr>";
 echo "<th bgcolor=white align=left colspan=3> Net Paybale </th>";
  echo "<th width=40% > Rs.$netfee.00 </th>";
 echo "</tr>";
 

 
 
  
 
 
  echo "<td bgcolor=white align=left colspan=4><b>Dear Parents,
<br>A Fine of Rs. 20 per day will be charged after the Due Date.
<br>Also note that duplicate copy issued Rs.20/-.
 </td>";
 echo "</tr>";
 
  echo "<tr>";
echo "<th bgcolor=white align=center colspan=4> Parents Copy </th>";
 echo "</tr>";

echo "</table>";


echo "<table border=1 width=33% align=left bgcolor=white>";
?>
<tr>
<td align="center" colspan="4"><img src="logo1.jpg" /></td>

</tr>
<?php
echo "<tr>";
	echo "<td colspan=4>";
	
	echo "<h1 align=center colspan=4>$userid </h1>";
	
	 echo "<h4 align=center colspan=4>$bankname </h4>";
	 echo "<h4 align=center colspan=4>$cell </h4>";
	 echo "<h5 align=center colspan=4>$accno </h5>";
	  echo "<h6 align=center colspan=4>Al Habib Bank Allama Iqbal Road TTS </h6>";
	 echo "</td>";
echo "</tr>";
echo "<tr>";
  echo "<th bgcolor=white align=left > Issue Date </th>";
  echo "<th colspan=3> "  .$ppp["date"] . "</th>" ;
  echo "</tr>";

echo "<tr>";
 echo "<th bgcolor=white align=left>Student Name </th>";
  echo "<th colspan=3> "  .$ppp["stdname"] . "</th>" ;
  
 echo "</tr>";
 echo "<tr>";
 echo "<th bgcolor=white align=left>Father Nic </th>";
  echo "<th colspan=3> "  .$ppp["fname"] . "</th>" ;
  
 echo "</tr>";
echo "<tr>";
  echo "<th bgcolor=white align=left> Student ID </th>";

 echo "<th colspan=3> "  .$ppp["rollno"] . "</th>" ;
  echo "</tr>";
 
   echo "<tr>";
  echo "<th bgcolor=white align=left> Class  </th>";
 echo "<td colspan=3 align=center> "  .$ppp["cname"] . "</td>" ;
  echo "</tr>";
 

 echo "<tr>";
 echo "<th bgcolor=white align=left width=30%> Fee Period </th>";
  echo "<td width=10% colspan=3> "  .$ppp["months"] . "</td>" ;
 
  

echo "</tr>";
echo "<tr>";
 echo "<th bgcolor=white align=left width=30%> Due Date </th>";
  echo "<td width=10% colspan=3> "  .$ppp["due_date"] . "</td>" ;
 
  

echo "</tr>";
echo "</tr>";
echo "<tr>";
 echo "<th bgcolor=white align=center colspan=3 > Particulars </th>";
echo "<th bgcolor=white align=center > Rs. </th>";


echo "</tr>";
echo "<tr>";
echo "<th bgcolor=white align=left colspan=3 > Standard Fee </th>";
 echo "<td width=40%> " ."Rs." .$fee .".00". "</td>" ;
echo "</tr>";
echo "<tr>";
echo "<th bgcolor=white align=left colspan=3 > Tuition Fee </th>";
 echo "<td width=40%> " ."Rs." .$ppp["mfee"] .".00". "</td>" ;
 echo "</tr>";
echo "<tr>";
echo "<th bgcolor=white align=left colspan=3 > Discount Fee </th>";
 echo "<td width=40%> " ."Rs." .$disfee .".00". "</td>" ;
echo "</tr>";
echo "<tr>";
echo "<th bgcolor=white align=left colspan=3> Admission Fee </th>";
 echo "<td width=40%> " . " Rs.0.00 " . "</td>" ;
 echo "</tr>";
echo "<tr>";
echo "<th bgcolor=white align=left colspan=3> Annual Charges </th>";
 echo "<td width=40%> " ."Rs." .$ppp["afee"] . ".00"."</td>" ;
 echo "</tr>";
 echo "<tr>";
echo "<th bgcolor=white align=left colspan=3> Ac Charges </th>";
 echo "<td width=40%> " ."Rs." .$ppp["gfee"] . ".00"."</td>" ;
 echo "</tr>";
echo "<tr>";
echo "<th bgcolor=white align=left colspan=3>"  .$ppp["feedisc"] . "</th>";
 echo "<td width=40%> " ."Rs." .$ppp["feeamount"] . ".00"."</td>" ;
 echo "</tr>";
echo "</tr>";
echo "<tr>";
echo "<th bgcolor=white align=left colspan=3> Pre. Balance </th>";
echo "<td width=40%> " ."Rs" .$ppp["bal"] . ".00"."</td>" ;
echo "</tr>";
 echo "<tr>";
echo "<th bgcolor=white align=left colspan=3> Previous Fine </th>";
 echo "<td width=40%> " ."Rs." .$ppp["curfine"] . ".00"."</td>" ;
 echo "</tr>";
  
  echo "<tr>";
echo "<th bgcolor=white align=left colspan=3> Misc fee </th>";
 echo "<td width=40%> " . " Rs.0.00 " . "</td>" ;
 echo "</tr>";

 echo "<tr>";
 echo "<th bgcolor=white align=left colspan=3> Net Paybale </th>";
   echo "<th width=40% > Rs.$netfee.00 </th>";
 echo "</tr>";
 
  
 
 
 echo "<td bgcolor=white align=left colspan=4><b>Dear Parents,
<br>A Fine of Rs. 20 per day will be charged after the Due Date.
<br>Also note that duplicate copy issued Rs.20/-.
 </td>";
 echo "</tr>";
  echo "<tr>";


echo "<th bgcolor=white align=center colspan=4> School Copy </th>";
 echo "</tr>";

echo "</table>";


echo "<table border=1 width=33% align=left bgcolor=white>";
?>
<tr>
<td align="center" colspan="4"><img src="logo1.jpg" /></td>

</tr>
<?php
echo "<tr>";
	echo "<td colspan=4>";
	
	echo "<h1 align=center colspan=4>$userid </h1>";
	
	 echo "<h4 align=center colspan=4>$bankname </h4>";
	 echo "<h4 align=center colspan=4>$cell </h4>";
	 echo "<h5 align=center colspan=4>$accno </h5>";
	  echo "<h6 align=center colspan=4>Al Habib Bank Allama Iqbal Road TTS </h6>";
	 echo "</td>";
echo "</tr>";
 echo "<tr>";
  echo "<th bgcolor=white align=left > Issue Date </th>";
  echo "<th colspan=3> "  .$ppp["date"] . "</th>" ;
  echo "</tr>";
echo "<tr>";
 echo "<th bgcolor=white align=left>Student Name </th>";
  echo "<th colspan=3> "  .$ppp["stdname"] . "</th>" ;
  
 echo "</tr>";
 echo "<tr>";
 echo "<th bgcolor=white align=left>Father Nic </th>";
  echo "<th colspan=3> "  .$ppp["fname"] . "</th>" ;
  
 echo "</tr>";
echo "<tr>";
  echo "<th bgcolor=white align=left> Student ID </th>";

 echo "<th colspan=3> "  .$ppp["rollno"] . "</th>" ;
  echo "</tr>";
 
   echo "<tr>";
  echo "<th bgcolor=white align=left> Class  </th>";
 echo "<td colspan=3 align=center> "  .$ppp["cname"] . "</td>" ;
  echo "</tr>";
 

 echo "<tr>";
 echo "<th bgcolor=white align=left width=30%> Fee Period </th>";
  echo "<td width=10% colspan=3> "  .$ppp["months"] . "</td>" ;
 
  

echo "</tr>";
echo "<tr>";
 echo "<th bgcolor=white align=left width=30%> Due Date </th>";
  echo "<td width=10% colspan=3> "  .$ppp["due_date"] . "</td>" ;
 
  

echo "</tr>";
echo "</tr>";
echo "<tr>";
 echo "<th bgcolor=white align=center colspan=3 > Particulars </th>";
echo "<th bgcolor=white align=center > Rs. </th>";


echo "</tr>";
echo "<tr>";
echo "<th bgcolor=white align=left colspan=3 > Standard Fee </th>";
 echo "<td width=40%> " ."Rs." .$fee .".00". "</td>" ;
echo "</tr>";
echo "<tr>";
echo "<th bgcolor=white align=left colspan=3 > Tuition Fee </th>";
 echo "<td width=40%> " ."Rs." .$ppp["mfee"] .".00". "</td>" ;
 echo "</tr>";
echo "<tr>";
echo "<th bgcolor=white align=left colspan=3 > Discount Fee </th>";
 echo "<td width=40%> " ."Rs." .$disfee .".00". "</td>" ;
echo "</tr>";
echo "<tr>";
echo "<th bgcolor=white align=left colspan=3> Admission Fee </th>";
 echo "<td width=40%> " . " Rs.0.00 " . "</td>" ;
 echo "</tr>";
echo "<tr>";
echo "<th bgcolor=white align=left colspan=3> Annual Charges </th>";
 echo "<td width=40%> " ."Rs." .$ppp["afee"] . ".00"."</td>" ;
 echo "</tr>";
 echo "<tr>";
echo "<th bgcolor=white align=left colspan=3> Ac Charges </th>";
 echo "<td width=40%> " ."Rs." .$ppp["gfee"] . ".00"."</td>" ;
 echo "</tr>";
echo "<tr>";
echo "<th bgcolor=white align=left colspan=3>"  .$ppp["feedisc"] . "</th>";
 echo "<td width=40%> " ."Rs." .$ppp["feeamount"] . ".00"."</td>" ;
 echo "</tr>";
echo "</tr>";
echo "<tr>";
echo "<th bgcolor=white align=left colspan=3> Pre. Balance </th>";
echo "<td width=40%> " ."Rs" .$ppp["bal"] . ".00"."</td>" ;
echo "</tr>";
 echo "<tr>";
echo "<th bgcolor=white align=left colspan=3> Previous Fine </th>";
 echo "<td width=40%> " ."Rs." .$ppp["curfine"] . ".00"."</td>" ;
 echo "</tr>";
  
  echo "<tr>";
echo "<th bgcolor=white align=left colspan=3> Misc fee </th>";
 echo "<td width=40%> " . " Rs.0.00 " . "</td>" ;
 echo "</tr>";

 echo "<tr>";
 echo "<th bgcolor=white align=left colspan=3> Net Paybale </th>";
 // echo "<td width=40%> " ."Rs." .$netfee . ".00"."</td>" ;
  echo "<th width=40% > Rs.$netfee.00 </th>";

 echo "</tr>";
 
  
 
 
  echo "<td bgcolor=white align=left colspan=4><b>Dear Parents,
<br>A Fine of Rs. 20 per day will be charged after the Due Date.
<br>Also note that duplicate copy issued Rs.20/-.
 </td>";
 echo "</tr>";
  echo "<tr>";
 

echo "<th bgcolor=white align=center colspan=4> Bank Copy </th>";
 echo "</tr>";

echo "</table>";
echo "_______________________________________________________________________________________________________________________";

}
?>