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

//getting branch details 

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


$branch=getBranch($m);

$month_id=$_REQUEST['month'];
$monthid=date("m");
$branchID=$_SESSION['branch'];
$sessionID=$_SESSION['current_session'];



$sql = " select std.* from  edu_student_details as std where std.status='0' AND std.branch_id='$branchID' group by std.cell_no order by std.last_name asc";

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

//print_r($sql);
$total_fee;

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



$m->where("session_id", $_SESSION['current_session']);
$m->where("month_id", $_REQUEST['month']);
$m->where("student_id", $WorkAssignListings[0]['student_id']);
$DueDate=$m->get("eduportal_monthly_challan");

?>
  <!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">
<!-- Favicons-->
<link rel="icon" type="image/png" href="img/favicon.png" sizes="32x32" />
<title>Print Voucher</title>
<!-- Favicons-->
<link rel="icon" type="image/png" href="img/favicon.png" sizes="32x32" />
<script type="text/javascript">
 window.print();
</script>
<style> 

.section{width:95%; height:auto;float:left;border-right: 2px solid black;border-right-style:dotted;padding-right:2.5%;margin-left:2%;}
.box{
  width:100%;float:left;height:14.5cm;
}  
   
tr th {background-color:gray; text-align:center;font-size:14px;border:1px solid gray;padding:0%;}
tr td {border-bottom:1px solid gray;border-left:1px solid gray;height: 15px;padding:-2px;}



.tdalign{text-align:center;border:1px solid black;}
  

body {
  background: rgb(204,204,204);
  font-weight:bold; 
}
page {
  background: white;
  display: block;
  margin: 0 auto;
  margin-bottom: 0.5cm;
  border:1px solid black;
  box-shadow: 0 0 0.5cm rgba(0,0,0,0.5);
  padding:0%;
  height: 21cm; 
}
page[size="A4"] {  
  width: 21cm;
  height: 29.7cm; 
}
page[size="A4"][layout="landscape"] {
  width: 29.7cm;
  height: 21cm;  
}
page[size="A3"] {
  width: 29.7cm;
  height: 42cm;
}
page[size="A3"][layout="landscape"] {
  width: 42cm;
  height: 29.7cm;  
}
page[size="A5"] {
  width: 14.8cm;
  height: 21cm;
}
page[size="A5"][layout="landscape"] {
  width: 21cm;
  height: 14.8cm;  
}
@media print {
  body, page {
    margin: 0;
    box-shadow: none;
    border:none;
  }
}
  </style>

</head>
<body>

<?php 
$WorkAssignValue=$WorkAssignListings;
$valueStart=$_REQUEST['valueStart'];
$valueEnd=$_REQUEST['valueEnd'];

for($k=$valueStart;$k<=$valueEnd;$k++){

 


?>

<page size="A4">

<div style="float:left;width:100%;">
<?php 

 $array1=array("Institute Copy","Student Copy");

 ?>

<div class="box" >

<div class="section" style="font-size:12px;<?php if($i==1){echo 'border-right:none;';}?>">
   
   <div style="width:100%; text-align:center; height:auto;font-size:12px;">
            <?php echo $array1[$i];?>

   </div>


  <div style="">
        
        <div style="width: 15%;float: left;">
            <img src="<?php echo DOMAIN.AgentDirectory;?>img/<?php echo $branch[0]['logo']; ?>" style="height:65px;width:65px;" />    
        </div>
        <div style="width:85%;font-size:18px;float: right;margin-top: 25px;text-align:center;"><?php echo $branch[0]['Branch_Name'];?></div>

      </div>
      <div style="font-size:10px; text-align:center;">  <?php echo $branch[0]['Branch_Location'];?> </div>
 <br>
     

   <table width="100%" style="font-size:10px;" cellspacing="0">  
   
   
      <tr>  
         <td width="20%" style="border:none;"> Family Name   </td>
         <td width="30%" style="border-bottom: 1px solid black;text-align:center;border-left:none;">  <?php echo $WorkAssignValue[$k]['last_name'];?>  </td>
         
         <td width="20%" style="border:none;"> Family Code   </td>
         <td width="30%" style="border-bottom: 1px solid black;text-align:center;border-left:none;">  <?php echo $WorkAssignValue[$k]['cell_no']." / ".$WorkAssignValue[$k]['family_code'];?>  </td>

      </tr>
 
    
 
       
  <tr>  


     <td width="20%" style="border:none;">  Month/Session  </td>
     <td width="30%" style="border-bottom: 1px solid black;text-align:center;border-left:none;">  <?php echo getMonthName($m,$_REQUEST['month'])."-".date("Y");?>
      </td>

       <td width="20%" style="border:none;">  Due Date  </td>
     <td width="30%" style="border-bottom: 1px solid black;text-align:center;border-left:none;">  <?php echo date("d-M-Y",strtotime($DueDate[0]['challan_duedate']));?>
      </td>
  
  </tr>

 
  <?php  

  $m->where("branch_id", $_SESSION['branch']);
  $accounts=$m->get("edu_branch_bank_details");
  if(count($accounts)>0){

  if($accounts[0]['bank_accountitle']!=NULL){
?>

  <tr>  


     <td width="20%" style="border:none;">  Acc Title:  </td>
     <td width="30%" style="border-bottom: 1px solid black;text-align:center;border-left:none;">  <?php  echo $accounts[0]['bank_accountitle'];?>
      </td>

       <td width="20%" style="border:none;">  Bank  </td>
     <td width="30%" style="border-bottom: 1px solid black;text-align:center;border-left:none;">  (<?php  echo $accounts[0]['bank_branch'];?>) 
          <?php  echo $accounts[0]['bank_accountno'];?>
      </td>
  
  </tr>

  <?php } } ?>

     
      

   
   </table>


   <table width="20%" style="font-size:10px;margin-top:2%; float: left;" cellspacing="0">  
   

       <tr>
         <th style="border-right: 1px solid gray;" width="100%"> Particular </th>
      </tr>

      <tr>  
         <td style="border-right: 1px solid gray;background-color: lightgray;"> Class-Section   </td>        
      </tr>

      <tr>  
         <td style="border-right: 1px solid gray;background-color: lightgray;"> Roll No   </td>        
      </tr>

         
       <tr>  
         <td style="border-right: 1px solid gray;"> Balance   </td>        
      </tr>

       <tr>  
         <td style="border-right: 1px solid gray;"> Monthly   </td>         
      </tr>

      <tr>  
         <td style="border-right: 1px solid gray;"> Transport   </td>         
      </tr>

      <tr>  
         <td style="border-right: 1px solid gray;"> <?php if ($branch[0]['misc_title']!=NULL){echo $branch[0]['misc_title'];}else {echo 'Miscellaneous';} ?>   </td>         
      </tr>

        
          <?php

              $m->where("session_id", $_SESSION['current_session']);
              $m->where("month_id", $_REQUEST['month']);
              $m->where("student_id", $WorkAssignValue[$k]['student_id']);
              $feefeeid=$m->get("eduportal_monthly_challan");
     
              
                           
           ?>
          <tr>
          <td style="border-right:1px solid gray;">  Other's </td>
          </tr>

       


       <tr>  
         <td style="border-right: 1px solid gray;"> Discount</td>
         
      </tr>
         


   <tr style="background: lightgray;">
     <td style="border-right: 1px solid gray;"> Total</td>    
   </tr>
   <!-- <tr>
    <td style="border-right: 1px solid gray;">Grand Total</td>    
   </tr> -->

   </table>

    <?php 

$cellNo=$WorkAssignValue[$k]['cell_no'];

$sqll = " select std.* from  edu_student_details as std where std.status='0' AND std.branch_id='$branchID' And std.cell_no='$cellNo'";
//print_r($sqll);
$studentDatas = $m->query($sqll);

$counter=80/count($studentDatas);


    $other_fee;

     foreach ($studentDatas as $studentData) { 


      $m->where("session_id", $_SESSION['current_session']);
      $m->where("month_id", $_REQUEST['month']);
      $m->where("student_id", $studentData['student_id']);
      $studentFeeData=$m->get("eduportal_monthly_challan");

    $GrandTotal+=$studentFeeData[0]['balance']+$studentFeeData[0]['tutionfee']+$studentFeeData[0]['transportfee']+$studentFeeData[0]['misc_fee']-$studentFeeData[0]['disc_amount'];

      ?>

       <table width="<?php echo $counter;?>%" style="font-size:10px;margin-top:2%; float: left;" cellspacing="0">  
   

       <tr>
         <th style="border-right: 1px solid gray;" width="100%"> <?php echo $studentData['first_name']; ?></th>
      </tr>

      <tr>  
         <td style="border-right: 1px solid gray;text-align: center;background-color: lightgray;">  <?php echo getClassName($m,$studentData['class_id'])." ".getSectionName($m,$studentData['section_id']); ?>   </td>        
      </tr>

      <tr>  
         <td style="border-right: 1px solid gray;text-align: center;background-color: lightgray;">  <?php echo $studentData['candidate_roll_no'];?>   </td>        
      </tr>

          
       <tr>  
         <td style="border-right: 1px solid gray;text-align: center;">  <?php if($studentFeeData[0]['balance']!=""){ echo $studentFeeData[0]['balance'];} else { echo "0";}?>   </td>        
      </tr>

       <tr>  
         <td style="border-right: 1px solid gray;text-align: center;"> <?php if($studentFeeData[0]['tutionfee']!=""){echo $studentFeeData[0]['tutionfee'];} else { echo "0";}?>   </td>         
      </tr>

      <tr>  
         <td style="border-right: 1px solid gray;text-align: center;"> <?php if($studentFeeData[0]['transportfee']!=""){echo $studentFeeData[0]['transportfee'];} else { echo "0";}?>   </td>         
      </tr>

      <tr>  
         <td style="border-right: 1px solid gray;text-align: center;"> <?php if($studentFeeData[0]['misc_fee']!=""){echo $studentFeeData[0]['misc_fee'];} else { echo "0";}?>   </td>         
      </tr>

        <?php
          
            $other_fee;
            foreach ($fee_types as $type) {

              $fee=getFeeOfOtherParameter($studentFeeData[0]['student_id'],$studentFeeData[0]['challan_id'],$type['feetype_id'],$m);
              
               $other_fee+=$fee;  }  ?>


          <tr>         
                <td class="center" style="border-right:1px solid gray;text-align: center;"> <?php echo 0+$other_fee; ?> 
                </td>
          </tr>


       <tr>  
         <td style="border-right: 1px solid gray;text-align: center;"> 

          <?php echo ($studentFeeData[0]['disc_amount']/$studentFeeData[0]['tutionfee']*100)."% (".$studentFeeData[0]['disc_amount'].")";?></td>
         
      </tr>
   <tr style="background:lightgray;">
    <?php

 //$m->where("feetype_id", 1);
  $m->where("student_id", $studentData['student_id']);
  $m->where("session_id", $_REQUEST['session']);
  $m->where("month_id", $_REQUEST['month']);
  $datas1=$m->get("eduportal_monthly_challan");

  $adm=getFeeOfOtherParameter($datas1[0]['student_id'],$datas1[0]['challan_id'],1,$m);
  $papr=getFeeOfOtherParameter($datas1[0]['student_id'],$datas1[0]['challan_id'],2,$m);
  $lib=getFeeOfOtherParameter($datas1[0]['student_id'],$datas1[0]['challan_id'],3,$m);
  $lab=getFeeOfOtherParameter($datas1[0]['student_id'],$datas1[0]['challan_id'],4,$m);
  $othr=getFeeOfOtherParameter($datas1[0]['student_id'],$datas1[0]['challan_id'],5,$m);
  $regfee=getFeeOfOtherParameter($datas1[0]['student_id'],$datas1[0]['challan_id'],6,$m);
  $secufee=getFeeOfOtherParameter($datas1[0]['student_id'],$datas1[0]['challan_id'],7,$m);
  $anualfee=getFeeOfOtherParameter($datas1[0]['student_id'],$datas1[0]['challan_id'],8,$m);
 
  

     $otherFee1=$adm+$papr+$lib+$lab+$othr+$regfee+$secufee+$anualfee;

     ?>
     <td style="border-right: 1px solid gray;text-align: center;"> 

      <?php echo $studentFeeData[0]['balance']+$studentFeeData[0]['tutionfee']+$studentFeeData[0]['transportfee']+$studentFeeData[0]['misc_fee']-$studentFeeData[0]['disc_amount']+$otherFee1?>
        

      </td>    
   </tr>
  

   </table>

<?php  }  ?>

<table width="100%" style="font-size:10px;" cellspacing="0">  
   
  
         <tr style="background:lightgray;">  
         <td width="100%" colspan="2" style="text-align:center;border-left:none;font-size: 12px;font-weight: bold;">Grand Total:- <?php echo $GrandTotal+$other_fee;?> </td>
         
         </tr>

         
   </table>

   <p style="text-align:center;margin: 3px;">Student Fee History</p>
 <table class="table "cellspacing="0"  style="width:100%;">

    <thead>
            
    <tr>
    <th style="background: white;font-size:12px;" width="3%">Month</th>
        <?php
         
      for ($mm=1; $mm<=12; $mm++) { 
//echo $mm;
        $monthss = date('F', mktime(0,0,0,$mm, 1, date('Y')));
        ?>

       <th style="background: white;font-size:12px;" width="3%" class=" center"><?php echo substr($monthss, 0, 3);?></th>

        <?php } ?>
        </tr>  


        <tr>


        <th style="background: white;font-size:12px;" width="3%">Total</th>
       <?php 
       $SumMonthlyFamily;
       $otherFee;
       for ($mm=1; $mm<=12; $mm++) {
        
foreach ($studentDatas as $studentData) { 
$stdid=$studentData['student_id'];
$bal = "select * from eduportal_monthly_challan where student_id='$stdid' AND month_id='$mm' AND session_id='$sessionID' AND branch_id=".$_SESSION['branch'];  
  $monthlyTotal = $m->query($bal);
//print_r($bal);
  $SumMonthlyFamily+=$monthlyTotal[0]['balance']+$monthlyTotal[0]['tutionfee']+$monthlyTotal[0]['transportfee']+$monthlyTotal[0]['misc_fee']-$monthlyTotal[0]['disc_amount'];


$adm=getFeeOfOtherParameter($monthlyTotal[0]['student_id'],$monthlyTotal[0]['challan_id'],1,$m);
$papr=getFeeOfOtherParameter($monthlyTotal[0]['student_id'],$monthlyTotal[0]['challan_id'],2,$m);
$lib=getFeeOfOtherParameter($monthlyTotal[0]['student_id'],$monthlyTotal[0]['challan_id'],3,$m);
$lab=getFeeOfOtherParameter($monthlyTotal[0]['student_id'],$monthlyTotal[0]['challan_id'],4,$m);
$othr=getFeeOfOtherParameter($monthlyTotal[0]['student_id'],$monthlyTotal[0]['challan_id'],5,$m);
$regfee=getFeeOfOtherParameter($monthlyTotal[0]['student_id'],$monthlyTotal[0]['challan_id'],6,$m);
$secufee=getFeeOfOtherParameter($monthlyTotal[0]['student_id'],$monthlyTotal[0]['challan_id'],7,$m);
$anualfee=getFeeOfOtherParameter($monthlyTotal[0]['student_id'],$monthlyTotal[0]['challan_id'],8,$m);

$otherFee+=$adm+$papr+$lib+$lab+$othr+$regfee+$secufee+$anualfee;
  
}


?>
<th style="background: white;font-size:12px;" width="3%" class=" center"><?php echo $SumMonthlyFamily+$otherFee;?></th>
<?php $SumMonthlyFamily=0; $otherFee=0; }  ?>

    </tr>

    <tr>

    <th style="background: white;font-size:12px;" width="3%">Recev</th>
    <?php 

    $totalMonthlyRecev;
    for ($mm=1; $mm<=12; $mm++) { 

      foreach ($studentDatas as $studentData) { 

$stdid=$studentData['student_id'];
$bal = "select * from eduportal_monthly_challan where student_id='$stdid' AND month_id='$mm' AND session_id='$sessionID' AND branch_id=".$_SESSION['branch'];  
  $monthlyTotal = $m->query($bal);
$totalMonthlyRecev+=$monthlyTotal[0]['collected_amount']+$monthlyTotal[0]['paid_again_amount']; 
   } ?>
    <th style="background: white;font-size:12px;" width="3%" class=" center"><?php echo $totalMonthlyRecev;?></th>
<?php $totalMonthlyRecev=0; } ?>

    </tr>  
    </thead>
   </table>

   <?php  $GrandTotal="";
          $other_fee=""; ?>
<!-- <tr>.</tr> -->
      <tr style="margin-top: 9px;">  
         <td width="100%" colspan="3" style=""> <br> 
         
 
      <?php if($branch[0]['fee_vouc_note']!=NULL){

          echo $branch[0]['fee_vouc_note'];
        ?>
      
      <?php }else { ?>
          Defaulters of two or more months will be expelled out. 
      <?php } ?>
  
          </td>
         
      </tr>

         <!--  <table width="100%" style="font-size:10px;" cellspacing="0">  
   
   
         <tr>  
         <td width="100%" colspan="2" style="text-align:center;border-left:none;color:white;"> .  </td>
         
         </tr>

         <tr>  
         <td width="100%" colspan="2" style="text-align:center;border:none;color:black;"> (Signature & Stamp) <br>
            
            <span style="font-size:8px;"> <?php echo getPrintBottom($m);?>  </span>

          </td>
         
         </tr>
   </table> -->
  
</div>


   
<!-- ending section  -->



  </div>  <!-- ending box  -->



<div class="box" >

<div class="section" style="font-size: 12px;<?php if($i==1){echo 'border-right:none;';}?>">
   
   <div style="width:100%; text-align:center; height:auto;font-size:12px;">
            <?php echo $array1[$i];?>

   </div>


  <div style="">
        
        <div style="width: 15%;float: left;">
            <img src="<?php echo DOMAIN.AgentDirectory;?>img/<?php echo $branch[0]['logo']; ?>" style="height:65px;width:65px;" />    
        </div>
        <div style="width:85%;font-size:18px;float: right;margin-top: 25px;text-align:center;"><?php echo $branch[0]['Branch_Name'];?></div>

      </div>
      <div style="font-size:10px; text-align:center;">  <?php echo $branch[0]['Branch_Location'];?> </div>
 <br>
        

   
   <table width="100%" style="font-size:10px;" cellspacing="0">  
   
   
      <tr>  
         <td width="20%" style="border:none;"> Family Name   </td>
         <td width="30%" style="border-bottom: 1px solid black;text-align:center;border-left:none;">  <?php echo $WorkAssignValue[$k]['last_name'];?>  </td>
         
         <td width="20%" style="border:none;"> Family Code   </td>
         <td width="30%" style="border-bottom: 1px solid black;text-align:center;border-left:none;">  <?php echo $WorkAssignValue[$k]['cell_no']." / ".$WorkAssignValue[$k]['family_code'];?>  </td>

      </tr>
 
    
 
       
  <tr>  


     <td width="20%" style="border:none;">  Month/Session  </td>
     <td width="30%" style="border-bottom: 1px solid black;text-align:center;border-left:none;">  <?php echo getMonthName($m,$_REQUEST['month'])."-".date("Y");?>
      </td>

       <td width="20%" style="border:none;">  Due Date  </td>
     <td width="30%" style="border-bottom: 1px solid black;text-align:center;border-left:none;">  <?php echo date("d-M-Y",strtotime($DueDate[0]['challan_duedate']));?>
      </td>
  
  </tr>

  <tr>  


     <td width="20%" style="border:none;">  Roll No  </td>
     <td width="30%" style="border-bottom: 1px solid black;text-align:center;border-left:none;">  <?php echo $WorkAssignValue[$k]['candidate_roll_no'];?>
      </td>

       <td width="20%" style="border:none;">  Adm No  </td>
     <td width="30%" style="border-bottom: 1px solid black;text-align:center;border-left:none;">  <?php echo $WorkAssignValue[$k]['ref_no'];?>
      </td>
  
  </tr>

  <?php  

  $m->where("branch_id", $_SESSION['branch']);
  $accounts=$m->get("edu_branch_bank_details");
  if(count($accounts)>0){

  if($accounts[0]['bank_accountitle']!=NULL){
?>

  <tr>  


     <td width="20%" style="border:none;">  Acc Title:  </td>
     <td width="30%" style="border-bottom: 1px solid black;text-align:center;border-left:none;">  <?php  echo $accounts[0]['bank_accountitle'];?>
      </td>

       <td width="20%" style="border:none;">  Bank  </td>
     <td width="30%" style="border-bottom: 1px solid black;text-align:center;border-left:none;">  (<?php  echo $accounts[0]['bank_branch'];?>) 
          <?php  echo $accounts[0]['bank_accountno'];?>
      </td>
  
  </tr>

  <?php 
} }
?>

     
      

   
   </table>


   <table width="20%" style="font-size:10px;margin-top:2%; float: left;" cellspacing="0">  
   

       <tr>
         <th style="border-right: 1px solid gray;" width="100%"> Particular </th>
      </tr>

      <tr>  
         <td style="border-right: 1px solid gray;background-color: lightgray;"> Class-Section   </td>        
      </tr>

      <tr>  
         <td style="border-right: 1px solid gray;background-color: lightgray;"> Roll No   </td>        
      </tr>

         
       <tr>  
         <td style="border-right: 1px solid gray;"> Balance   </td>        
      </tr>

       <tr>  
         <td style="border-right: 1px solid gray;"> Monthly   </td>         
      </tr>

      <tr>  
         <td style="border-right: 1px solid gray;"> Transport   </td>         
      </tr>

      <tr>  
         <td style="border-right: 1px solid gray;"> <?php if ($branch[0]['misc_title']!=NULL){echo $branch[0]['misc_title'];}else {echo 'Miscellaneous';} ?>   </td>         
      </tr>

                 
          <tr>
          <td style="border-right:1px solid gray;">  Other's </td>
          </tr>



       <tr>  
         <td style="border-right: 1px solid gray;"> Discount</td>
         
      </tr>
         


   <tr style="background:lightgray;">
     <td style="border-right: 1px solid gray;"> Total</td>    
   </tr>
   <!-- <tr>
    <td style="border-right: 1px solid gray;">Grand Total</td>    
   </tr> -->

   </table>

    <?php 

$cellNo=$WorkAssignValue[$k]['cell_no'];

$sqll = " select std.* from  edu_student_details as std where std.status='0' AND std.branch_id='$branchID' And std.cell_no='$cellNo'";
//print_r($sqll);
$studentDatas = $m->query($sqll);

$counter=80/count($studentDatas);

     $other_fee1;

     foreach ($studentDatas as $studentData) { 


      $m->where("session_id", $_SESSION['current_session']);
      $m->where("month_id", $_REQUEST['month']);
      $m->where("student_id", $studentData['student_id']);
      $studentFeeData=$m->get("eduportal_monthly_challan");

$GrandTotal+=$studentFeeData[0]['balance']+$studentFeeData[0]['tutionfee']+$studentFeeData[0]['transportfee']+$studentFeeData[0]['misc_fee']-$studentFeeData[0]['disc_amount'];

      ?>

       <table width="<?php echo $counter;?>%" style="font-size:10px;margin-top:2%; float: left;" cellspacing="0">  
   

       <tr>
         <th style="border-right: 1px solid gray;" width="100%"> <?php echo $studentData['first_name']; ?></th>
      </tr>

      <tr>  
         <td style="border-right: 1px solid gray;text-align: center;background-color: lightgray;">  <?php echo getClassName($m,$studentData['class_id'])." ".getSectionName($m,$studentData['section_id']); ?>   </td>        
      </tr>

      <tr>  
         <td style="border-right: 1px solid gray;text-align: center;background-color: lightgray;">  <?php echo $studentData['candidate_roll_no']; ?>   </td>        
      </tr>

          
       <tr>  
         <td style="border-right: 1px solid gray;text-align: center;">  <?php if($studentFeeData[0]['balance']!=""){ echo $studentFeeData[0]['balance'];} else { echo "0";}?>   </td>        
      </tr>

       <tr>  
         <td style="border-right: 1px solid gray;text-align: center;"> <?php if($studentFeeData[0]['tutionfee']!=""){echo $studentFeeData[0]['tutionfee'];} else { echo "0";}?>   </td>         
      </tr>

      <tr>  
         <td style="border-right: 1px solid gray;text-align: center;"> <?php if($studentFeeData[0]['transportfee']!=""){echo $studentFeeData[0]['transportfee'];} else { echo "0";}?>   </td>         
      </tr>

      <tr>  
         <td style="border-right: 1px solid gray;text-align: center;"> <?php if($studentFeeData[0]['misc_fee']!=""){echo $studentFeeData[0]['misc_fee'];} else { echo "0";}?>   </td>         
      </tr>

        <?php
          
            
            foreach ($fee_types as $type) {

              $fee1=getFeeOfOtherParameter($studentFeeData[0]['student_id'],$studentFeeData[0]['challan_id'],$type['feetype_id'],$m);
              
           $other_fee1+=$fee1; }   ?>

            <tr>         
                <td class="center" style="border-right:1px solid gray;text-align: center;"> <?php echo 0+$other_fee1;?> 
                </td>
            </tr>
       
       <tr>  

         <td style="border-right: 1px solid gray;text-align: center;">  <?php echo ($studentFeeData[0]['disc_amount']/$studentFeeData[0]['tutionfee']*100)."% (".$studentFeeData[0]['disc_amount'].")";?></td>
         
      </tr>
   <tr style="background:lightgray;">

    <?php

  //$m->where("feetype_id", 1);
  $m->where("student_id", $studentData['student_id']);
  $m->where("session_id", $_REQUEST['session']);
  $m->where("month_id", $_REQUEST['month']);
  $datas1=$m->get("eduportal_monthly_challan");

  $adm=getFeeOfOtherParameter($datas1[0]['student_id'],$datas1[0]['challan_id'],1,$m);
  $papr=getFeeOfOtherParameter($datas1[0]['student_id'],$datas1[0]['challan_id'],2,$m);
  $lib=getFeeOfOtherParameter($datas1[0]['student_id'],$datas1[0]['challan_id'],3,$m);
  $lab=getFeeOfOtherParameter($datas1[0]['student_id'],$datas1[0]['challan_id'],4,$m);
  $othr=getFeeOfOtherParameter($datas1[0]['student_id'],$datas1[0]['challan_id'],5,$m);
  $regfee=getFeeOfOtherParameter($datas1[0]['student_id'],$datas1[0]['challan_id'],6,$m);
  $secufee=getFeeOfOtherParameter($datas1[0]['student_id'],$datas1[0]['challan_id'],7,$m);
  $anualfee=getFeeOfOtherParameter($datas1[0]['student_id'],$datas1[0]['challan_id'],8,$m);
 
 
  

          $otherFee2=$adm+$papr+$lib+$lab+$othr+$regfee+$secufee+$anualfee;

     ?>
     <td style="border-right: 1px solid gray;text-align: center;"> <?php echo $studentFeeData[0]['balance']+$studentFeeData[0]['tutionfee']+$studentFeeData[0]['transportfee']+$studentFeeData[0]['misc_fee']-$studentFeeData[0]['disc_amount']+$otherFee2;?></td>    
   </tr>
   

   </table>

<?php  }  ?>

<table width="100%" style="font-size:10px;" cellspacing="0">  
   
  
         <tr style="background:lightgray;">  
         <td width="100%" colspan="2" style="text-align:center;border-left:none;font-size: 12px;font-weight: bold;">Grand Total:- <?php echo $GrandTotal+$other_fee1;?> </td>
         
         </tr>

         
   </table>


    <p style="text-align:center;margin: 3px;">Student Fee History</p>
 <table class="table "cellspacing="0"  style="width:100%;">

    <thead>
            
    <tr>
    <th style="background: white;font-size:12px;" width="3%">Month</th>
        <?php
         
      for ($mm=1; $mm<=12; $mm++) { 
//echo $mm;
        $monthss = date('F', mktime(0,0,0,$mm, 1, date('Y')));
        ?>

       <th style="background: white;font-size:12px;" width="3%" class=" center"><?php echo substr($monthss, 0, 3);?></th>

        <?php } ?>
        </tr>  


        <tr>


        <th style="background: white;font-size:12px;" width="3%">Total</th>
       <?php 
       $SumMonthlyFamily1;
       $otherFee1;
       for ($mm=1; $mm<=12; $mm++) {
        
foreach ($studentDatas as $studentData1) { 
$stdid=$studentData1['student_id'];
$bal1 = "select * from eduportal_monthly_challan where student_id='$stdid' AND month_id='$mm' AND session_id='$sessionID' AND branch_id=".$_SESSION['branch'];  
  $monthlyTotal1 = $m->query($bal1);
//print_r($bal);
  $SumMonthlyFamily1+=$monthlyTotal1[0]['balance']+$monthlyTotal1[0]['tutionfee']+$monthlyTotal1[0]['transportfee']+$monthlyTotal1[0]['misc_fee']-$monthlyTotal1[0]['disc_amount'];


$adm1=getFeeOfOtherParameter($monthlyTotal1[0]['student_id'],$monthlyTotal1[0]['challan_id'],1,$m);
$papr1=getFeeOfOtherParameter($monthlyTotal1[0]['student_id'],$monthlyTotal1[0]['challan_id'],2,$m);
$lib1=getFeeOfOtherParameter($monthlyTotal1[0]['student_id'],$monthlyTotal1[0]['challan_id'],3,$m);
$lab1=getFeeOfOtherParameter($monthlyTotal1[0]['student_id'],$monthlyTotal1[0]['challan_id'],4,$m);
$othr1=getFeeOfOtherParameter($monthlyTotal1[0]['student_id'],$monthlyTotal1[0]['challan_id'],5,$m);
$regfee1=getFeeOfOtherParameter($monthlyTotal1[0]['student_id'],$monthlyTotal1[0]['challan_id'],6,$m);
$secufee1=getFeeOfOtherParameter($monthlyTotal1[0]['student_id'],$monthlyTotal1[0]['challan_id'],7,$m);
$anualfee1=getFeeOfOtherParameter($monthlyTotal1[0]['student_id'],$monthlyTotal1[0]['challan_id'],8,$m);

$otherFee1+=$adm1+$papr1+$lib1+$lab1+$othr1+$regfee1+$secufee1+$anualfee1;
  
}


?>
<th style="background: white;font-size:12px;" width="3%" class=" center"><?php echo $SumMonthlyFamily1+$otherFee1;?></th>
<?php $SumMonthlyFamily1=0; $otherFee1=0; }  ?>

    </tr>

    <tr>

    <th style="background: white;font-size:12px;" width="3%">Recev</th>
    <?php 

    $totalMonthlyRecev;
    for ($mm=1; $mm<=12; $mm++) { 

      foreach ($studentDatas as $studentData1) { 

$stdid=$studentData1['student_id'];
$bal1 = "select * from eduportal_monthly_challan where student_id='$stdid' AND month_id='$mm' AND session_id='$sessionID' AND branch_id=".$_SESSION['branch'];  
  $monthlyTotal1 = $m->query($bal1);
$totalMonthlyRecev1+=$monthlyTotal1[0]['collected_amount']+$monthlyTotal1[0]['paid_again_amount']; 
   } ?>
    <th style="background: white;font-size:12px;" width="3%" class=" center"><?php echo $totalMonthlyRecev1;?></th>
<?php $totalMonthlyRecev1=0; } ?>

    </tr>  
    </thead>
   </table>

   <?php  $GrandTotal="";
          $other_fee1=""; ?>
<!-- <tr>.</tr> -->
      <tr style="margin-top: 9px;">  
         <td width="100%" colspan="3" style=""> <br> 
         
 
      <?php if($branch[0]['fee_vouc_note']!=NULL){

          echo $branch[0]['fee_vouc_note'];
        ?>
      
      <?php }else { ?>
          Defaulters of two or more months will be expelled out. 
      <?php } ?>
  
          </td>
         
      </tr>

          <!-- <table width="100%" style="font-size:10px;" cellspacing="0">  
   
   
         <tr>  
         <td width="100%" colspan="2" style="text-align:center;border-left:none;color:white;"> .  </td>
         
         </tr>

         <tr>  
         <td width="100%" colspan="2" style="text-align:center;border:none;color:black;"> (Signature & Stamp) <br>
            
            <span style="font-size:8px;"> <?php echo getPrintBottom($m);?>  </span>

          </td>
         
         </tr>
   </table> -->
  
</div>


   
<!-- ending section  -->



  </div>  <!-- ending box  -->



</div>

</page>
<br><br>
<?php   $other_fee="";}?>

</body>
</html>
