<?php include("parent/callMe.php"); ?>

<?php  include("sessioncheck.php"); ?>

<?php



// settings month details



  $default;

 

  if($_GET["month"]!=NULL ){



      $default= $_GET["month"];

    }

    else{

      $default= date("m");

    }

  

    $sessionId;

 

  if($_GET["month"]!=NULL ){



      $sessionId= $_GET["session"];

    }

    else{

      $sessionId= $_SESSION['current_session'];

    }



$year;

  if($_GET["year"]!=NULL ){

      $year= $_GET["year"];

    }else {

      $year= date("Y");

    }

 $m->where("status", '0');

 $m->where("class_id", $_REQUEST['class_id']);

 if ($_REQUEST['section']!="All") {

 $m->where("section_id", $_REQUEST['section']);

 } 

 $m->where("branch_id", $_SESSION['branch']);

 $m->where("session_id", $sessionId);

 $WorkAssignListings = $m->get("edu_student_details");





$m->where("Month_Id", $default);

$month_name=$m->get("eduportal_month_config");

 

     ?>





<!DOCTYPE html>

<html lang="en">

  <head>

    

    <title>Fee Records | EduPortal</title>

    <?php include('RootMe/css_links.php');?>

   

  <style>



.cellcolor{background-color:lightgray;border:1px solid black;}



</style>

  </head>

  



<script type="text/javascript">



function getsecAll(id){



    if (window.XMLHttpRequest) {



      // code for IE7+, Firefox, Chrome, Opera, Safari



      xmlhttp=new XMLHttpRequest();



    } else { // code for IE6, IE5



      xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");



    }



    xmlhttp.onreadystatechange=function() {



      if (xmlhttp.readyState==4 && xmlhttp.status==200) {



        document.getElementById("txt_section").innerHTML=xmlhttp.responseText;

        // alert(xmlhttp.responseText);



      }



    }



    xmlhttp.open("GET","get_section_all.php?class_id="+id,true);



    xmlhttp.send();









  }





</script>





  <body class="nav-md">

    <div class="container body">

      <div class="main_container">

        <div class="col-md-3 left_col">
   

            <?php include('RootMe/sidebar.php');?>

            <?php include('RootMe/header.php');?>


        <!-- page content -->

          <div class="right_col" role="main">

          <div class="row" style="background-color: white;">



            <a href="<?php echo $_SESSION['dashboard'];?>" style="margin-left: 33px;">Dashboard </a> &nbsp; <i style="" class="fa fa-angle-double-right"></i>  &nbsp;



          <a href="multi_fee_reports.php">Fee Reports </a> &nbsp; <i style="" class="fa fa-angle-double-right"></i>  &nbsp;  



          Fee Records

           

  <section class="add_sub_agent" id="table_sub_agent">

  <div class="container">



 <div class="" style="margin-top:10px;">

      

      <div class="clearfix"></div>

    </div>



<div style="overflow-x:auto;">

      



<form class="form-style-7" action="fee_records.php" method="Get">  



              

              <!-- <div class="col-md-2 col-sm-12 col-xs-12" style="padding: 8px;">

                <div class="form-group ">

                  <label class="required">Name</label>

                                                 

                    <input type="text" name="name" value="" style="height: 40px;"class="form-control">                    

                </div>

              </div>



              <div class="col-md-2 col-sm-12 col-xs-12" style="padding: 8px;">

                <div class="form-group ">

                  <label class="required">Roll No</label>

                                                 

                    <input type="text" name="roll" value="" style="height: 40px;"class="form-control">                    

                </div>

              </div> -->


              <div class="col-md-2 col-xs-12" style="padding: 8px;">

                <div class="form-group ">

                  <label class="required">Year</label>

                   <select name="year" class="form-control" style="height: 40px;">

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

                    <?php

                    $match;

                    if(!isset($_REQUEST['year'])){

                      $match=date("Y");

                    }else { $match=$_REQUEST['year']; }

                    for($i=2018;$i<2031;$i++){ ?> 

                      <option <?php if($match==$i){echo 'selected';}?> value="<?php echo $i; ?>"><?php echo $i; ?></option>

                    <?php } ?>  

                  </select>

                </div>

              </div>




              <div class="col-md-2 col-xs-12" style="padding: 8px;">

                <div class="form-group ">

                  <label class="required">Month</label>

                      <select name="month_id" id="month_id" class="form-control" required style="height: 40px;">

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

                      <?php

                      $WorkAssignList = $m->get("eduportal_month_config");

                      foreach($WorkAssignList as $WorkAssignListVal){ ?>

                      <option <?php if($_REQUEST['month_id']==$WorkAssignListVal['Month_Id']){echo 'selected';}?> value="<?php echo $WorkAssignListVal['Month_Id']; ?>"><?php echo $WorkAssignListVal['Month_Name']; ?></option>


                      <?php } ?>

                      </select>

                </div>

              </div>



              



              <div class="col-md-2 col-xs-12" style="padding: 8px;">

                <div class="form-group ">

                  <label class="required">Class</label>



            

                    <select name="class_id" onChange="getsecAll(this.value)" class="form-control" style="height: 40px;" >

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

                    <?php

                    $m->where("branch_id", $_SESSION['branch']);

                    $WorkAssignList = $m->get("edu_class_config");

                    foreach($WorkAssignList as $WorkAssignListVal)

                    { ?>



                       <option <?php if($_REQUEST['class_id']==$WorkAssignListVal['class_id']){echo 'selected';}?> value="<?php echo $WorkAssignListVal['class_id']; ?>"><?php echo $WorkAssignListVal['Class_Name']; ?></option>





                            <?php

                    } ?>



                    </select>



                  

                </div>

              </div>



              <div class="col-md-2 col-xs-12" style="padding: 8px;">

                <div class="form-group ">

                  <label class="required">Section</label>

                    <select name="section" id="txt_section" class="form-control" style="height: 40px;">

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

                   <?php

                              if($_REQUEST['section']!='')

                              { 



                              $m->where("class_id", $_REQUEST['class_id']);    



                              $secondLevel = $m->get("edu_adm_section_detail");

                              

                              foreach($secondLevel as $secondLevel_val)

                              {

                              

                               ?>

                                <option <?php if($_REQUEST['section']==$secondLevel_val['section_id']){echo "selected";} ?> value="<?php echo $secondLevel_val['section_id']; ?>"><?php echo trim(utf8_encode_all($secondLevel_val['section_name'])); ?></option>



                              <?php }   ?>

                                

                          <?php } ?>



                    </select>



                  

                </div>

              </div>

 



              <div class="col-md-2 " style="padding:2px;">

    

        

                <div class="form-group ">

                   

                <button id=""  type="submit" class="btn btn-primary" style="margin-top: 34px;">Search</button>



                <!-- <a href="payroll_report.php?<?php echo session_id().session_id().session_id().session_id().session_id(); ?>&month=<?php echo $_GET['month'];?>" id="subuser"target="_blank" class="btn btn-success" style="margin-top: 34px;">Print Report </a> -->



               

                </div>



        

              </div>



  <div class="col-md-4" style="padding: 2px; float: right; margin-top: 25px;">

    

  <a class="btn btn-#042954" style="background: #042954;float: left;color: white;">Paid </a>

  <a class="btn btn-#2C76DC" style="background: #2C76DC;float: left;color: white;">Not Paid</a>

  <a class="btn btn-#7B7D7D" style="background: #7B7D7D;float: left;color: white;">Challan Not Created</a>

 

</div>

             

</form>



    <table id="searchstudents" data-page-length='100' class="table table-striped table-bordered" style="width:100%;font-size:11px;">

 

 

          <thead>

          <caption style="font-size:20px;font-weight:bold;"><center>Student Fee Records</center>

          	<a href="" class=""></a>

          </caption>

          



            <tr>

              <th width="3%">Roll No/Adm</th>

              <th width="7%">Student Name</th>

<?php

              for ($months=1; $months<=12; $months++) {

     $monthName = date('F', mktime(0,0,0,$months, 1, date('Y')));

     ?>

     <th width="" style="padding-left:1px;"><?php echo $monthName."<br>".getSessionName($m,$_SESSION['current_session']); ?></th>

    <?php } ?> 



            </tr>

        </thead>

        <tbody>

     

     <?php

     

     $count=1; 



      foreach($WorkAssignListings as $WorkAssignListVal)

      { 







		        

        

      ?>





<tr>

        

      <td style="color: black;"><?php echo $WorkAssignListVal['candidate_roll_no']."/".$WorkAssignListVal['ref_no'];?></td>  

      <td style="color:black;">

        <a  href="pay_fee.php?student=<?php echo $WorkAssignListVal['student_id']; ?>" target="_blank" style="color:black;">

        <?php echo $WorkAssignListVal['first_name'];?></a> </td>



<?php 









for ($months=1; $months<=12; $months++) {



	$fee_types = $m->get("eduportal_fee_types");



		$m->where("classs_id", $_REQUEST['class_id']);

		$m->where("month_id", $months);

		$m->where("branch_id", $_SESSION['branch']);

    // $m->where("session_id", $sessionId);
    $m->where("year", $year);

    $m->where("student_id", $WorkAssignListVal['student_id']);

    $voucher=$m->get("eduportal_monthly_challan"); 

      $other_fees=0;

      foreach ($fee_types as $type) {

        $fees=getFeeOfOtherParameter($WorkAssignValue['student_id'],$voucher[0]['challan_id'],$type['feetype_id'],$m);

       if($fees!=""){        

               

          

          $other_fees+=$fees;

               



     } else continue; }



   $monthName1 = date("F", mktime(0, 0, 0, $months, 1, 0));

   

   $id=$WorkAssignListVal['student_id']; 



   $qr="select * from eduportal_monthly_challan where month_id='$months' and student_id='$id' and year = '$year' and year = '$year' and branch_id=".$_SESSION['branch'];

  // print_r($qr);

   $challan = $m->query($qr);

   $Total=$challan[0]['tutionfee']+$challan[0]['balance']+$challan[0]['transportfee']+$challan[0]['misc_fee']+ $other_fees;

?>



 

 <td  width="2%" style="padding:0px;text-align: center;font-weight: bold;color: white;padding-top: 9px; background-color:

      <?php 

      if($challan[0]['tutionfee']==NULL)

       { echo "#7B7D7D"; } 

     else if ($challan[0]['paid_status']==1) 

      {echo "#042954"; }



      else if ($challan[0]['paid_status']==0) 

      {echo "#2C76DC";}



    ?>"> <?php  if($challan[0]['tutionfee']!=NULL){echo $Total;}else {echo "--";};?> </td>

  



<?php } ?>







      



</tr>



<?php

      } ?>

     



        </tbody>

        

    </table>



  



</div>



    <br><br>





  </div>

  <div class="clearfix"></div>

</section>          

    



           

          </div>

        </div>



            </div>

          </div>

        </div>

        <!-- /page content -->

  



    

 <!-- jQuery -->

    <script src="js/ajax_functions.js"></script>

  <?php include('RootMe/js_linksscript.php');?> 

  <!-- Links for Datatable-->



<script src="https://cdn.datatables.net/1.10.13/js/jquery.dataTables.min.js"></script>

 <script>

        

  $(document).ready(function() {

    $('#searchstudents').DataTable({

      "pageLength": 100

    });

    } 

  );



  $("#checkAll").change(function () {



      $("input:checkbox").prop('checked', $(this).prop("checked"));

  });





</script>

  </body>

</html>

