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

<?php include('Sessioncheck.php');?>

<?php 



//getting branch details 





$branch=getBranch($m);

$branchId=$_SESSION['branch'];



$month_id=$_REQUEST['month'];

$FamilyCode=$_REQUEST['familyCode'];



if ($_REQUEST['SearchBy']=='Cell') {



$sql = " select * from edu_student_details  where status='0' AND branch_id='$branchId' AND cell_no='$FamilyCode'";

//print_r($sql);

 

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



} else {



    $sql = " select * from edu_student_details  where status='0' AND branch_id='$branchId' AND family_code='$FamilyCode'";

//print_r($sql);

 

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



}

 $count=count($WorkAssignListings);

  $m->where("class_id", $_REQUEST['class_id']);

  $class_fee = $m->get("eduportal_class_fee_details");

  $class_standerd_fee=$class_fee[0]['tution_fee'];



  $totalFine=$brid[0]['late_fee_fine']*$count;



?>

 <!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;padding:1.5%;}

tr td {border-bottom:1px solid gray;border-left:1px solid gray;padding:2%;}







.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/Year:   </td>

         <td width="35%" style="border-bottom: 1px solid black;text-align:center;border-left:none;"> 

         <?php echo getMonthName($m,$_REQUEST['month']);?>/<?php echo $_REQUEST['year'];?></td>     



      </tr>



 </table>





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

   



      <tr>  

         <th width="30%"> Particulars  </th>

         <?php foreach ($WorkAssignListings as $WorkAssignListVal) { ?>

           <th width="15%"> <?php echo $WorkAssignListVal['first_name'];?>  </td>

        <?php  } ?>        

         

      </tr>



        <?php 

$count=1;





        ?>



     <!--  <tr>  

         <td> Standard Fee   </td>

         <?php for ($count=1; $count<=count($WorkAssignListings); $count++) { ?>



         <td style="text-align:center;border-right:1px solid gray;">  <?php echo $class_standerd_fee;?> </td>



       <?php } ?>

      </tr> -->



      <tr style="background-color: lightgray;">  

         <td> Class / sec   </td>

         <?php foreach ($WorkAssignListings as $WorkAssignListVal) {





          $m->where("class_id", $WorkAssignListVal['class_id']);

          $className=$m->get("edu_class_config");



          $m->where("section_id", $WorkAssignListVal['section_id']);

          $secName=$m->get("edu_adm_section_detail");

          ?>

         



         <td style="text-align:center;border-right:1px solid gray;">  <?php echo $className[0]['Class_Name']."/".$secName[0]['section_name'];?> </td>



       <?php } ?>

      </tr>



      <tr style="background-color: lightgray;">  

         <td> Roll No/Adm No   </td>

         <?php foreach ($WorkAssignListings as $WorkAssignListVal) {





          ?>

         



         <td style="text-align:center;border-right:1px solid gray;">  <?php echo $WorkAssignListVal['candidate_roll_no']."/".$WorkAssignListVal['ref_no'];?> </td>



       <?php } ?>

      </tr>



       <tr>  

         <td> Balance   </td>

         <?php foreach ($WorkAssignListings as $WorkAssignListVal) { 



          $sql = " select * from eduportal_monthly_challan where month_id='$month_id' AND 

branch_id='$branchId' AND student_id='".$WorkAssignListVal['student_id']."' AND session_id='".$_SESSION['current_session']."' ";

//print_r($sql);

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



          ?>

         



         <td style="text-align:center;border-right:1px solid gray;">  <?php echo $data[0]['balance'];?> </td>



       <?php } ?>

      </tr>



       <tr>  

         <td> Monthly Fee   </td>      

         <?php foreach ($WorkAssignListings as $WorkAssignListVal) {



         $sql = " select * from eduportal_monthly_challan where month_id='$month_id' AND 

branch_id='$branchId' AND student_id='".$WorkAssignListVal['student_id']."' AND session_id='".$_SESSION['current_session']."' ";

//print_r($sql);

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

 ?>



         <td style="text-align:center;border-right:1px solid gray;">  <?php echo $data[0]['tutionfee'];?> </td>



       <?php } ?>

      </tr>



      <?php

      $sql = " select * from eduportal_monthly_challan where month_id='$month_id' AND 

branch_id='$branchId' AND student_id='".$WorkAssignListVal['student_id']."' AND session_id='".$_SESSION['current_session']."' ";

//print_r($sql);

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



if($data[0]['transportfee']>0){

?>



      <tr>  

         <td> Transport Fee   </td>      

         <?php foreach ($WorkAssignListings as $WorkAssignListVal) {   



          ?>



         <td style="text-align:center;border-right:1px solid gray;">  <?php echo $data[0]['transportfee'];?> </td>



       <?php } } ?>

      </tr>



 <?php

       $sql = " select * from eduportal_monthly_challan where month_id='$month_id' AND 

branch_id='$branchId' AND student_id='".$WorkAssignListVal['student_id']."' AND session_id='".$_SESSION['current_session']."' ";

//print_r($sql);

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



if($data[0]['misc_fee']>0){ ?>



      <tr>  

         <td> <?php if ($branch[0]['misc_title']!=NULL){echo $branch[0]['misc_title'];}else {echo 'Miscellaneous';} ?>  </td>      

         <?php foreach ($WorkAssignListings as $WorkAssignListVal) { 



  





          ?>



         <td style="text-align:center;border-right:1px solid gray;">  <?php echo $data[0]['misc_fee'];?> </td>



       <?php } } ?>

      </tr>





      <?php

       // $m->where("feetype_id", 1);

  $m->where("student_id", $WorkAssignListVal['student_id']);

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

  $m->where("month_id", $_REQUEST['month']);

  $datas=$m->get("eduportal_monthly_challan");                  

  //print_r($datas);



  $fees=getFeeOfOtherParameter($datas[0]['student_id'],$datas[0]['challan_id'],1,$m);



 if($fees!=""){

  ?>



      <tr>  

         <td> Admission Fee   </td>      

         <?php foreach ($WorkAssignListings as $WorkAssignListVal) { 





               

          ?>



         <td style="text-align:center;border-right:1px solid gray;"> <?php echo $fees;?> </td>



       <?php } }  ?>

      </tr>





    <?php 



      //$m->where("feetype_id", 2);

  $m->where("student_id", $WorkAssignListVal['student_id']);

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

  $m->where("month_id", $_REQUEST['month']);

  $datas=$m->get("eduportal_monthly_challan");                  

  //print_r($datas);



       $fees=getFeeOfOtherParameter($datas[0]['student_id'],$datas[0]['challan_id'],2,$m);

       if($fees!=""){



       ?>



      <tr>  

         <td> Paper Fund   </td>      

         <?php foreach ($WorkAssignListings as $WorkAssignListVal) { 





                

          ?>



         <td style="text-align:center;border-right:1px solid gray;"> <?php echo $fees;?>  </td>



       <?php } }  ?>

      </tr>





      <?php 

      // $m->where("feetype_id", 3);

  $m->where("student_id", $WorkAssignListVal['student_id']);

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

  $m->where("month_id", $_REQUEST['month']);

  $datas=$m->get("eduportal_monthly_challan");                  

  //print_r($datas); 



       $fees=getFeeOfOtherParameter($datas[0]['student_id'],$datas[0]['challan_id'],3,$m);

       if($fees!=""){

       ?>



      <tr>  

         <td> Library Fee   </td>      

         <?php foreach ($WorkAssignListings as $WorkAssignListVal) { 





              

          ?>



         <td style="text-align:center;border-right:1px solid gray;"> <?php echo $fees;?>   </td>



       <?php }  } ?>

      </tr>





      <?php //$m->where("feetype_id", 4);

  $m->where("student_id", $WorkAssignListVal['student_id']);

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

  $m->where("month_id", $_REQUEST['month']);

  $datas=$m->get("eduportal_monthly_challan");                  

  //print_r($datas);

   $fees=getFeeOfOtherParameter($datas[0]['student_id'],$datas[0]['challan_id'],4,$m);

   if($fees!=""){

   ?>



      <tr>  

         <td> Lab Fee   </td>      

         <?php foreach ($WorkAssignListings as $WorkAssignListVal) { 





                

          ?>



         <td style="text-align:center;border-right:1px solid gray;"> <?php echo $fees;?>  </td>



       <?php }  } ?>

      </tr>





 <?php //$m->where("feetype_id", 5);

  $m->where("student_id", $WorkAssignListVal['student_id']);

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

  $m->where("month_id", $_REQUEST['month']);

  $datas=$m->get("eduportal_monthly_challan");                  

  //print_r($datas); 



  $fees=getFeeOfOtherParameter($datas[0]['student_id'],$datas[0]['challan_id'],5,$m);

  if($fees!=""){

  ?>





      <tr>  

         <td> Other Fee   </td>      

         <?php foreach ($WorkAssignListings as $WorkAssignListVal) { 





                

          ?>



         <td style="text-align:center;border-right:1px solid gray;"> <?php echo $fees;?>  </td>



       <?php } }  ?>

      </tr>





      <?php //$m->where("feetype_id", 5);

  $m->where("student_id", $WorkAssignListVal['student_id']);

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

  $m->where("month_id", $_REQUEST['month']);

  $datas=$m->get("eduportal_monthly_challan");                  

  //print_r($datas); 



  $fees=getFeeOfOtherParameter($datas[0]['student_id'],$datas[0]['challan_id'],6,$m);

  if($fees!=""){

  ?>





      <tr>  

         <td> Annual Fund   </td>      

         <?php foreach ($WorkAssignListings as $WorkAssignListVal) { 





                

          ?>



         <td style="text-align:center;border-right:1px solid gray;"> <?php echo $fees;?>  </td>



       <?php } }  ?>

      </tr>





      <?php //$m->where("feetype_id", 5);

  $m->where("student_id", $WorkAssignListVal['student_id']);

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

  $m->where("month_id", $_REQUEST['month']);

  $datas=$m->get("eduportal_monthly_challan");                  

  //print_r($datas); 



  $fees=getFeeOfOtherParameter($datas[0]['student_id'],$datas[0]['challan_id'],7,$m);

  if($fees!=""){

  ?>





      <tr>  

         <td> Registration Fee   </td>      

         <?php foreach ($WorkAssignListings as $WorkAssignListVal) { 





                

          ?>



         <td style="text-align:center;border-right:1px solid gray;"> <?php echo $fees;?>  </td>



       <?php } }  ?>

      </tr>









      <?php //$m->where("feetype_id", 5);

  $m->where("student_id", $WorkAssignListVal['student_id']);

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

  $m->where("month_id", $_REQUEST['month']);

  $datas=$m->get("eduportal_monthly_challan");                  

  //print_r($datas); 



  $fees=getFeeOfOtherParameter($datas[0]['student_id'],$datas[0]['challan_id'],8,$m);

  if($fees!=""){

  ?>





      <tr>  

         <td> Security Fee   </td>      

         <?php foreach ($WorkAssignListings as $WorkAssignListVal) { 





                

          ?>



         <td style="text-align:center;border-right:1px solid gray;"> <?php echo $fees;?>  </td>



       <?php } }  ?>

      </tr>









      <?php 



      $sql = " select * from eduportal_monthly_challan where month_id='$month_id' AND 

branch_id='$branchId' AND student_id='".$WorkAssignListVal['student_id']."' AND session_id='".$_SESSION['current_session']."' ";

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



      if($data[0]['disc_amount']>0){ ?>



       <tr>  

         <td> Fee Discount   </td>      

         <?php foreach ($WorkAssignListings as $WorkAssignListVal) { 









             

          ?>



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



  $disc_amount=$data[0]['disc_amount'];



  echo $disc_amount;?> </td>



       <?php } }  ?>

      </tr>





     <tr>  

         <td> Total   </td>      

         <?php

          $paidAm;

          $paidStaus;

          foreach ($WorkAssignListings as $WorkAssignListVal) {



$sql = " select * from eduportal_monthly_challan where month_id='$month_id' AND 

branch_id='$branchId' AND student_id='".$WorkAssignListVal['student_id']."' AND session_id='".$_SESSION['current_session']."' ";

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



//print_r($sql);



$paidAm+=$data[0]['collected_amount']+$data[0]['paid_again_amount']+$data[0]['collected_fine'];

$paidStaus+=$data[0]['paid_status'];



          $totalAM=$data[0]['balance']+$data[0]['tutionfee']+$data[0]['transportfee']+$data[0]['misc_fee']+ $other_fees /*+ $fee_fine*/;

          $total_month_fee=$totalAM-$data[0]['disc_amount'];



          

         

          ?>



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



  //$m->where("feetype_id", 1);

  $m->where("student_id", $WorkAssignListVal['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);

  $a=getFeeOfOtherParameter($datas1[0]['student_id'],$datas1[0]['challan_id'],6,$m);

  $b=getFeeOfOtherParameter($datas1[0]['student_id'],$datas1[0]['challan_id'],7,$m);

  $c=getFeeOfOtherParameter($datas1[0]['student_id'],$datas1[0]['challan_id'],8,$m);

  $d=getFeeOfOtherParameter($datas1[0]['student_id'],$datas1[0]['challan_id'],9,$m);

  $e=getFeeOfOtherParameter($datas1[0]['student_id'],$datas1[0]['challan_id'],10,$m);



 

  

  



          $otherFee=$adm+$papr+$lib+$lab+$othr+$a+$b+$c+$d+$e;

         $totalCollectedFine+=$data[0]['collected_fine'];

         $total+=$total_month_fee+$otherFee;

          echo $total_month_fee+$otherFee;?> </td>







       <?php }  ?>

      </tr>

  



      <tr>  

         <th colspan="1" style="text-align: left;">Total</th>       

        

         <th colspan="<?php echo $count;?>" style="border-right:1px solid gray;"><?php echo $total;?></th>

         

      </tr>





      <tr>  

         <th colspan="1" style="text-align: left;">Late Fee Fine Per Student:</th>       

        

         <th colspan="<?php echo $count;?>" style="border-right:1px solid gray;"><?php echo $brid[0]['late_fee_fine'];?></th>

         

      </tr>



      <tr>  

         <th colspan="1" style="text-align: left;">After Due Date:</th>       

        

         <th colspan="<?php echo $count;?>" style="border-right:1px solid gray;"><?php echo $total+$totalFine;?></th>

         

      </tr>



      

      <?php 

      //$total="";

        



          ?> 

    <?php if ($paidStaus>"0") { ?>

           

      <tr>  



         <th width="70%" style="text-align: left;">Paid Amount: &nbsp;&nbsp;</th>

         <th colspan="<?php echo $count;?>" width="30%" style="text-align:center;">  <?php echo number_format($paidAm,2); ?> </th>

      </tr>

   

      <tr>  

         <th width="70%" style="text-align: left;">Remaining: &nbsp;&nbsp;  </th>

         <th colspan="<?php echo $count;?>" width="30%" style="text-align:center; ">  <?php echo number_format($total+$totalCollectedFine-$paidAm,2); ?> </th>

      </tr>



    <?php  } ?>

     

<?php $paidAm=0; $total=""; $totalCollectedFine="";    ?>



       <tr>  

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





  <br>

  <div style="width:100%;font-size:8px;text-align:center;"> <?php //echo getPrintBottom($m);?>  </div>  



</div>

 

<!-- ending section  -->







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







 <?php $counter++; } ?>



</page>

<br><br>





</body>

</html>

