<?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 WHERE fee.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['channelName']=="All"){
    
    } else {
     $sql .= " AND fee.paid_by = '" .$_REQUEST['channelName']. "' ";

    }

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


  if(isset($_REQUEST['from']) && isset($_REQUEST['to']) ){
     
      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.classs_id desc ";
    
    
 //echo $sql;

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

}


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

  // getting details of total records


       $records=0;
      foreach($WorkAssignListings as $WorkAssignListVal2)
      { 

  
      $totalAmount= $WorkAssignListVal2['tutionfee']+$WorkAssignListVal2['transportfee']+$WorkAssignListVal2['balance']+$WorkAssignListVal2['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;  

          Fee Collection
           
<section class="add_sub_agent" id="table_sub_agent">
  <div class="container">

    

              <!-- Modal -->
            <div id="PaidFee<?php echo $_GET['class_id'];?>-<?php echo $_GET['section'];?>" class="modal fade" role="dialog">


              <div class="modal-dialog">

                <!-- Modal content-->
                <div class="modal-content">

                   
               <form action="<?php echo DOMAIN.AgentDirectory;?>parent/InsertMe.php" method="post" enctype="multipart/form-data">

                  <input type="hidden" name="action" value="PrintPaidFeeParameterDatewise">
             
                  <div class="modal-header">
                    <button type="button" class="close" data-dismiss="modal">&times;</button>
                    <h4 class="modal-title"> Choose The Parametters To Display in Print Report </h4>
                  </div>
                  <div class="modal-body">
                    
                  <input type="hidden" name="class_id" value="<?php echo $_GET['class_id'];?>" />
                  <input type="hidden" name="section" value="<?php echo $_GET['section'];?>" />
                  <input type="hidden" name="session" value="<?php echo $_GET['session'];?>" />
                  <input type="hidden" name="month" value="<?php echo $_GET['month'];?>" />
                  <input type="hidden" name="from" value="<?php echo $_GET['from'];?>" />
                  <input type="hidden" name="to" value="<?php echo $_GET['to'];?>" />
                  <input type="hidden" name="fee" value="<?php echo $_GET['fee'];?>" />
                  <input type="hidden" name="others" value="<?php echo $_GET['others'];?>" />
                  <input type="hidden" name="channelName" value="<?php echo $_GET['channelName'];?>" />

                  <input type="hidden" name="checkboxes[]"  value="1"  class="cb-element" />
                 
               
                  <br>             



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

                       <div class="form-group ">

                          <label class="required" style="font-size: 11px;">Display Other Parameters </label>
                              <select name="others" class="form-control"  >

                               <option <?php if($_GET['others']=="1"){echo 'selected';}?> value='1'>YES</option>
                                <option <?php if($_GET['others']=="0"){echo 'selected';}?> value='0'>NO</option>
                          
                              </select>
                            </div>

                    </div>

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

                       <div class="form-group ">

                          <label class="required" style="font-size: 11px;">Select Listing Order: </label>
                              <select name="orderBy"  id="orderBy" class="form-control" >
            
                               <option  value="alphabetic">Alphabetic</option>
                               <option  value="RollNoWise">Roll No Wise</option>
                               <option  value="Admascending">Adm# Ascending</option>
                                 
                              </select>
                            </div>

                    </div> -->

                <br><br><br><br><br>
  
                                    
                  <label class="container1" style="text-align: left;">
                    <input type="checkbox" name="student_name" checked value="1"/>
                    Student Name
                    <span class="checkmark"></span>
                  </label>

                  <label class="container1" style="text-align: left;">
                    <input type="checkbox" name="father_name" checked value="1"/>
                    Father Name
                    <span class="checkmark"></span>
                  </label>

                   <label class="container1" style="text-align: left;">
                    <input type="checkbox" name="class_sec" checked value="1"/>
                    Class/Sec
                    <span class="checkmark"></span>
                  </label>

                  <label class="container1" style="text-align: left;">
                    <input type="checkbox" name="roll_no" checked value="1"/>
                    Roll No
                    <span class="checkmark"></span>
                  </label>

                  <label class="container1" style="text-align: left;">
                    <input type="checkbox" name="adm_no" checked value="1"/>
                    Admission No
                    <span class="checkmark"></span>
                  </label>

                  <label class="container1" style="text-align: left;">
                    <input type="checkbox" name="cell_no" checked value="1"/>
                    SMS Reporting Number
                    <span class="checkmark"></span>
                  </label>                  

                  <label class="container1" style="text-align: left;">
                    <input type="checkbox" name="father_cellno" checked value="1"/>
                    Father Contact No
                    <span class="checkmark"></span>
                  </label>              

                  <label class="container1" style="text-align: left;">
                    <input type="checkbox" name="mother_cell" checked value="1"/>
                    Mother Contact No
                    <span class="checkmark"></span>
                  </label>

                  </div>
                  <div class="modal-footer" style="text-align: right;">
                    <input type="submit" class="btn btn-primary" checked value="Print" />
                  </div>

                   </form>
                </div>

              </div>
            </div>
            <!-- Modal -->

 <div class="" style="margin-top:10px;">
      
      <form class="" action="datewise_fee_collection_report.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" class="btn btn-success fa fa-print pull-right" style="height: 34px;padding: 9px;" title="Print Fee Report" data-toggle="modal" data-target="#PaidFee<?php echo $_GET['class_id'];?>-<?php echo $_GET['section'];?>">
    Print Report
  </a>

<?php 
}
?>      

<!-- <a target="_blank" href="print_daily_fee_report.php?session=gv7dus9tmrqlsae170i962isu1gv7dus9tmrqlsae170i962isu1gv7dus9tmrqlsae170i962isu1gv7dus9tmrqlsae170i962isu1gv7dus9tmrqlsae170i962isu1&class_id=All&session=<?php echo $_SESSION['current_session']; ?>&month=<?php echo date('m'); ?>&fee=1&from=<?php echo date('Y-m-d'); ?>&to=<?php echo date('Y-m-d'); ?>" class="btn btn-primary pull-left"> Daily Collection Report </a>

<a target="_blank" href="user_fee_collection.php" class="btn btn-primary pull-left"> Users Wise Fee Collection </a> -->

<a target="_blank" href="multi_fee_reports.php" class="btn btn-success pull-left"> Multi Fee Reports </a>

<a target="_blank" href="datewise_fee_collection.php" class="btn btn-danger pull-left"> Date Wise Total Collection </a>

<a target="_blank" href="user_fee_collection.php" class="btn btn-info ">User Wise Fee Collection</a>


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


<a style="height: 34px;padding: 9px;" href="export_excel.php?class_id=<?php echo $_GET['class_id'];?>&session=<?php echo $_GET['session'];?>&month=<?php echo $_GET['month'];?>&from=<?php echo $_GET['from'];?>&to=<?php echo $_GET['to'];?>&fee=<?php echo $_GET['fee'];?>&section=<?php echo $_GET['section'];?>" class="pull-right btn btn-success  fa fa-download pull-right"> Export To Excel </a>


<?php } ?> -->







</div>



          </span><div class="clearfix"></div> </div>
          <div class="panel-body">
          
            <div class="col-md-12"  >



            <div class="col-md-1 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">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 col-xs-12" style="padding: 8px;">
                <div class="form-group ">
                  <label class="required">Section</label>
                    <select name="section" id="txt_section" class="form-control"   >
                      <option value="All">All</option>
                   <?php
                              if(isset($_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" style="font-size: 11px;">Payment Method</label>
                              <select name="channelName" class="form-control"  >

                                <option value='All'>All</option>

                               <option <?php if($_GET['channelName']=="Cash"){echo 'selected';}?> value='Cash'>Cash</option>

                                <option <?php if($_GET['channelName']=="JazzCash"){echo 'selected';}?> value='JazzCash'>JazzCash</option>

                                <option <?php if($_GET['channelName']=="Easypaisa"){echo 'selected';}?> value='Easypaisa'>Easypaisa</option>

                                <option <?php if($_GET['channelName']=="BankAccount"){echo 'selected';}?> value='BankAccount'>Bank Account</option>

                                <option <?php if($_GET['channelName']=="UblOmni"){echo 'selected';}?> value='UblOmni'>Ubl Omni</option>
                          
                              </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 $_GET['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 $_GET['to'];?>" type="date" class="form-control"  >
                       
                          </div>
                  </div>   
                

              <div class="col-md-1 pull-right" style="padding:2px;">
                <div class="form-group ">
                   <input type="hidden" name="addaccountAdmin" value="1">
                <button type="submit" class="btn btn-primary" style="margin-top: 24px;float: right;">Search</button>
                </div>
              </div>

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

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

        <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 class & session from advance search to save fee 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="6%">DueDate </th>
                <th width="8%">Vocher No </th>
                <!-- <th width="8%" style="text-align:center;">  Monthly Fee </th>
                <th width="5%">Balance </th>
                <th width="8%">Other Fee </th>
                <th width="8%">Disc. </th>  -->              
                <th width="8%">Total </th>               
                <th width="10%">Status </th>
                <th width="6%">PAID </th>
                <th width="6%">Paid Again </th>
             <!--    <th width="6%">History </th>
                  <th width="5%">

              <label class="container1"><input  type="checkbox" id="checkAll"/><span class="checkmark" style="margin-top: -17px;"></span></label>
              
               </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");
echo $WorkAssignListVal['student_id']."<br>";
     /*   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;";}?>">  


<!-- these are the hidden fields... -->

<input  type="hidden"  value="<?php echo $totalAmount; ?>" id="totalAmount<?php echo $count;?>"/>
<input  type="hidden"  value="<?php echo $WorkAssignListVal['student_id']; ?>" id="student<?php echo $count;?>"/>

<input  type="hidden"  value="<?php echo $actual_fine; ?>" id="fine<?php echo $count;?>"/>

<input  type="hidden"  value="<?php echo $WorkAssignListVal['challan_id']; ?>" id="challan_id<?php echo $count;?>"/>

<input  type="hidden"  value="<?php echo $brid[0]['fee_recv_sms']; ?>"  id="fee_recv_sms<?php echo $count;?>"/>

<input  type="hidden"  value="<?php echo $brid[0]['double_confirmation_sms_to_principal']; ?>" id="double_confirmation_sms_to_principal<?php echo $count;?>"/>

<input  type="hidden"  value="<?php echo $student[0]['first_name']; ?>"  id="std_name<?php echo $count;?>"/>

<input  type="hidden"  value="<?php echo $student[0]['cell_no']; ?>"  id="std_no<?php echo $count;?>"/>
<input  type="hidden"  value="<?php echo $brid[0]['Owner_no']; ?>" id="Owner_no<?php echo $count;?>"/>
<input name="student_id[]" type="hidden" value="<?php  echo $WorkAssignListVal['student_id'];?>" />
<input name="tutionfee[]" type="hidden" value="<?php echo $WorkAssignListVal['tutionfee'];?>" />
<input name="transportfee[]" type="hidden" value="<?php echo $WorkAssignListVal['transportfee'];?>" />

<input name="balance[]" type="hidden" value="<?php echo $WorkAssignListVal['balance'];?>" />
   
<input id="month_name<?php echo $count;?>" value="<?php echo getMonthName($m,$_REQUEST['month']);?>"  type="hidden" />

    <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,$student[0]['class_id']);?>  </td>

    <td> <?php echo getMonthName($m,$WorkAssignListVal['month_id']);?> </td>                 
    <td> <?php echo date("d-M",strtotime($WorkAssignListVal['challan_duedate']));?> </td>
    <td style="text-align:center;"> <?php echo $WorkAssignListVal['challan_id'];?> </td>
    <!-- <td style="text-align:center;"> <?php echo $WorkAssignListVal['tutionfee'];?> </td>
    
    <td style="text-align:center;"> <?php echo $WorkAssignListVal['balance'];?> </td>
    <td style="text-align:center;"> 

 
      <a data-toggle="modal" data-target="#otherFee<?php echo $WorkAssignListVal['student_id'];?>" style="padding: 0px 4px; font-size:14px;"  class="btn btn-warning">

      <?php echo $others_fee;?>  

      </a> 
    </td>

  <td style="text-align:center;"><?php  echo $WorkAssignListVal['disc_amount']; ?>  </td> -->


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

          <td> 

      <?php if($totalAmount>0 && $WorkAssignListVal['paid_status']==0 ){ ?>     

          <a id="paynow<?php echo $count;?>" onClick="PayFullFee(<?php echo $count; ?>);" style="padding: 0px 5px; font-size:14px;"  class="btn btn-danger">

                  Pay Full<?php //echo $others_fee; ?>

          </a> 
          <!-- this paid button will appear only when we click on full pay fee -->

          <a id="fullpaid<?php echo $count;?>" style="padding: 0px 5px; font-size:14px;display:none;"  class="btn btn-success">

                  Fully Paid <i class="fa fa-check" aria-hidden="true"></i><i class="fa fa-check" aria-hidden="true"></i>

          </a>

         <?php } else { ?>    


          <a data-toggle="modal" style="padding: 0px 5px; font-size:14px;"  class="btn btn-success">

                  Paid <i class="fa fa-check" aria-hidden="true"></i>

          </a> 


         <?php } ?>   


                  </td>



                <td style="text-align:center;" >
                 
                  <input style="width:70px" class="form-control" readonly id="totalAmount_col<?php echo $count;?>" type="text" value=" <?php if($paid_fee!=NULL){echo $paid_fee;} else {echo "0";} ?>" />

                 </td>

                 <td style="text-align:center;" >
                 
                  <input style="width:70px" class="form-control" readonly id="totalagainAmount_col<?php echo $count;?>" type="text" value=" <?php if($again_paid_fee!=NULL){echo $again_paid_fee;} else {echo "0";} ?>" />

                 </td>

                <td> 
                
                 <a data-toggle="modal" data-target="#payChallan<?php echo $WorkAssignListVal['student_id'];?>" style="padding: 0px 5px; font-size:14px;"  class="btn btn-warning">
                  History  
                </a> 


      <!-- Modal -->
      <div id="otherFee<?php echo $WorkAssignListVal['student_id'];?>" class="modal fade" role="dialog">
        <div class="modal-dialog">

          <!-- Modal content-->
          <div class="modal-content" style="width: 900px;margin-left: -25%;">
            <div class="modal-header">
              <button type="button" class="close" data-dismiss="modal">&times;</button>
              <h4 class="modal-title"> Other Fee Parameters  </h4>
            </div>


            <div class="modal-body">



              <p> <?php echo $student[0]['first_name'];?>  <?php echo $student[0]['last_name'];?>  </b>
                (<?php echo getClassName($m,$WorkAssignListVal['class_id']);?>)

              </p>


            </div>


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

            <table border="1" width="100%">  


              <tr>  

                <th class="thStyle" style="text-align: center;padding:1%;"> Fee Type  </th>
                <th class="thStyle" style="text-align: center;padding:1%;"> Amount  </th>
              
              </tr>
<?php 

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

if(count($fee_types)<=0){
  echo "<tr> <td colspan='10' style='color:red;text-align:center;'> No record found ! </td> </tr> ";

}

 foreach ($fee_types as $type) {

  $fee=getFeeOfOtherParameter($WorkAssignListVal['student_id'],$WorkAssignListVal['challan_id'],$type['feetype_id'],$m);
  if($fee==NULL){
    continue;
  }

?>            
              <tr>  

                <td  style="text-align: center;padding:2%;"> <?php echo $type['feetype_name'];?> </td> 
                <td  style="text-align: center;padding:2%;"> <?php echo $fee;?> </td> 
                
              </tr>

<?php   } ?>

          
 
             </table>

          </div>

          <br><br>


            <div class="modal-footer">

             <button type="button" class="btn btn-default" data-dismiss="modal">Close</button>


            </div>



          </div>

        </div>
      </div>

      <!-- ending modal -->
   
           
           
           


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