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

$b=$_SESSION['branch'];
$month=$_REQUEST['month'];
$sessionIDs=$_REQUEST['session'];
  
$qr="SELECT * FROM eduportal_monthly_challan  WHERE branch_id='$b' AND session_id='$sessionIDs' and month_id='$month' and paid_status='1' ";

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


  // 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;"> 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("F", mktime(0, 0, 0,$_REQUEST['month'], 10));?>  </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%" class=" alignment"><strong>Father Name</strong></th>

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

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

        <th width="8%" ><strong>Roll No / Adm</strong></th>    

        <th width="8%"><strong>Challan Month</strong></th>

        <th width="8%"><strong>Paid Date</strong></th>

        <th width="8%"><strong>Paid Date Again</strong></th>

        <th width="8%" ><strong>Paid</strong></th>

        <th width="8%" ><strong>Paid Again</strong></th>

        <th width="10%" style="border-right:1px solid black" ><strong>Total Paid</strong></th>

                        
          </tr>
        </thead>
        <tbody>
   
       <?php 
      $count=1;
         
      foreach($WorkAssignListings as $WorkAssignListVal)
      { 


        $m->where("student_id", $WorkAssignListVal['student_id']);
        $StudentData=$m->get("edu_student_details");
 

        $TotalPaidAmount+=$WorkAssignListVal['collected_amount']+$WorkAssignListVal['collected_fine'];

        $TotalPaidAgain+=$WorkAssignListVal['paid_again_amount'];
   ?>
        <tr> 
               <td class="center"> <?php echo $count; $count++;?> </td>

               <td  class="alignment">
                 <a style="text-decoration: none;" href="pay_fee.php?student=<?php echo $StudentData[0]['student_id']; ?>">
                      <?php echo  $StudentData[0]['first_name']; ?>
                </a>
               </td>

               <td  class="alignment"><?php echo  $StudentData[0]['last_name']; ?></td>

               <td  class="center"> <?php echo  $StudentData[0]['cell_no']; ?></td>

                      
               <td style="padding-left:1%;">
                  <?php echo  getClassName($m,$StudentData[0]['class_id'])."-".getSectionName($m,$StudentData[0]['section_id']);  ?>              
               </td>

               <td  class="center" ><?php echo  $StudentData[0]['candidate_roll_no']." / ".$StudentData[0]['ref_no']; ?></td>         

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

               <td  class="center" ><?php echo date("d-M-Y",strtotime($WorkAssignListVal['paying_date']));?></td>   

               <td  class="center" >
               <?php 

               if ($WorkAssignListVal['paid_again_date']!='') {                 
               
               echo date("d-M-Y",strtotime($WorkAssignListVal['paid_again_date']));
               }?></td>  

               <td  class="center" ><?php echo $WorkAssignListVal['collected_amount']+$WorkAssignListVal['collected_fine'];?></td>   

               <td  class="center" ><?php echo $WorkAssignListVal['paid_again_amount'];?></td>

               <td  class="center" style="border-right:1px solid black" ><?php echo $WorkAssignListVal['collected_amount']+$WorkAssignListVal['collected_fine']+$WorkAssignListVal['paid_again_amount'];?></td>                         
              
                                     
              </tr>

       <?php  } ?>

              <tr style="background: lightgray;">
                <td colspan="9" class="center" style="font-size: 16px; font-weight: bold;">Total</td>
                <td style="font-size: 16px; font-weight: bold;"><?php echo $TotalPaidAmount;?></td>
                <td style="font-size: 16px; font-weight: bold;"><?php echo $TotalPaidAgain;?></td>
                <td style="border-right:1px solid black;font-size: 16px; font-weight: bold;"><?php echo $TotalPaidAmount+$TotalPaidAgain;?></td>
              </tr>

               
           
        </tbody>
        
    </table>

</body>
</html>
