<?php include "header_with_out_nav.php"; 


session_start();

		$login_session=$_SESSION['login_user']; 
$btnSave=$_GET['btnSave'];



$college_id=$_GET['college_id'];



$course_name=$_GET['course_name'];



$subject=$_GET['subject'];



$college_type=$_GET['college_type'];



$Course_Details=$_GET['Course_Details'];



$Gender=$_GET['Gender'];



$Category=$_GET['Category'];



$feesview=$_GET['feesview'];







if($login_session!=''){

echo "sdfdssd";

?>



<style>



body{



text-transform:uppercase;



font-size:12px;



}



.style1 {font-weight: bold}

</style>



<br /></br>



<?php if($btnSave==""){ ?>



<form name="form1" action="subject_wise_report.php" method="get"  class="form-horizontal" role="form">



	  <table cellpadding=2 cellspacing=0 border=1 bordercolor=#FFFFCC bgcolor="" align=center class="table table-bordered table-striped">



				



		<tr>



		  <td colspan="2" bgcolor="#990000" class=color3 style="color:">Print Data</td>



		  </tr>



		<tr>



          <td class=color3>Select College</td>



		  <td class=color2><?php



							



$queryy = "SELECT * FROM college_name where code='$code'";



$numresultsy=mysql_query($queryy);



$resulty= mysql_query($queryy) or die("Couldn't execute query");



?>



              <select name="college_id" id="college_id" required onchange='this.form.submit()'>



                <option value="">Select</option>



                <?php



while ( $a_roww = mysql_fetch_row( $resulty ) )



 {?>



                <option



                 <?php 



				 $cn_id=$a_roww[2];



				 if($cn_id==$college_id){



				  ?>selected<?php } ?>



                  



                   value="<?php echo $a_roww[2];?>" >( <?php echo $a_roww[2];?> ) <?php echo $a_roww[1];?></option>



                <?php } ?>



            </select></td>



		  </tr>



		<tr>



          <td width="116" class=color3>College Type</td>



		  <td width="190" class=color2><select name="college_type" required="required" onchange='this.form.submit()'>



             <?php
$query = "SELECT * FROM ctype where session='$session' and code='$code' ORDER BY id";
$numresults=mysql_query($query);
 $numrows=mysql_num_rows($numresults);
$result = mysql_query($query) or die("Couldn't execute query");
while ( $a_row = mysql_fetch_row( $result ) )

 {?>
          <option value="<?php echo $rty=$a_row[1]; ?>" <?php 
				 if($college_type==$rty){
				  ?>selected<?php } ?>><?php echo $a_row[2]; ?></option>
<?php } ?>



            </select>          </td>



		  </tr>



		



		<tr>



          <td class=color3> Course Name</td>



		  <td class=color2>



          <select name="course_name"  required onchange='this.form.submit()' class="chosen-select form-control">



                                            



                                            <?php $queryy = "SELECT * FROM course_name where college_id='$college_id' && ctype='$college_type' and session='$session' and code='$code'  Order by id";



$numresultsy=mysql_query($queryy);



$resulty= mysql_query($queryy) or die("Couldn't execute query");



 ?>



	<option value="">Select</option>



	 <?php



while ( $a_roww = mysql_fetch_row( $resulty ) )



 {?>



                  <option 



                 <?php 



				 $Course_id=$a_roww[0];



				 if($Course_id==$course_name){



				  ?>selected<?php } ?> 



                  value="<?php echo $a_roww[0];?>" ><?php echo $a_roww[1];?></option>



                  <?php } ?>



</select>         </td>



		  </tr>



          <tr>



		  <td class=color3>Select Year</td>



		  <td class=color2><select name="Course_Details" title="Select  Year/Semester" class="chosen-select form-control" required>



	



     <?php $queryy = "SELECT * FROM seme_year where course_name='$course_name' and session='$session' and code='$code' Order by id";



$numresultsy=mysql_query($queryy);



$resulty= mysql_query($queryy) or die("Couldn't execute query");



 ?>



	<option value="">Select</option>



	 <?php



while ( $a_roww = mysql_fetch_row( $resulty ) )



 {?>



                  <option



                 <?php 



				 $Course_Detailss=$a_roww[1];



				 if($Course_Detailss==$Course_Details){



				  ?>selected<?php } ?>



                  



                   value="<?php echo $a_roww[1];?>" ><?php echo $a_roww[1];?></option>



                  <?php } ?>



    



    



</select></td>



	    </tr>



		<tr>



		  <td class=color3>Subject Name</td>



		  <td class=color2>



           <select name="subject"  onchange='this.form.submit()' class="chosen-select form-control">



                                            



                                            <?php $queryy = "SELECT * FROM subject where college_code='$college_id' && college_type='$college_type' && course_name='$course_name' and session='$session' and code='$code' Order by id";



$numresultsy=mysql_query($queryy);



$resulty= mysql_query($queryy) or die("Couldn't execute query");



 ?>



	



    <option <?php 



				 



				 if($subject==''){



				  ?>selected<?php } ?> value="">All</option>



	 <?php



while ( $a_roww = mysql_fetch_row( $resulty ) )



 {?>



                  <option 



                 <?php 



				 $Course_id=$a_roww[1];



				 if($Course_id==$subject){



				  ?>selected<?php } ?> 



                  value="<?php echo $a_roww[1];?>" ><?php echo $a_roww[1];?></option>



                  <?php } ?>



</select>        </td>



		</tr>



       



        <tr>



          <td class=color3>Gender</td>



          <td class=color2>



          <select name="Gender" title="Gender" class="chosen-select form-control">



          <option value="">All</option>



          <option value="Male">Male</option>



          <option value="Female">Female</option>



          </select></td>



        </tr>



       



        <tr>



          <td class=color3>Caste</td>



          <td class=color2><select name="Category" title="Category" class="chosen-select form-control">



          <option value="">All</option>



          <option value="Gen">Gen</option>



          <option value="OBC">OBC</option>



          <option value="SC">SC</option>



          <option value="ST">ST</option>



          </select></td>



        </tr>



        <tr>



          <td class=color3>View Fee</td>



          <td class=color2><input type="checkbox" name="feesview" id="feesview" /></td>



        </tr>



        <tr> 



			<td class=color3></td>



			<td class=color2><input type="submit" name="btnSave" value="Get  List"  class="btn btn-info" ></td>



		</tr>



	</table>



</form>



<?php }else { ?>



<br/>



<center><a href="subject_wise_report.php" style="font-size:16px; text-align:center; background-color:#FF0000; color:; padding:5px;">BACK TO SEARCH</a></center><br/>







<table width="100%" border="1" cellspacing="0" cellpadding="2" class="table table-bordered table-striped">



  <tr>



    <td><strong>S.NO</strong></td>



    <td>E.F.V.</td>



    <td>S.F.V.</td>



    <td><strong>COLLEGE CODE</strong></td>



    <td><strong>COURSE NAME</strong></td>



    <td><strong>ROLL NO</strong></td>



    <td bgcolor="#00CC00" style="background-color:#00CC00;">Uni Roll</td>

    <?php if($feesview!=''){  ?>



   <td bgcolor="#00CC00" style="background-color:#00CC00;"><span >Total Course Fee</span></td>



    <td bgcolor="#00CC00" style="background-color:#00CC00;"><span >Discount</span></td>



    <td bgcolor="#00CC00" style="background-color:#00CC00;">DISCOUNT-CODE</td>

    <td bgcolor="#00CC00" style="background-color:#00CC00;"><span >Course Adj. Fees</span></td>



    <td bgcolor="#00CC00" style="background-color:#00CC00;"><span >Pay Fees</span></td>



    <td bgcolor="#00CC00" style="background-color:#00CC00;"><span >Dues</span></td>



    <?php } ?>



    <td><strong>STUDENT NAME</strong></td>



    <td><strong>FATHER NAME</strong></td>



    <td><strong>STUDENT TYPE</strong></td>



    <td><strong>GENDER</strong></td>



    <td>Aadhar Card</td>
    <td><strong>CASTE</strong></td>



    <td><strong>Mobile</strong></td>



    <td><strong>SUBJECT NAME</strong></td>
  </tr>



    <?php



    



$query = "SELECT * FROM class2 WHERE college='$college_id' and `CourseType`='$college_type' and `Course`='$course_name' and `Course_Details`='$Course_Details' and class_app LIKE '%$subject%' and college_roll!='' and status = 'Locked' and Gender LIKE '$Gender%' and  Category LIKE '%$Category%' and session='$session' and code='$code' order by id";



$numresults=mysql_query($query);



 $numrows=mysql_num_rows($numresults);



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







?>



<?php 



$counter = 1;?>



 <?php



while ( $a_row = mysql_fetch_array( $result ) )



 {



 $rpp=$a_row['college_roll']; 



 $fnoo=$a_row['fno']; 



	 $queryyu = "SELECT * FROM fverify where croll_on='$rpp' and session='$session' and code='$code'";



$numresultsyu=mysql_query($queryyu);



$resultyu= mysql_query($queryyu) or die("Couldn't execute query");



$a_rowwu = mysql_fetch_row($resultyu); 



$sff=$a_rowwu[2];







 $rpp=$a_row['college_roll']; 



	 $queryyus = "SELECT * FROM sfverify where croll_on='$rpp' and session='$session' and code='$code'";



$numresultsyus=mysql_query($queryyus);



$resultyus= mysql_query($queryyus) or die("Couldn't execute query");



$a_rowwus = mysql_fetch_row($resultyus); 



$ssff=$a_rowwus[2];



 ?>



  <tr>



    <td><?php echo $counter; ?></td>



    <td <?php if($sff==''){ ?>style="background-color:#FF0000"<?php } ?> ><?php



echo $sff;



?></td>



     <td <?php if($ssff==''){ ?>style="background-color:#FF0000"<?php } ?> ><?php



echo $ssff;



?></td>



    <td><?php echo $a_row['college']; ?></td>



    <td><?php 



	$idd=$a_row['Course'];



											$queryy = "SELECT * FROM course_name where id='$idd' and session='$session' and code='$code'";



$numresultsy=mysql_query($queryy);



$resulty= mysql_query($queryy) or die("Couldn't execute query");



$a_roww = mysql_fetch_row( $resulty );



echo $a_roww[1];



	



 ?>-<?php echo $a_row['Course_Details']; ?></td>



    <td><?php echo $a_row['college_roll']; ?></td>



     <td style="background-color: #99FFFF;"><span class="style1">

      <?php $check_exist_qryxre="select * from uroll where form='$sff' and session='$session' and code='$code'";



$run_qryxre=mysql_query($check_exist_qryxre);



$total_foundxre=mysql_num_rows($run_qryxre);



$rowwxre = mysql_fetch_array($run_qryxre, MYSQL_BOTH);



	echo $roll=$rowwxre['roll'];

 ?>

     </span></td>

     <?php if($feesview!=''){  ?>


<?php 

								



$queryx = "SELECT * FROM fees where class='$course_name' and section='$Course_Details' and code='$college_id' and session='$session' and code='$code'";
$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];
$fees_2=$a_rowx[4];
$fees_8=$a_rowx[8];
$fees_9=$a_rowx[9];
$fees_10=$a_rowx[10];
$fees_11=$a_rowx[11];
$fees_12=$a_rowx[12];
//////////////////////////////////////////////
$check_exist_qryfe="select * from class2 where fno='$fnoo' 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);
$str = $roww_fe['class_app']; 
$college_codex = $roww_fe['college'];
$CourseTypex = $roww_fe['CourseType'];
$last_coll = $roww_fe['last_coll'];
if($str!=""){
$class_app=explode(",",$str);
foreach ($class_app as $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='$code'";
$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;
}
if(($numrows!="")&&($pra_chk="P")){
$a;
$a++;
}
}}
$fees_2=$fees_2*$a;
$fees_9=$fees_9*$a;
$gtotalp=$fees_2+$fees_9;
$tofees=$fees_8+$fees_10+$fees_11+$fees_12+$gtotalp;
$roll=$a_row['college_roll'];				
$queryy = "SELECT * FROM pay_fees where roll_no='$roll' and session='$session' and code='$code'";
$numresultsy=mysql_query($queryy);
$resulty= mysql_query($queryy) or die("Couldn't execute query");
?>
<?php
while ( $a_rowd = mysql_fetch_row( $resulty ) )
{?>
<?php
$dis1=$a_rowd[5];
$pay1=$a_rowd[4];
$pay2+=$pay1;
$dis2+=$dis1;  
} 
?>

<?php

			    $s1=$tofees-($dis2+$ds);



			   $dues3=$s1-$pay2;



			  



  ?>


    <td style="background-color: #99FFFF;">  <div align="right"><strong>

<?php echo $tofees; ?>

        </strong></div></td>



    <td style="background-color: #99FFFF;"> <div align="right"><strong>



      



      <?php echo $dis2; ?>  </strong></div></td>



    <td style="background-color: #99FFFF;"><?php echo $ds; ?></td>

    <td style="background-color: #99FFFF;"><div align="right"><strong><?php echo $s1; ?></strong></div></td>



    <td style="background-color: #99FFFF;"><div align="right"><strong><?php echo $pay2; ?></strong></div></td>



    <td style="background-color: #FFCCFF;"><div align="right"><strong><?php echo $dues3; ?></strong></div></td>



    <?php } ?>



    <td><?php echo $a_row['StudentName']; ?></td>



    <td><?php echo $a_row['FatherName']; ?></td>



    <td><?php echo $a_row['Student_Type']; ?></td>



    <td><?php echo $a_row['Gender']; ?></td>



    <td><?php echo $a_row['acard']; ?></td>
    <td><?php echo $a_row['Category']; ?></td>



    <td><?php echo $a_row['MobileNO']; ?></td>



    <td><?php echo $a_row['class_app']; ?></td>
  </tr>



  



  <?php $counter++;



  $dis221+=$dis2;

$ds789+=$ds;

  $pay221+=$pay2;  



  $pay2=0;



  $dis2=0;



  $pra_chk=0;



$tofeesd+=$tofees;



$s1f+=$s1;



$dues33+=$dues3;



$a=0;



   } ?><?php } ?>



   <tr>



    <td>&nbsp;</td>



    <td>&nbsp;</td>



    <td>&nbsp;</td>



    <td>&nbsp;</td>



    <td>&nbsp;</td>



    <td>&nbsp;</td>



     <td bgcolor="#FFFF33">&nbsp;</td>

     <?php if($feesview!=''){  ?>



    <td bgcolor="#FFFF33"><div align="center" class="style4">



        <div align="right"><?php echo $tofeesd; ?></div>



    </div></td>



    <td bgcolor="#FFFF33"><div align="center" class="style4">



        <div align="right"><?php echo $dis221; ?></div>



    </div></td>



    <td bgcolor="#FFFF33"><?php echo $ds789; ?></td>

    <td bgcolor="#FFFF33"><div align="center" class="style4">



        <div align="right"><?php echo $s1f; ?></div>



    </div></td>



    <td bgcolor="#FFFF33"><div align="center" class="style4">



        <div align="right"><?php echo $pay221; ?></div>



    </div></td>



    <td bgcolor="#FFFF33"><div align="center" class="style4">



        <div align="right"><?php echo $dues33; ?></div>



    </div></td>



    <?php } ?>



    <td>&nbsp;</td>



    <td>&nbsp;</td>



    <td>&nbsp;</td>



    <td>&nbsp;</td>



    <td>&nbsp;</td>
    <td>&nbsp;</td>



    <td>&nbsp;</td>



    <td>&nbsp;</td>
  </tr>
</table>



<?php }



include "footer.php"; ?>