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

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

<?php





 $branch=$_SESSION['branch'];



 $sql = "SELECT std.student_id, std.first_name,std.last_name,std.father_name,std.cell_no,std.image,std.status,std.branch_id,std.class_id,std.candidate_roll_no,std.ref_no,std.section_id,std.session_id,std.family_code,fee.student_id,fee.std_tution_fee,fee.discount_reason  FROM eduportal_student_fee_structure as fee, edu_student_details as std WHERE fee.student_id=std.student_id and fee.class_id=std.class_id and std.status='0' and std.branch_id=".$_SESSION['branch']. " ";



  if($_REQUEST['fee']!=''){

      $sql .= " AND fee.std_tution_fee =" . $_REQUEST['fee']. " ";

 }

  

    

   if($_REQUEST['year']!=NULL){

    $sql .= " AND fee.year = '" .$_REQUEST['year']. "' ";

  }else {

    $sql .= " AND fee.year = '" .date("Y"). "' ";

  }

  



  $sql .= " GROUP BY fee.student_id ";

 // print_r($sql);



  $WorkAssignListings = $m->query($sql);

 

     ?>





<!DOCTYPE html>

<html lang="en">

  <head>

    

    <title>Search Students with Fee | EduPortal</title>

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

   

  </head>

  









  <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="" 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;  



          Search Students With Fee

           

            

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

  <div class="container">



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

      <form class="" action="students_fee.php" enctype="multipart/form-data" method="get">

        <div class="panel panel-default">

          <div class="panel-heading"><?php echo count($WorkAssignListings);?> Students Records <span style="float:right;margin-top: -7px;">



          <input type="hidden" value="<?php echo session_id().session_id().session_id().session_id().session_id(); ?>" name="session" />



<div class="pull-right">         



 <?php 

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

?>



  <a target="_blank" title="Print Fee Report" href="print_report_zerofee.php?<?php echo session_id().session_id().session_id().session_id().session_id(); ?>&year=<?php echo $_GET['year'];?>&month_id=<?php echo $_GET['month_id'];?>&fee=<?php echo $_GET['fee'];?>&8lqc1oclfi4llgnioo156a61oe8lqc1oclfi4llgnioo156a61oe8lqc1" class="fa fa-print btn btn-primary">&nbsp;Print

    

  </a>



<?php 

}

?>











</div>



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

         

        </div>

      </form>

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

    </div>



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

      



<form class="form-style-7" action="students_fee.php" method="get"  enctype="multipart/form-data">


<!-- 
  <input type="hidden" id="session"  name="session" value="<?php echo $_GET['session']; ?>" />
 
  <input type="hidden" id="date"  name="date" value="<?php echo $_GET['date']; ?>" />
 -->


      

              



              <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">Monthly Fee</label>

                

                  <input class="form-control" type="text" name="fee"  id="fee" style="height:40px;"  value="<?php echo $_GET['fee'];?>" required>

                </div>

              </div>

 



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

    

        

                <div class="form-group ">

                   

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

                </div>



        

              </div>





    <table id="listofstudents" data-page-length='100' class="table table-striped table-bordered" style="width:100%">

          

         <thead>

            <tr>

                <th width="3%" class=" center"> S.No</th>

                <th width="25%" class="center"> Name</th>

                <th width="25%" class="center"> F.Name</th>

                <th width="10%" class=" center"> Roll No </th>  

                <th width="15%" class=" center"> Class</th>

                <th width="10%" class=" center"> Adm No </th>  

                <th width="7%" class=" center" > Monthly Fee </th>  

                <th width="10%" class=" center"> Reason </th>  

                

                

                 

            </tr>

        </thead>

        <tbody>

  <?php 

$count=1;

      foreach($WorkAssignListings as $WorkAssignListVal)

      { 

   

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

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

         

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

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



       $total_fee=$total_fee+$WorkAssignListVal['std_tution_fee'];

      

     ?>

        <tr> 

                <td class="center"> <?php echo $count; $count++;?> </td>

                  <td style="padding-left:1%;"><?php echo $WorkAssignListVal['first_name'];  ?></td>

                  <td style="padding-left:1%;"><?php echo $WorkAssignListVal['last_name'];  ?></td>

                  <td class="center">  <?php echo $WorkAssignListVal['candidate_roll_no'];?>  </td>                  

                  <td style="padding-left:1%;"><?php echo  $class[0]['Class_Name'];  ?></td>

                  <td class="center">  <?php echo $WorkAssignListVal['ref_no'];?>  </td>                  

                  <td class="center" >  <?php echo 0+$WorkAssignListVal['std_tution_fee'];?> </td>

                  <td class="center">  <?php echo $WorkAssignListVal['discount_reason'];?>   </td>                  

                                 

              </tr>



       <?php } ?>



        <tr>

        <th colspan="6" class="center borderTop">Total</th>

        <th colspan="2" class="center borderTop" style="border-right: 1px solid lightgray;"><?php echo number_format($total_fee);?></th> 



       </tr>

           

            

           

        </tbody>

        

    </table>



</form>

</div>



    <br><br>





  </div>

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

</section>



           

          </div>

        </div>



            </div>

          </div>

        </div>

        <!-- /page content -->

  



    

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



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

    <script>

        $(document).ready(function() {

        $('#listofstudents').DataTable();

        } 

        );

    </script>

  </body>

</html>

