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

$branch=getBranch($m);

$branch_id=$_SESSION['branch'];
$familyCode=$_REQUEST['familyCode'];
$month=date("m");

  $sql="SELECT * FROM eduportal_monthly_challan as fee, edu_student_details as std WHERE std.cell_no='$familyCode' and fee.branch_id='$branch_id' and std.status='0' and fee.month_id='$month' and std.student_id=fee.student_id";



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


?>
 <!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;padding-right:2.5%;margin-left:2%;}
.box{
  width:48%;float:left;height:14.5cm;padding:0.5%;
}  
   
tr th {background-color:gray; text-align:center;font-size:14px;border:1px solid gray;}
tr td {border-bottom:1px solid gray;border-left:1px solid gray;padding:.7%;}



.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:1%;*/
  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;

$divission =count($WorkAssignValue);
 $DivideByFour=$divission/4;
$counter=0;

for($k=0;$k<$DivideByFour;$k++){

  $fee_fine;
  if(date("Y-m-d")>$WorkAssignValue[$counter]['challan_duedate']){

  $fee_fine=$branch[0]['late_fee_fine'];
   }
   else {

  $fee_fine=0;

   }


   $m->where("student_id", $WorkAssignValue[$counter]['student_id']);
   $discount=$m->get("eduportal_student_fee_structure");

$fee_fine;
    if(date("Y-m-d")>$WorkAssignValue[$counter]['challan_duedate']){

    $fee_fine=$branch[0]['late_fee_fine'];
     }
     else {

    $fee_fine=0;

   }

?>

<page size="A4">


	
	
		
<div class="box" >

<div class="section" style="<?php if($i==1){echo 'border-right:none;';}?>">
   
  
  <div style="">
        
        <div style="width: 15%;float: left;">
            <img src="<?php echo DOMAIN.AgentDirectory;?>img/<?php echo $branch[0]['logo']; ?>" style="height:60px;width:60px;" />    
        </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>
     <div style="font-size:12px;text-align:center;">  <strong> <u> Fee Voucher </u>  </strong> </div>


   <div style="width:50%; font-size:10px;text-align:left; height:25px; float:left;">

         Voucher No : <?php echo $WorkAssignValue[$counter]['month_id']."-".$WorkAssignValue[$counter]['challan_id'];?>


   </div>


   <div style="width:50%;font-size:10px; text-align:right; height:25px; float:left;">


         Issued : <?php echo date("d-M-Y");?>

   </div>



   <table width="100%" style="font-size:11px;" cellspacing="0">  
      
      <tr>  
         <td width="15%" style="border:none;"> Family Name:   </td>
         <td width="35%" style="border-bottom: 1px solid black;text-align:center;border-left:none;">  <?php echo $_REQUEST['familyName'];?>  </td>
      
         <td width="15%" style="border:none;"> Family Code:   </td>
         <td width="35%" style="border-bottom: 1px solid black;text-align:center;border-left:none;">  <?php echo $_REQUEST['familyCode'];?>  </td>

      </tr>


      <tr>  
         <td width="15%" style="border:none;"> Month/Session:   </td>
         <td width="35%" style="border-bottom: 1px solid black;text-align:center;border-left:none;"> 
         <?php echo getMonthName($m,date("m"));?>/<?php echo getSessionName($m,$_SESSION['current_session']);?></td>
      

      </tr>

 </table>


      <table width="100%" style="font-size:11px;margin-top:1%;" cellspacing="0">  
   

      <tr>  
         <th width="30%"> Name  </td>
         <th width="10%"> Roll No  </td>
         <th width="10%"> Balance </td>
         <th width="10%"> Fee </td>
         <th width="10%"> Discount </td>
         <th width="10%"> Fine </td>
         <th width="15%" style="text-align:center;border-right:1px solid gray;">  Total </td>
      </tr>
        <?php 
$count=1;


 foreach($WorkAssignListings as $WorkAssignListVal)
      { 

    $total+= $WorkAssignListVal['tutionfee']+$WorkAssignListVal['transportfee']+$WorkAssignListVal['total_fine']+$WorkAssignListVal['balance']+$WorkAssignListVal['misc_fee']-$WorkAssignListVal['disc_amount'];

    $totalBal+=$WorkAssignListVal['balance'];
    $totalFee+=$WorkAssignListVal['tutionfee'];
    $totalDis+=$WorkAssignListVal['disc_amount'];
    $totalFin+=$WorkAssignListVal['total_fine'];


        ?>

      <tr>  
         <td><?php echo $WorkAssignListVal['first_name'];?></td>
         <td><?php echo $WorkAssignListVal['candidate_roll_no'];?></td>
         <td><?php echo $WorkAssignListVal['balance'];?></td>
         <td><?php echo $WorkAssignListVal['tutionfee'];?></td>
         <td style="text-align: center;"><?php echo $WorkAssignListVal['disc_amount'];?></td>
         <td style="text-align: center;"><?php echo $WorkAssignListVal['total_fine'];?></td>
         
         <td style="text-align: center;"><?php echo $WorkAssignListVal['tutionfee']+$WorkAssignListVal['transportfee']+$WorkAssignListVal['total_fine']+$WorkAssignListVal['balance']+$WorkAssignListVal['misc_fee']-$WorkAssignListVal['disc_amount'];?></td>
         
      </tr>

<?php 

 }  ?>

      <tr>  
         <th colspan="2">Total</th>
         <th ><?php echo $totalBal;?></th>
         <th><?php echo $totalFee;?></th>
         <th><?php echo $totalDis;?></th>
         <th><?php echo $totalFin;?></th>
         <th style="text-align:center;border-right:1px solid gray;"><?php echo $total;?></th>
         
      </tr>
<?php
 $totalBal=0;
 $totalFee=0;
 $totalDis=0;
 $totalFin=0;
 $total=0;

?>
       <tr>  
         <td width="100%" colspan="7" 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>


  <table width="100%" style="font-size:11px;" 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  -->



 <?php $counter++; } ?>

</page>
<br><br>


</body>
</html>
