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

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

<?php

$branch=$_SESSION['branch'];


$year=$_REQUEST['year'];

$month=$_REQUEST['month'];







       

$sql = " select std.*, fee.* from  edu_student_details as std, eduportal_monthly_challan as fee where std.student_id=fee.student_id AND fee.year='$year' AND std.status='0' AND fee.branch_id='$branch' and fee.month_id='$month' and fee.paid_status='1' group by std.family_code order by CAST(std.family_code as unsigned)  asc";



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

<title>Print Paid Family 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 {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;"> Paid Family Report

    </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> Year:</b> <?php echo $year;?> </div>



<br>

   

    <table id="listofstudents" class="table  table-bordered" style="width:100%">

 

        <thead>

            <tr>

              

                <th width="1%">S.No</th>

                <th width="10%">Father Name</th>

                <th width="8%">Students Name</th>

                <th width="8%">Class / Section</th>

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

                <th width="8%">Cell No</th>    

                <th width="10%">Monthly Fee</th>          

                <th width="10%">Total</th>

                <th width="10%">Received</th>

                <th width="10%">Remaining</th>

                                

            </tr>

        </thead>

        <tbody>





   

     

     <?php 

$count=1;

      foreach($WorkAssignListings as $WorkAssignListVal)

      { 

  



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

  $months=$m->get("eduportal_month_config");



  $cell=$WorkAssignListVal['family_code'];

  $StudId=$WorkAssignListVal['student_id'];



  $sqll = " select std.* from  edu_student_details as std where std.status='0' AND std.branch_id='$branch' And std.family_code='$cell'";

  //print_r($sqll);

  $studentDatas = $m->query($sqll);


  $year=$_REQUEST['year'];

 



     

      ?>



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



          <td style="text-align:center; padding: 2px;"><?php echo $count++;?></td>



          <td colspan="9"><a href="pay_fee.php?student=<?php echo $WorkAssignListVal['student_id'];?>"><b><?php echo $WorkAssignListVal['last_name']." (".$WorkAssignListVal['family_code'].")";?></b></a></td>



        </tr>



        

          <?php foreach ($studentDatas as $studentData) {



              $stdID=$studentData['student_id'];



             $qr22="SELECT * FROM eduportal_monthly_challan WHERE branch_id='$branch' and month_id='$month' and year='$year' and student_id='$stdID'";

            //print_r($qr);

              $Challandetails = $m->query($qr22);





$adm=getFeeOfOtherParameter($studentData['student_id'],$Challandetails[0]['challan_id'],1,$m);

$papr=getFeeOfOtherParameter($studentData['student_id'],$Challandetails[0]['challan_id'],2,$m);

$misc=getFeeOfOtherParameter($studentData['student_id'],$Challandetails[0]['challan_id'],3,$m);

$stati=getFeeOfOtherParameter($studentData['student_id'],$Challandetails[0]['challan_id'],4,$m);

$oth=getFeeOfOtherParameter($studentData['student_id'],$Challandetails[0]['challan_id'],5,$m);

$reg=getFeeOfOtherParameter($studentData['student_id'],$Challandetails[0]['challan_id'],6,$m);

$sec=getFeeOfOtherParameter($studentData['student_id'],$Challandetails[0]['challan_id'],7,$m);

$anual=getFeeOfOtherParameter($studentData['student_id'],$Challandetails[0]['challan_id'],8,$m);

$bokPack=getFeeOfOtherParameter($studentData['student_id'],$Challandetails[0]['challan_id'],9,$m);

$proFee=getFeeOfOtherParameter($studentData['student_id'],$Challandetails[0]['challan_id'],10,$m);



$other_totals=$adm+$papr+$misc+$stati+$oth+$reg+$sec+$anual+$bokPack+$proFee;









              $payableAmount=$Challandetails[0]['tutionfee']+$Challandetails[0]['transportfee']+$Challandetails[0]['collected_fine']+$Challandetails[0]['balance']+$Challandetails[0]['misc_fee']+$other_totals-$Challandetails[0]['disc_amount'];



              $totalReceived=$Challandetails[0]['collected_amount']+$Challandetails[0]['paid_again_amount'];



              $remaningAmount=$payableAmount-$totalReceived;



              



              $totalPayAbleAmount+=$payableAmount;

              $totalReceivedAmount+=$totalReceived;

              $totalRemaningAmount+=$remaningAmount;

              $totalMonthlyFee+=$Challandetails[0]['tutionfee'];



           ?>

          <tr>

          <td></td>

          <td></td>

          <td><?php echo $studentData['first_name'];?></td>

          <td><?php echo getClassName($m,$studentData['class_id']);?> / <?php echo getSectionName($m,$studentData['section_id']);?></td>

          <td><?php echo $studentData['ref_no']." / ".$studentData['candidate_roll_no'];?></td>

          <td><?php echo $studentData['cell_no'];?></td>

          <td><?php echo $Challandetails[0]['tutionfee'];?></td>

          <td><?php echo $payableAmount;?></td>

          <td><?php echo $totalReceived;?></td>

          <td><?php echo $remaningAmount;?></td>

          </tr>

          

          

        <?php } ?>



        <tr style="background-color:#F2F3F4;">

            <td colspan="6" style="text-align:center">Total</td>

            <td><?php echo $totalMonthlyFee;?></td>

            <td><?php echo $totalPayAbleAmount;?></td>

            <td><?php echo $totalReceivedAmount;?></td>

            <td><?php echo $totalRemaningAmount;?></td>

          </tr>



          

        



   <?php $totalPayAbleAmount="";$totalReceivedAmount="";$totalRemaningAmount="";$totalMonthlyFee="";

      }  ?>

        

        </tbody>

        

    </table>



</body>

</html>

