<?php include "dbconfig.php";
session_start();
$college=$_GET['college'];
$fno=$_GET['fno'];
$rno=$_GET['rno'];
$head=$_GET['head'];
 ?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title></title>
</head><body>

<?php 
			$queryyo = "SELECT * FROM college_info where code='$college'";
$numresultsyo=mysql_query($queryyo);
$resultyo= mysql_query($queryyo) or die("Couldn't execute query");
$a_rowwo = mysql_fetch_row( $resultyo );
///////////////////////////////////////////////////////////
$queryy = "SELECT * FROM class2 where fno='$fno' and session='$session' and code='$college'";
$numresultsy=mysql_query($queryy);
$resulty= mysql_query($queryy) or die("Couldn't execute query");
$a_roww = mysql_fetch_array( $resulty );
$collegeop=$a_roww['college'];
$total_fees=$a_roww['total_fees'];
$Course_Details=$a_roww['Course_Details'];
$Course=$a_roww['Course'];

								

											$queryx = "SELECT * FROM fees where class='$Course' and section='$Course_Details' and code='$collegeop' and session='$session'";

$numresultsyx=mysql_query($queryx);

$resultyx= mysql_query($queryx) or die("Couldn't execute query");

$a_rowx = mysql_fetch_row( $resultyx );

 //$fees_1=$a_rowx[3];
 if($head=='1'){
  $fees_2=$a_rowx[4];
  }
  if($head=='2'){
  $fees_8=$a_rowx[8];
   }
  if($head=='3'){
  $fees_9=$a_rowx[9];
   }
  if($head=='4'){
  $fees_10=$a_rowx[10];
   }
  if($head=='5'){
  $fees_11=$a_rowx[11];
   }
  if($head=='6'){
  $fees_12=$a_rowx[12];
}
  //////////////////////////////////////////////

  

 

 $check_exist_qryfe="select * from class2 where fno='$fno' and session='$session' and code='$collegeop'";

$run_qryfe=mysql_query($check_exist_qryfe);

$total_foundfe=mysql_num_rows($run_qryfe);

$roww_fe = mysql_fetch_array($run_qryfe, MYSQL_BOTH);

	 $str = $roww_fe['class_app']; 

	 $college_codex = $roww_fe['college'];

	 $CourseTypex = $roww_fe['CourseType'];

	 

	 if($str!=""){

	 $class_app=explode(",",$str);

	

foreach ($class_app as $value) {
//////////////////////////////////////////////
//echo $value;

 $queryyr = "SELECT * FROM subject where college_code='$college_codex' and college_type='$CourseTypex' and subject='$value' and subject_type='P' and session='$session' and code='$college'";

$numresultsyr=mysql_query($queryyr);

$numrows=mysql_num_rows($numresultsyr);

$resultyr= mysql_query($queryyr) or die("Couldn't execute query");

$a_rowwr = mysql_fetch_row( $resultyr );

$pra_chk=$a_rowwr[5]; 

if(($numrows!="")&&($pra_chk=="P")&&($a=="")){

$a=0;

//echo '*';

}

if(($numrows!="")&&($pra_chk="P")){
$a;

$a++;

}

//echo $pra_chk;
  

//echo $a;
}}

  ////////////////////////////////////////////

  $fees_2=$fees_2*$a;

$fees_9=$fees_9;

  $gtotalp=$fees_2+$fees_9;
    

$tofees=$fees_8+$fees_10+$fees_11+$fees_12+$gtotalp;

 // echo $tofees;

 $roll=$fno;				
$queryy = "SELECT * FROM pay_fees where roll_no='$roll' and id='$rno' and session='$session' and code='$college'";
$numresultsy=mysql_query($queryy);
$resulty= mysql_query($queryy) or die("Couldn't execute query");
$roww_fep = mysql_fetch_array($numresultsy, MYSQL_BOTH);

?>

 
<table width="100%" border="0" cellspacing="0" cellpadding="0" >
  <tr>
    <td width="50%"><table width="100%" border="0" cellspacing="0" cellpadding="0" style="border:2px #000000 double; margin:2px;">
      <tr >
        <td align="center" style="border-bottom:2px #000000 double;">
        <table width="100%" border="0" cellspacing="0" cellpadding="0">
  <tr>
    <td><img src="../<?php echo $a_rowwo['4']; ?>" height="113" width="126" align="right"></td>
    <td align="center"><div style="font-size:20px"><strong><?php echo $a_rowwo['2']; ?></strong></div><div><?php echo $a_rowwo['3']; ?></div><div><strong>Office - 7054832000</strong></div> <div yy/mm/dd>    (Office Copy)</div></td>
    <td><img src="https://chart.googleapis.com/chart?chs=300x300&cht=qr&chl=[Receipt No/Roll No :<?php echo $rno.'/'.$roll ?>]-[Date :<?php echo $roww_fep['pay_date']; ?>/<?php echo $roww_fep['pay_time']; ?>]-[Name : <?php echo $roww_fe['StudentName']; ?>/Father's Name : <?php echo $roww_fe['FatherName']; ?>]-[Applicant Name-<?php echo $row['name']; ?>]&choe=UTF-8"  width="112" height="117" style="border:1px #000000 solid"/></td>
  </tr>
</table>

</td>
      </tr>
      <tr>
        <td style="border-bottom:2px #000000 double;"><table width="100%" border="0" cellspacing="0" cellpadding="0">

          <tr>
            <td width="50%"><div align="left"><strong>Receipt No/Roll No :</strong> <?php echo $rno.'/'.$a_roww['college_roll']; ?></div></td>
            <td width="50%"><div align="left"><strong>Date : </strong><?php echo $roww_fep['pay_date']; ?>/<?php echo $roww_fep['pay_time']; ?></div></td>
            </tr>
          <tr>
            <td><div align="left"><strong>Name : <?php echo $StudentName=$roww_fe['StudentName']; ?></strong></div></td>
            <td><div align="left"><strong>Father's Name : <?php echo $FatherName=$roww_fe['FatherName']; ?></strong></div></td>
            </tr>
          <tr>
            <td><div align="left"><strong>Class : <?php $id_course_o=$roww_fe['Course'];
			
			
 $cpcheck_exist_qryfe="select * from course_name where id='$id_course_o' and session='$session' and code='$code'";
$cprun_qryfe=mysql_query($cpcheck_exist_qryfe);
$cptotal_foundfe=mysql_num_rows($cprun_qryfe);
$cproww_fe = mysql_fetch_array($cprun_qryfe, MYSQL_BOTH);
			echo $course_name=$cproww_fe['course_name'];
			 ?>-<?php echo $Course_Details=$roww_fe['Course_Details']; ?></strong></div></td>
            <td><div align="left"><strong>Subjects: </strong><strong><?php echo $subbb=$roww_fe['class_app']; ?></strong>/<?php echo $roww_fe['minorsubject']; ?>/<?php echo $vcourse=$roww_fe['vcourse']; ?>/<?php echo $cccourse=$roww_fe['cccourse']; ?></div></td>
            </tr>
        </table></td>
      </tr>
      <tr>
        <td><table width="100%" border="0" cellspacing="0" cellpadding="0">

          <tr >
            <td style="border-bottom:2px #000000 double;"><strong>No.</strong></td>
            <td style="border-bottom:2px #000000 double;"><strong>Fees Type</strong></td>
            <td style="border-bottom:2px #000000 double;"><strong>Amount</strong></td>
          </tr>
          <tr>
            <td width="7%">1.</td>
            <td width="43%"><div align="left">Pay Fees on <?php echo $roww_fep['pay_date']; ?></div></td>
            <td width="50%">&nbsp;</td>
          </tr>
          <tr>
            <td>&nbsp;</td>
            <td colspan="2">       <table width="100%">   <tr bgcolor="#FFFF33">
                  <td width="10%">R.No</td>
                  <td width="36%">Date / Time {Course}</td>
                  <td width="17%">Discount</td>
                  <td width="7%">Pay</td>
                  <td width="21%">Checked By</td>
                  <td width="9%">Note</td>
                </tr>
                
                <?php
				$queryy = "SELECT * FROM pay_fees where roll_no='$roll' and session='$session' and code='$code' order by id";
$numresultsy=mysql_query($queryy);
$resulty= mysql_query($queryy) or die("Couldn't execute query");
while ( $a_rowd = mysql_fetch_row( $resulty ) )
 {
 $idd=$a_rowd[9];
 $check_exist_qryfe="select * from course_name where id='$idd' and session='$session' and code='$code'";
$run_qryfe=mysql_query($check_exist_qryfe);
$total_foundfe=mysql_num_rows($run_qryfe);
$roww_fe = mysql_fetch_array($run_qryfe, MYSQL_BOTH);

$rno_g=$a_rowd[0];
if($rno_g<=$rno){
 ?>
               
                  
               
               
               
                <tr bgcolor="#FFFF33">
               <td><?php echo $a_rowd[0];?></td>
    <td><?php echo $a_rowd[2];?>/<?php echo $a_rowd[3];?>{ <?php echo $roww_fe['course_name']; ?>-<?php echo $a_rowd[10];?> }</td>
    <td><?php if($head=='2'){
 echo $dis1=$a_rowd[19];

  }
  if($head=='1'){
 echo $dis1=$a_rowd[20];
   }
  if($head=='3'){
 echo $dis1=$a_rowd[21];
   }
  if($head=='4'){
 echo $dis1=$a_rowd[22];
   }
  if($head=='5'){
 echo $dis1=$a_rowd[23];
   }
  if($head=='6'){
echo  $dis1=$a_rowd[24];
};?>/-</td>
    <td><?php if($head=='2'){
echo  $pay1=$a_rowd[13];
  }
  if($head=='1'){
 echo $a_rowd[14];
   }
  if($head=='3'){
 echo $pay1=$a_rowd[15];
   }
  if($head=='4'){
 echo $pay1=$a_rowd[16];
   }
  if($head=='5'){
 echo $pay1=$a_rowd[17];
   }
  if($head=='6'){
 echo $pay1=$a_rowd[18];
};?>/-</td>
    <td><?php echo $a_rowd[6];?></td>
     <td><?php echo $a_rowd[11];?></td>
        </tr>
             
        <?php 
  $pay2+=$pay1;
  $dis2+=$dis1;
  }  
  } 
 
			   
			  
  
  ?><tr bgcolor="#FFFF33">
                  <td>&nbsp;</td>
                  <td>&nbsp;</td>
                  <td><strong><?php echo $dis2; ?></strong></td>
                  <td><strong><?php echo $pay26=$pay2; ?>/-</strong></td>
                  <td>&nbsp;</td>
                  <td>&nbsp;</td>
                </tr>    
 </table></td>
            </tr>

<?php if($college!="557"){ ?>

          <tr>



            <td>2.</td>



            <td>Total Fees : </td>



            <td><?php if($head=='1'){
  echo $totalfee=$fees_2;
  }
  if($head=='2'){
  echo $totalfee=$fees_8;
   }
  if($head=='3'){
  echo $totalfee=$fees_9;
   }
  if($head=='4'){
  echo $totalfee=$fees_10;
   }
  if($head=='5'){
  echo $totalfee=$fees_11;
   }
  if($head=='6'){
   echo $totalfee=$fees_12;
} ?>/-</td>



          </tr>



          <tr>



            <td>3.</td>



            <td>Total Fees After Adjustment :</td>



            <td><?php if($head=='1'){
  echo $finalpay=$totalfee-$dis2;
  }
  if($head=='2'){
  echo $finalpay=$totalfee-$dis2;
   }
  if($head=='3'){
  echo $finalpay=$totalfee-$dis2;
   }
  if($head=='4'){
  echo $finalpay=$totalfee-$dis2;
   }
  if($head=='5'){
  echo $finalpay=$totalfee-$dis2;
   }
  if($head=='6'){
   echo $finalpay=$totalfee-$dis2;
} ?>/-</td>



          </tr>



          <tr>



            <td>4.</td>



            <td><div align="left">Dues Amount on <?php echo $roww_fep['pay_date']; ?></div></td>



            <td><?php echo $dues=$finalpay-$pay26; ?>/-</td>



          </tr>
        </table></td>
      </tr>

 <?php } ?>

      <tr>
        <td style="border-bottom:2px #000000 double;">&nbsp;</td>
      </tr>
      <tr>
        <td><table width="100%" border="0" cellspacing="0" cellpadding="0">
          <tr>
            <td width="50%"><strong>Deposited Fee</strong></td>
            <td width="50%"><div align="right"><strong>Depositor's Signature</strong></div></td>
          </tr>
        </table></td>
      </tr>
    </table></td>  </tr>
</table><br />
<table width="100%" border="0" cellspacing="0" cellpadding="0" >
  <tr>
    <td width="50%"><table width="100%" border="0" cellspacing="0" cellpadding="0" style="border:2px #000000 double; margin:2px;">
      <tr >
        <td align="center" style="border-bottom:2px #000000 double;">
        <table width="100%" border="0" cellspacing="0" cellpadding="0">
  <tr>
    <td><img src="../<?php echo $a_rowwo['4']; ?>" height="113" width="126" align="right"></td>
    <td align="center"><div style="font-size:20px"><strong><?php echo $a_rowwo['2']; ?></strong></div><div><?php echo $a_rowwo['3']; ?></div><div><strong>Office - 7054832000</strong></div> <div yy/mm/dd>    (Student Copy)</div></td>
    <td><img src="https://chart.googleapis.com/chart?chs=300x300&cht=qr&chl=[Receipt No/Roll No :<?php echo $rno.'/'.$roll ?>]-[Date :<?php echo $roww_fep['pay_date']; ?>/<?php echo $roww_fep['pay_time']; ?>]-[Name : <?php echo $roww_fe['StudentName']; ?>/Father's Name : <?php echo $roww_fe['FatherName']; ?>]-[Applicant Name-<?php echo $row['name']; ?>]&choe=UTF-8"  width="112" height="117" style="border:1px #000000 solid"/></td>
  </tr>
</table>

</td>
      </tr>
      <tr>
        <td style="border-bottom:2px #000000 double;"><table width="100%" border="0" cellspacing="0" cellpadding="0">

          <tr>
            <td width="50%"><div align="left"><strong>Receipt No/Roll No :</strong> <?php echo $rno.'/'.$a_roww['college_roll']; ?></div></td>
            <td width="50%"><div align="left"><strong>Date : </strong><?php echo $roww_fep['pay_date']; ?>/<?php echo $roww_fep['pay_time']; ?></div></td>
            </tr>
          <tr>
            <td><div align="left"><strong>Name : <?php echo $StudentName; ?></strong></div></td>
            <td><div align="left"><strong>Father's Name : <?php echo $FatherName; ?></strong></div></td>
            </tr>
          <tr>
            <td><div align="left"><strong>Class : <?php 
			echo $course_name;
			 ?>-<?php echo $Course_Details; ?></strong></div></td>
            <td><div align="left"><strong>Subjects: </strong><strong><?php echo $subbb;?></strong>/<?php echo $minorsubject; ?>/<?php echo $vcourse; ?>/<?php echo $cccourse; ?></div></td>
            </tr>
        </table></td>
      </tr>
      <tr>
        <td><table width="100%" border="0" cellspacing="0" cellpadding="0">

          <tr >
            <td style="border-bottom:2px #000000 double;"><strong>No.</strong></td>
            <td style="border-bottom:2px #000000 double;"><strong>Fees Type</strong></td>
            <td style="border-bottom:2px #000000 double;"><strong>Amount</strong></td>
          </tr>
          <tr>
            <td width="7%">1.</td>
            <td width="43%"><div align="left">Pay Fees on <?php echo $roww_fep['pay_date']; ?></div></td>
            <td width="50%">&nbsp;</td>
          </tr>
          <tr>
            <td>&nbsp;</td>
            <td colspan="2">       <table width="100%">   <tr bgcolor="#FFFF33">
                  <td width="10%">R.No</td>
                  <td width="36%">Date / Time {Course}</td>
                  <td width="17%">Discount</td>
                  <td width="7%">Pay</td>
                  <td width="21%">Checked By</td>
                  <td width="9%">Note</td>
                </tr>
                
                <?php
				$queryy = "SELECT * FROM pay_fees where roll_no='$roll' and session='$session' and code='$code' order by id";
$numresultsy=mysql_query($queryy);
$resulty= mysql_query($queryy) or die("Couldn't execute query");
while ( $a_rowd = mysql_fetch_row( $resulty ) )
 {
 $idd=$a_rowd[9];
 $check_exist_qryfe="select * from course_name where id='$idd' and session='$session' and code='$code'";
$run_qryfe=mysql_query($check_exist_qryfe);
$total_foundfe=mysql_num_rows($run_qryfe);
$roww_fe = mysql_fetch_array($run_qryfe, MYSQL_BOTH);

$rno_g=$a_rowd[0];
if($rno_g<=$rno){
 ?>
               
                  
               
               

               
                <tr bgcolor="#FFFF33">
               <td><?php echo $a_rowd[0];?></td>
    <td><?php echo $a_rowd[2];?>/<?php echo $a_rowd[3];?>{ <?php echo $roww_fe['course_name']; ?>-<?php echo $a_rowd[10];?> }</td>
    <td><?php if($head=='2'){
 echo $dis1=$a_rowd[19];
  }
  if($head=='1'){
 echo $dis1=$a_rowd[20];
   }
  if($head=='3'){
 echo $dis1=$a_rowd[21];
   }
  if($head=='4'){
 echo $dis1=$a_rowd[22];
   }
  if($head=='5'){
 echo $dis1=$a_rowd[23];
   }
  if($head=='6'){
echo  $dis1=$a_rowd[24];
};?>
      /-</td>
    <td><?php if($head=='2'){
echo  $pay1=$a_rowd[13];
  }
  if($head=='1'){
 echo $a_rowd[14];
   }
  if($head=='3'){
 echo $pay1=$a_rowd[15];
   }
  if($head=='4'){
 echo $pay1=$a_rowd[16];
   }
  if($head=='5'){
 echo $pay1=$a_rowd[17];
   }
  if($head=='6'){
 echo $pay1=$a_rowd[18];
};?>
      /-</td>
    <td><?php echo $a_rowd[6];?></td>
     <td><?php echo $a_rowd[11];?></td>
        </tr>
             
        <?php 
  $pay2+=$pay1;
  $dis2x+=$dis1x;
  }  
  } 
 
			   
			  
  
  ?><tr bgcolor="#FFFF33">
                  <td>&nbsp;</td>
                  <td>&nbsp;</td>
                  <td><strong><?php echo $dis2; ?></strong></td>
                  <td><strong><?php echo $pay26; ?>/-</strong></td>
                  <td>&nbsp;</td>
                  <td>&nbsp;</td>
                </tr>    
 </table></td>
            </tr>
  <tr>



            <td>2.</td>



            <td>Total Fees Course Fees : </td>



            <td><?php if($head=='1'){
  echo $totalfee=$fees_2;
  }
  if($head=='2'){
  echo $totalfee=$fees_8;
   }
  if($head=='3'){
  echo $totalfee=$fees_9;
   }
  if($head=='4'){
  echo $totalfee=$fees_10;
   }
  if($head=='5'){
  echo $totalfee=$fees_11;
   }
  if($head=='6'){
   echo $totalfee=$fees_12;
} ?>
              /-</td>
  </tr>



          <tr>



            <td>3.</td>



            <td>Total Fees After Adjustment :</td>



            <td><?php if($head=='1'){
  echo $finalpay=$totalfee-$dis2;
  }
  if($head=='2'){
  echo $finalpay=$totalfee-$dis2;
   }
  if($head=='3'){
  echo $finalpay=$totalfee-$dis2;
   }
  if($head=='4'){
  echo $finalpay=$totalfee-$dis2;
   }
  if($head=='5'){
  echo $finalpay=$totalfee-$dis2;
   }
  if($head=='6'){
   echo $finalpay=$totalfee-$dis2;
} ?>
              /-</td>
          </tr>



          <tr>



            <td>4.</td>



            <td><div align="left">Dues Amount on <?php echo $roww_fep['pay_date']; ?></div></td>



            <td><?php echo $dues=$finalpay-$pay26; ?>/-</td>
          </tr>
<?php if($college!="557"){ ?>
        </table></td>
      </tr>

        
 <?php } ?>

      <tr>
        <td style="border-bottom:2px #000000 double;">&nbsp;</td>
      </tr>
      <tr>
        <td><table width="100%" border="0" cellspacing="0" cellpadding="0">
          <tr>
            <td width="50%"><strong>Deposited Fee</strong></td>
            <td width="50%"><div align="right"><strong>Depositor's Signature</strong></div></td>
          </tr>
        </table></td>
      </tr>
    </table></td>  </tr>
</table>
</body>
</html>
