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

$userid=$_SESSION["userid"];
$cname=$_POST["class_name"];
$month_name=$_POST["month"];
$cls_sec=$_POST["cls_sec"];
$after1=$_POST["after1"];
$after2=$_POST["after2"];
$blnk=0;

		$sql1 = "SELECT * FROM feenote WHERE user_id  = '$userid'";
$result1=$conn->query($sql1);
$row1 = $result1->fetch_assoc();
				$accno=$row1['accno'] ;
				
				
				$bname=$row1['bname'] ;
				$notice=$row1['notice'] ;
			
				 
$sql="select * from issueslip where month_name='$month_name' and class_name='$cname' and user_id='$userid' and totalfee > 0 ORDER BY adm_no";
$result=$conn->query($sql);
 while($ppp = $result->fetch_assoc())


				
{
$adm_no=$ppp['adm_no'] ;
$sql12 = "SELECT * FROM admission WHERE adm_no  = '$adm_no' and user_id  = '$userid'";
$result12=$conn->query($sql12);
$row12 = $result12->fetch_assoc();
				$app_file=$row12['app_file'] ;
  $paytotal1=$ppp['totalfee'] + 20 ;
$paytotal2=$ppp['totalfee'] + 200 ;
	echo "<table border=10 width=33% align=left bgcolor=white>";
	echo "<tr>";
	echo "<th colspan=3>";
	echo "<h2 align=center>Fee Voucher <br><img src='logo1.jpg' width='150' height='100' /></h2>";
	
    
echo "<h4 align=center >$userid<br>The Ambassador Schools Toba Tek Singh. 03326116988 / 03463595988</h4>";
	 echo "</th>";
	 echo "</tr>";
	
	 echo "<tr>";
 echo "<td bgcolor=silver align=center colspan=3>" . "Invoice No:" .$ppp["id"] . "</td>";
 echo "</tr>";
 echo "<tr>";
echo "<th bgcolor=white align=left> Registration No </th>";
  echo "<th> "  .$ppp["adm_no"] . "</th>" ;
  echo "<td align=center rowspan=4>" ."<img src='app_images1/".$app_file."' width='80' height='80' />" . "</td>";
 echo "</tr>";

echo "<tr>";
 echo "<th bgcolor=white align=left>Student's Name </th>";
  echo "<th > "  .$ppp["std_name"] . "</th>" ;
  
 echo "</tr>";
 echo "<tr>";
 echo "<th bgcolor=white align=left>Father's Name </th>";
  echo "<th > "  .$ppp["fname"] . "</th>" ;
  
 echo "</tr>";
  echo "<tr>";
  echo "<th bgcolor=white align=left> Class  </th>";
 echo "<th  align=left> "  .$ppp["class_name"] . $ppp["cls_sec"] . "</th>" ;
  echo "</tr>";
  
 

echo "<tr>";
echo "<td bgcolor=silver align=center >" . "Fee Month:" . "</td>";
 echo "<td bgcolor=silver align=center >" . "Issue Date" . "</td>";
 echo "<td bgcolor=silver align=center >" . "Due Date" . "</td>";
 
echo "</tr>";
echo "<tr>";
  echo "<td  align=center > "  .$ppp["month_period"] . "</td>" ;
   echo "<td  align=center > "  .$ppp["date"] . "</td>" ;
  echo "<td align=center > "  .$ppp["due_date"] . "</td>" ;
echo "</tr>";
 echo "<tr>";
  echo "<th bgcolor=silver align=center colspan=3>Fee Details</b>
 </th>";
 echo "</tr>";
 if(isset($_POST['mfee'])){
echo "<tr>";
echo "<th bgcolor=white align=left > Tuition Fee </th>";
 echo "<th  align=right colspan=2> " ."Rs." .$ppp["mfee"] .".00". "</th>" ;
 echo "</tr>";
 }
 if(isset($_POST['feedisc1'])){
  echo "<tr>";
echo "<th bgcolor=white align=left>" . $ppp["feedisc1"] ."</th>";
 echo "<th  align=right colspan=2> " ."Rs." .$ppp["fee1bal"] .".00". "</th>" ;
 echo "</tr>";
 }
  if(isset($_POST['feedisc2'])){
echo "<tr>";
echo "<th bgcolor=white align=left>" . $ppp["feedisc2"] ."</th>";
 echo "<th  align=right colspan=2>" ."Rs." .$ppp["fee2bal"] .".00". "</th>" ;
 echo "</tr>";
 }
  if(isset($_POST['feedisc3'])){
 echo "<tr>";
echo "<th bgcolor=white align=left>" . $ppp["feedisc3"] ."</th>";
 echo "<th  align=right colspan=2>" ."Rs." .$ppp["fee3bal"] .".00". "</th>" ;
 echo "</tr>";
 }
  if(isset($_POST['feedisc4'])){
 echo "<tr>";
echo "<th bgcolor=white align=left>" . $ppp["feedisc4"] ."</th>";
 echo "<th  align=right colspan=2> " ."Rs." .$ppp["fee4bal"] .".00". "</th>" ;
 echo "</tr>";
 }
 
  if(isset($_POST['feedisc5'])){
 echo "<tr>";
echo "<th bgcolor=white align=left>" . $ppp["feedisc5"] ."</th>";
 echo "<th  align=right colspan=2> " ."Rs." .$ppp["fee5bal"] .".00". "</th>" ;
 echo "</tr>";
 }
  if(isset($_POST['feedisc6'])){
 echo "<tr>";
echo "<th bgcolor=white align=left>" . $ppp["feedisc6"] ."</th>";
 echo "<th  align=right colspan=2> " ."Rs." .$ppp["fee6bal"] .".00". "</th>" ;
 echo "</tr>";
 }
 

  echo "<tr>";
echo "<th bgcolor=white align=left>Arrears</th>";
 echo "<th  align=right colspan=2>  " ."Rs." .$ppp["bal"] . ".00"."</th>" ;
 echo "</tr>";
 echo "<tr>";
echo "<th bgcolor=white align=left>  Fine </th>";
 echo "<th  align=right colspan=2> " ."Rs." .$ppp["fine"] . ".00"."</th>" ;
 echo "</tr>";
 echo "<tr>";
 echo "<th bgcolor=white align=left> Total Payable </th>";
  echo "<th  align=right colspan=2> " ."Rs." .$ppp["totalfee"] . ".00"."</th>" ;
 echo "</tr>";
echo "<tr>";
 echo "<th bgcolor=white align=left > Payable after due date:
 </th>";
  echo "<th  align=right colspan=2> " ."Rs." .$paytotal2 . ".00"."</th>" ;
 echo "</tr>";

  echo "<tr>";
  echo "<th bgcolor=white align=left colspan=3>$notice 

 </th>";
 echo "</tr>";

  echo "<tr height=100>";
echo "<th bgcolor=white align=left colspan=3> Sign & Stamp: </th>";
 echo "</tr>";
  echo "<tr>";
echo "<th bgcolor=white align=center colspan=3> Bank Copy </th>";
 echo "</tr>";

echo "</table>";

echo "<table border=10 width=33% align=left bgcolor=white>";
echo "<tr>";
	echo "<th colspan=3>";
	echo "<h2 align=center>Fee Voucher <br><img src='logo1.jpg' width='150' height='100' /></h2>";
	
    
	echo "<h4 align=center >$userid<br>Wafaqi Colony Johar Town Lahore. 042-35220219 / 0336-6700660</h4>";
	 echo "</th>";
	 echo "</tr>";
	
	 echo "<tr>";
 echo "<td bgcolor=silver align=center colspan=3>" . "Invoice No:" .$ppp["id"] . "</td>";
 echo "</tr>";
 echo "<tr>";
echo "<th bgcolor=white align=left> Registration No </th>";
  echo "<th> "  .$ppp["adm_no"] . "</th>" ;
  echo "<td align=center rowspan=4>" ."<img src='app_images1/".$app_file."' width='80' height='80' />" . "</td>";
 echo "</tr>";

echo "<tr>";
 echo "<th bgcolor=white align=left>Student's Name </th>";
  echo "<th > "  .$ppp["std_name"] . "</th>" ;
  
 echo "</tr>";
 echo "<tr>";
 echo "<th bgcolor=white align=left>Father's Name </th>";
  echo "<th > "  .$ppp["fname"] . "</th>" ;
  
 echo "</tr>";
  echo "<tr>";
  echo "<th bgcolor=white align=left> Class  </th>";
 echo "<th  align=left> "  .$ppp["class_name"] . $ppp["cls_sec"] . "</th>" ;
  echo "</tr>";
  
 

echo "<tr>";
echo "<td bgcolor=silver align=center >" . "Fee Month:" . "</td>";
 echo "<td bgcolor=silver align=center >" . "Issue Date" . "</td>";
 echo "<td bgcolor=silver align=center >" . "Due Date" . "</td>";
 
echo "</tr>";
echo "<tr>";
  echo "<td  align=center > "  .$ppp["month_period"] . "</td>" ;
   echo "<td  align=center > "  .$ppp["date"] . "</td>" ;
  echo "<td align=center > "  .$ppp["due_date"] . "</td>" ;
echo "</tr>";
 echo "<tr>";
  echo "<th bgcolor=silver align=center colspan=3>Fee Details</b>
 </th>";
 echo "</tr>";
if(isset($_POST['mfee'])){
echo "<tr>";
echo "<th bgcolor=white align=left > Tuition Fee </th>";
 echo "<th  align=right colspan=2> " ."Rs." .$ppp["mfee"] .".00". "</th>" ;
 echo "</tr>";
 }
 if(isset($_POST['feedisc1'])){
  echo "<tr>";
echo "<th bgcolor=white align=left>" . $ppp["feedisc1"] ."</th>";
 echo "<th  align=right colspan=2> " ."Rs." .$ppp["fee1bal"] .".00". "</th>" ;
 echo "</tr>";
 }
  if(isset($_POST['feedisc2'])){
echo "<tr>";
echo "<th bgcolor=white align=left>" . $ppp["feedisc2"] ."</th>";
 echo "<th  align=right colspan=2>" ."Rs." .$ppp["fee2bal"] .".00". "</th>" ;
 echo "</tr>";
 }
  if(isset($_POST['feedisc3'])){
 echo "<tr>";
echo "<th bgcolor=white align=left>" . $ppp["feedisc3"] ."</th>";
 echo "<th  align=right colspan=2>" ."Rs." .$ppp["fee3bal"] .".00". "</th>" ;
 echo "</tr>";
 }
  if(isset($_POST['feedisc4'])){
 echo "<tr>";
echo "<th bgcolor=white align=left>" . $ppp["feedisc4"] ."</th>";
 echo "<th  align=right colspan=2> " ."Rs." .$ppp["fee4bal"] .".00". "</th>" ;
 echo "</tr>";
 }
 
  if(isset($_POST['feedisc5'])){
 echo "<tr>";
echo "<th bgcolor=white align=left>" . $ppp["feedisc5"] ."</th>";
 echo "<th  align=right colspan=2> " ."Rs." .$ppp["fee5bal"] .".00". "</th>" ;
 echo "</tr>";
 }
  if(isset($_POST['feedisc6'])){
 echo "<tr>";
echo "<th bgcolor=white align=left>" . $ppp["feedisc6"] ."</th>";
 echo "<th  align=right colspan=2> " ."Rs." .$ppp["fee6bal"] .".00". "</th>" ;
 echo "</tr>";
 }
   echo "<tr>";
echo "<th bgcolor=white align=left>Arrears</th>";
 echo "<th  align=right colspan=2>  " ."Rs." .$ppp["bal"] . ".00"."</th>" ;
 echo "</tr>";
 echo "<tr>";
echo "<th bgcolor=white align=left>  Fine </th>";
 echo "<th  align=right colspan=2> " ."Rs." .$ppp["fine"] . ".00"."</th>" ;
 echo "</tr>";
 echo "<tr>";
 echo "<th bgcolor=white align=left> Total Payable </th>";
  echo "<th  align=right colspan=2> " ."Rs." .$ppp["totalfee"] . ".00"."</th>" ;
 echo "</tr>";
echo "<tr>";
 echo "<th bgcolor=white align=left > Payable after due date:
 </th>";
  echo "<th  align=right colspan=2> " ."Rs." .$paytotal2 . ".00"."</th>" ;
 echo "</tr>";

  echo "<tr>";
  echo "<th bgcolor=white align=left colspan=3>$notice

 </th>";
 echo "</tr>";
 
  echo "<tr height=100>";
echo "<th bgcolor=white align=left colspan=3> Sign & Stamp: </th>";
 echo "</tr>";
  echo "<tr>";
echo "<th bgcolor=white align=center colspan=3> School Copy </th>";
 echo "</tr>";

echo "</table>";
echo "<table border=10 width=33% align=left bgcolor=white>";
echo "<tr>";
	echo "<th colspan=3>";
	echo "<h2 align=center>Fee Voucher <br><img src='logo1.jpg' width='150' height='100' /></h2>";
	
    
	echo "<h4 align=center >$userid<br>Wafaqi Colony Johar Town Lahore. 042-35220219 / 0336-6700660</h4>";
	 echo "</th>";
	 echo "</tr>";
	
	 echo "<tr>";
 echo "<td bgcolor=silver align=center colspan=3>" . "Invoice No:" .$ppp["id"] . "</td>";
 echo "</tr>";
 echo "<tr>";
echo "<th bgcolor=white align=left> Registration No </th>";
  echo "<th> "  .$ppp["adm_no"] . "</th>" ;
  echo "<td align=center rowspan=4>" ."<img src='app_images1/".$app_file."' width='80' height='80' />" . "</td>";
 echo "</tr>";

echo "<tr>";
 echo "<th bgcolor=white align=left>Student's Name </th>";
  echo "<th > "  .$ppp["std_name"] . "</th>" ;
  
 echo "</tr>";
 echo "<tr>";
 echo "<th bgcolor=white align=left>Father's Name </th>";
  echo "<th > "  .$ppp["fname"] . "</th>" ;
  
 echo "</tr>";
  echo "<tr>";
  echo "<th bgcolor=white align=left> Class  </th>";
 echo "<th  align=left> "  .$ppp["class_name"] . $ppp["cls_sec"] . "</th>" ;
  echo "</tr>";
  
 

echo "<tr>";
echo "<td bgcolor=silver align=center >" . "Fee Month:" . "</td>";
 echo "<td bgcolor=silver align=center >" . "Issue Date" . "</td>";
 echo "<td bgcolor=silver align=center >" . "Due Date" . "</td>";
 
echo "</tr>";
echo "<tr>";
  echo "<td  align=center > "  .$ppp["month_period"] . "</td>" ;
   echo "<td  align=center > "  .$ppp["date"] . "</td>" ;
  echo "<td align=center > "  .$ppp["due_date"] . "</td>" ;
echo "</tr>";
 echo "<tr>";
  echo "<th bgcolor=silver align=center colspan=3>Fee Details</b>
 </th>";
 echo "</tr>";
if(isset($_POST['mfee'])){
echo "<tr>";
echo "<th bgcolor=white align=left > Tuition Fee </th>";
 echo "<th  align=right colspan=2> " ."Rs." .$ppp["mfee"] .".00". "</th>" ;
 echo "</tr>";
 }
 if(isset($_POST['feedisc1'])){
  echo "<tr>";
echo "<th bgcolor=white align=left>" . $ppp["feedisc1"] ."</th>";
 echo "<th  align=right colspan=2> " ."Rs." .$ppp["fee1bal"] .".00". "</th>" ;
 echo "</tr>";
 }
  if(isset($_POST['feedisc2'])){
echo "<tr>";
echo "<th bgcolor=white align=left>" . $ppp["feedisc2"] ."</th>";
 echo "<th  align=right colspan=2>" ."Rs." .$ppp["fee2bal"] .".00". "</th>" ;
 echo "</tr>";
 }
  if(isset($_POST['feedisc3'])){
 echo "<tr>";
echo "<th bgcolor=white align=left>" . $ppp["feedisc3"] ."</th>";
 echo "<th  align=right colspan=2>" ."Rs." .$ppp["fee3bal"] .".00". "</th>" ;
 echo "</tr>";
 }
  if(isset($_POST['feedisc4'])){
 echo "<tr>";
echo "<th bgcolor=white align=left>" . $ppp["feedisc4"] ."</th>";
 echo "<th  align=right colspan=2> " ."Rs." .$ppp["fee4bal"] .".00". "</th>" ;
 echo "</tr>";
 }
 
  if(isset($_POST['feedisc5'])){
 echo "<tr>";
echo "<th bgcolor=white align=left>" . $ppp["feedisc5"] ."</th>";
 echo "<th  align=right colspan=2> " ."Rs." .$ppp["fee5bal"] .".00". "</th>" ;
 echo "</tr>";
 }
  if(isset($_POST['feedisc6'])){
 echo "<tr>";
echo "<th bgcolor=white align=left>" . $ppp["feedisc6"] ."</th>";
 echo "<th  align=right colspan=2> " ."Rs." .$ppp["fee6bal"] .".00". "</th>" ;
 echo "</tr>";
 }
   echo "<tr>";
echo "<th bgcolor=white align=left>Arrears</th>";
 echo "<th  align=right colspan=2>  " ."Rs." .$ppp["bal"] . ".00"."</th>" ;
 echo "</tr>";
 echo "<tr>";
echo "<th bgcolor=white align=left>  Fine </th>";
 echo "<th  align=right colspan=2> " ."Rs." .$ppp["fine"] . ".00"."</th>" ;
 echo "</tr>";
 echo "<tr>";
 echo "<th bgcolor=white align=left> Total Payable </th>";
  echo "<th  align=right colspan=2> " ."Rs." .$ppp["totalfee"] . ".00"."</th>" ;
 echo "</tr>";
echo "<tr>";
 echo "<th bgcolor=white align=left > Payable after due date:
 </th>";
  echo "<th  align=right colspan=2> " ."Rs." .$paytotal2 . ".00"."</th>" ;
 echo "</tr>";

  echo "<tr>";
  echo "<th bgcolor=white align=left colspan=3>$notice

 </th>";
 echo "</tr>";
 
  echo "<tr height=100>";
echo "<th bgcolor=white align=left colspan=3> Sign & Stamp: </th>";
 echo "</tr>";
  echo "<tr>";
echo "<th bgcolor=white align=center colspan=3> Parents Copy </th>";
 echo "</tr>";

echo "</table>";

echo "_______________________________________________________________________________________________________________________";

}
?>