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

  //getting branch details 
  $m->where("student_id", $_GET['student_id']);
  $discount=$m->get("eduportal_student_fee_structure");


  $branch=getBranch($m);

  $voucher=$_REQUEST['voucher'];

  $sql = " select std.*, fee.* from  edu_student_details as std, eduportal_revenue_config as fee where std.student_id=fee.student_id AND std.status='0' AND fee.revenue_id='$voucher' ";


  //echo $sql;

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

// now getting the other fee parameters of student against selected month
$fee_fine;

if(date("Y-m-d")>$WorkAssignListings[0]['challan_duedate']){
$fee_fine=$branch[0]['late_fee_fine'];
 }
 else {
$fee_fine=0;
 }



$total_fee=intVal($WorkAssignListings[0]['tutionfee'])+intVal($WorkAssignListings[0]['transportfee'])+intVal($WorkAssignListings[0]['balance'])+intVal($WorkAssignListings[0]['misc_fee']);


// print_r($challan); 

  
  //$m->where("session_id", $_SESSION['current_session']);
  $m->where("class_id", $discount[0]['class_id']);
  $class_fee = $m->get("eduportal_class_fee_details");
  $class_standerd_fee=$class_fee[0]['tution_fee'];

?>
 <!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 Double 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:45%; height:auto;float:left;padding-right:2%;margin-left:2%;margin-top:2%;}
     
tr th {background-color:gray; text-align:center;font-size:14px;border:1px solid black;padding:1%;}
tr td {border-bottom:1px solid black;border-left:1px solid black;padding:0.5%;}

@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>
<?php

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

 for($i=0; $i<2;$i++){ ?>

 <!-- Vouchere Fist -->
<div class="section" style="<?php if($i<1){echo 'border-right: 2px solid black;border-right-style:dotted;';}?>">
   
   <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:80px;width:80px;" />    
        </div>
        <div style="width:85%;font-size:18px;float: right;margin-top: 25px;text-align:center;"><?php echo $branch[0]['Branch_Name'];?></div>

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

<hr>



   <div style="font-size:12px;margin-top:1%;text-align:center;">  <strong> <u> Voucher </u>  </strong> </div>


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

         Voucher No : <?php echo $WorkAssignListings[0]['month_id']."-".$WorkAssignListings[0]['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>

<?php if ($WorkAssignListings[0]['first_name']!=NULL) { ?>

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

      </tr>


      <tr>  
         <td width="15%" style="border:none;"> Class:   </td>
         <td width="35%" style="border-bottom: 1px solid black;text-align:center;border-left:none;">  <?php echo getClassName($m,$WorkAssignListings[0]['class_id']);?>  </td>
      
         <td width="15%" style="border:none;"> Section:   </td>
         <td width="35%" style="border-bottom: 1px solid black;text-align:center;border-left:none;">  <?php echo getSectionName($m,$WorkAssignListings[0]['section_id']);?>  </td>

      </tr>


      <tr>  
         <td width="15%" style="border:none;"> Roll No:   </td>
         <td width="35%" style="border-bottom: 1px solid black;text-align:center;border-left:none;">  <?php echo $WorkAssignListings[0]['candidate_roll_no'];?>  </td>
      
         <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,$WorkAssignListings[0]['month_id'])."-".date("y");?>  </td>

      </tr>

 </table>

<?php } ?>


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

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


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


$sql="SELECT * FROM eduportal_revenue_details as rev, eduportal_revenue_heads as hed WHERE rev.revenue_id='$voucher' and rev.revenue_head_id=hed.revenueHead_id";

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

 foreach($WorkAssignListings1 as $WorkAssignListVal)
      { 

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

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


        ?>

      <tr>  
         <td><?php echo $WorkAssignListVal['revenue_head'];?></td>
         <td><?php echo $WorkAssignListVal['amount'];?></td>
         <td style="text-align:center;border-right:1px solid gray;"><?php echo $WorkAssignListVal['remarks'];?></td>
                  
      </tr>

<?php  }  ?>

      <tr>  
         <th colspan="1">Total</th>
         <th ><?php echo $totalBal;?></th>
         <th></th>
         
         
         
      </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>


</div>


<?php $totalBal=0; } ?>

</body>
</html>
