<?php include('parent/callMe.php');?>
<?php include('Sessioncheck.php');?>
<?php   
  
 $branch=$_SESSION['branch'];
 $sessionIDs=$_SESSION['current_session'];

$sql = "SELECT std.student_id, std.first_name,std.last_name,std.father_name,std.cell_no,std.image,std.status,std.branch_id,std.class_id,std.candidate_roll_no,std.ref_no,std.section_id,std.session_id,std.family_code,fee.student_id,fee.std_tution_fee,fee.discount_reason  FROM eduportal_student_fee_structure as fee, edu_student_details as std WHERE fee.student_id=std.student_id and fee.class_id=std.class_id and std.status='0' and std.branch_id=".$_SESSION['branch']. " ";

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

  $sql .= " GROUP BY fee.student_id ";
 // print_r($sql);

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


  $m->where("session_id", $_REQUEST['session']);
  $session=$m->get("edu_session_config");


  // getting branch details

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

 ?>

<!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 Result Sheet</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 {padding:1%;border-bottom:1px solid gray;border-top:1px solid gray;border-left:1px solid gray;text-align:center;background-color:lightgray;font-size:14px;}
tr td {border-bottom:1px solid gray;border-left:1px solid gray;font-size:16px;}
  
.border{border:1px solid black;}
.center{text-align:center;}
.alignment{padding-left:1%;text-align:left;}



@media print {
    #Header, #Footer { display: none !important; }
}
@media screen
   {
      p.bodyText {font-family:verdana, arial, sans-serif;}
   }

   @media print
   {
      p.bodyText {font-family:georgia, times, serif;}
   }
   @media screen, print
   {
      p.bodyText {font-size:10pt}
   }
   @media print {
  a[href]:after {
    content: none !important;
  }
}
</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 Report with "<?php echo $_GET['fee']; ?>" Monthly Fee

 </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,date('m'), 10));?>  </div>

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

<br>
   
    <table style="width:100%;font-size:16px;" cellspacing="0">
            
            
       <thead>
            <tr>
                <th width="3%" class=" center"> S.No</th>
                <th width="25%" class="center"> Name</th>
                <th width="25%" class="center"> F.Name</th>
                <th width="10%" class=" center"> Roll No </th>  
                <th width="15%" class=" center"> Class</th>
                <th width="10%" class=" center"> Adm No </th>  
                <th width="7%" class=" center" > Monthly Fee </th>  
                <th width="10%" class=" center" style="border-right:1px solid black;"> Reason </th>  
                
                
                 
            </tr>
        </thead>
    
    <?php 
    $count=1;
      foreach($WorkAssignListings as $WorkAssignListVal)
      { 
   
        $m->where("section_id", $WorkAssignListVal['section_id']);
        $section=$m->get("edu_adm_section_detail");
         
        $m->where("class_id", $WorkAssignListVal['class_id']);
        $class=$m->get("edu_class_config");

       $total_fee=$total_fee+$WorkAssignListVal['std_tution_fee'];
      
     ?>
        <tr> 
                <td class="center"> <?php echo $count; $count++;?> </td>
                  <td style="padding-left:1%;"><?php echo $WorkAssignListVal['first_name'];  ?></td>
                  <td style="padding-left:1%;"><?php echo $WorkAssignListVal['last_name'];  ?></td>
                  <td class="center">  <?php echo $WorkAssignListVal['candidate_roll_no'];?>  </td>                  
                  <td style="padding-left:1%;"><?php echo  $class[0]['Class_Name'];  ?></td>
                  <td class="center">  <?php echo $WorkAssignListVal['ref_no'];?>  </td>                  
                  <td class="center" >  <?php echo 0+$WorkAssignListVal['std_tution_fee'];?> </td>
                  <td class="center" style="border-right:1px solid black;">  <?php echo $WorkAssignListVal['discount_reason'];?>  </td>                  
                                 
              </tr>

       <?php } ?>

                  <tr>
                  <th colspan="6" class="center borderTop">Total</th>
                  <th colspan="2" class="center borderTop" style="border-right: 1px solid lightgray;"><?php echo number_format($total_fee);?></th> 

                  </tr>
                 
       
            
           
        </tbody>
        
    </table>

</body>
</html>
