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

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



<?php



 $month;

 

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



      $month= $_GET["month"];

    }

    else{

      $month= date("m");

    }

   

   $sessionIDs;



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



      $sessionIDs=$_REQUEST['session'];

      

    }else {

      

      $sessionIDs=$_SESSION['current_session'];

    }

 

   $Year;



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



      $Year=$_REQUEST['year'];

      

    }else {

      

      $Year=date("Y");

    }







       $branch=$_SESSION['branch'];

       $classes = $m->query("select * from edu_class_config where branch_id=".$branch." order by class_id asc limit 1");

       // print_r($classes);

     /* code for advance Search*/



$sql = "SELECT * FROM  edu_student_details  WHERE branch_id='$branch' and status='0'";



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



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

      $sql;

    } else {

    $sql .= " AND class_id = '" .$_REQUEST['class_id']. "' ";



    }



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

      $sql .= " AND section_id ='" . $_REQUEST['section']. "' ";

 }





 // echo $sql;



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

} else {

 

  $sql = "SELECT * FROM  edu_student_details  WHERE branch_id='$branch' and status='0'";



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

}



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

  $class_fee = $m->get("eduportal_class_fee_details");

  $class_standerd_fee=$class_fee[0]['tution_fee'];*/



 ?>



<!DOCTYPE html>

<html lang="en">

  <head>

   

    <title> Fee Discount Report | 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="row" style="background-color: white;">

  



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

  <div class="container">





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



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



          Discount Reports



      <form class="" action="fee_discount_report.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;">



          

        <div class="pull-right">         



          

        <?php 

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

        ?>



         <a href="print_fee_disc_report.php?<?php echo session_id().session_id().session_id().session_id().session_id(); ?>&month=<?php echo $_GET['month'];?>&year=<?php echo $_GET['year'];?>&section=<?php echo $_GET['section'];?>&class_id=<?php echo $_GET['class_id'];?>" target="_blank" class="fa fa-print btn btn-warning" style="padding: 10px;">&nbsp;Print Report            

          </a> 

        <?php } ?>

        </div>





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

          <div class="panel-body">

          

            <div class="col-md-12">

            

              <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="getsec(this.value)" class="form-control" >

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

                      

                   <?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 col-xs-12" style="padding: 8px;">

                <div class="form-group ">

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

                  <select name="year" class="form-control" required>

                    <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="month" class="form-control"  required>



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

                        



                        <?php

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

                        foreach($WorkAssignList as $WorkAssignListVal)

                        { ?>



                           <option <?php if($month==$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 ">
                    <input type="hidden" name="addaccountAdmin" value="1">
                    <button type="submit" class="btn btn-primary" style="margin-top: 1.7em;">Search</button>
                  </div>
                </div>




             

            </div>

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

          </div>

        </div>

      </form>

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

    </div>

    <br>



     

         

 



<form action="manage_students.php" enctype="multipart/form-data" method="post">





<input type="hidden" value="<?php echo $_REQUEST['class_id']; ?>" name="class_id" />

<input type="hidden" value="<?php echo $_REQUEST['section']; ?>" name="section" />





<div style="">



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

  

   

        <thead>

            <tr>



              

                <th width="5%">S.No</th>

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

                <th width="15%">Father Name</th>

                <th width="10%">Class Name</th>

                <th width="10%"> Month </th>

                <th width="10%"> Standared Fee </th>

                <th width="10%"> Discount </th>

                



                

                

            </tr>

        </thead>

        <tbody>





   

     

     <?php 

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

$count=1;

      foreach($WorkAssignListings as $WorkAssignListVal)

      { 



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

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

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

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

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



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

          

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

        $class_fee = $m->get("eduportal_class_fee_details");

        $class_standerd_fee=$class_fee[0]['tution_fee'];



        } else {

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

        $class_fee = $m->get("eduportal_class_fee_details");

        $class_standerd_fee=$class_fee[0]['tution_fee'];



        }



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

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



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

        $sessionIDs=$m->get("edu_session_config");



        $discAmt=$class_standerd_fee-$challanFee[0]['tutionfee'];

        if ($discAmt==0) {

            

            continue;

        }

        

      ?>



        <tr>



          <td style="text-align:center; padding: 2px;"><?php echo $count++;?></td>        



          <td style="padding: 2px;" ><?php echo $WorkAssignListVal['first_name'];?></td>

                

          <td style="padding: 2px; "> <?php echo $WorkAssignListVal['last_name'];?> </td>



          <td style="text-align:center; padding: 2px;">

                   <?php echo getClassName($m,$WorkAssignListVal['class_id']);?>

                   (<?php echo getSectionName($m,$WorkAssignListVal['section_id']);?>)

          </td>



          <td style="text-align:center; padding: 2px;"> <?php echo getMonthName($m,$month);?></td>

          <td style="text-align:center; padding: 2px;">

                   <?php echo $class_standerd_fee;?>

          </td>

                  

          <td style="text-align:center; padding: 2px;"><?php echo $discAmt;?> </td>





          </tr>



<?php } } else { ?>



  <div  style="display:block;" class="alert alert-danger alert-dismissible">

      <a href="#" class="close" data-dismiss="alert" aria-label="close">×</a>

       <strong>Warning !</strong> Please select Class and serarch for discount report  !!!

  </div> <?php } ?>

 

        </tbody>

        

    </table>



  </div>



    </form>



    <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() {

    $('#listofstudents').DataTable({

      "pageLength": 100

    });

    } 

  );



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



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

  });





</script>

  

  </body>

</html>

