<?php ob_start();
session_start();
include('../inc/functions.php'); 
require_once("../inc/class/class.admin_users.php");
require_once("../inc/class/class.login_attempt.php");
require_once("../inc/class/class.client_org.php");
require_once("../inc/class/class.photos.php");
require_once("../inc/class/class.course.php");
require_once("../inc/class/class.batch.php");
require_once("../inc/class/class.subjects.php");
require_once("../inc/class/class.std_category.php");
require_once("../inc/class/class.add_department.php");
require_once("../inc/class/class.add_position.php");
require_once("../inc/class/class.emp_leave.php");
require_once("../inc/class/class.employee_info.php");
require_once("../inc/class/class.emp_photo.php");
require_once("../inc/class/class.emp_subject.php");
require_once("../inc/class/class.student_info.php");
require_once("../inc/class/class.guardian_info.php");
require_once("../inc/class/class.weekdays.php");
require_once("../inc/class/class.set_weekdays.php");
require_once("../inc/class/class.timetable.php");
require_once("../inc/class/class.exam_category.php");
require_once("../inc/class/class.manage_exam.php");
require_once("../inc/class/class.marklist.php");
require_once("../inc/class/class.fees_category.php");
require_once("../inc/class/class.particular.php");
require_once("../inc/class/class.fees_period.php");
require_once("../inc/class/class.payment.php");
require_once("../inc/class/class.payment_mode.php");
require_once("../inc/class/class.emp_attendance.php");
require_once("../inc/class/class.emp_absent.php");
require_once("../inc/class/class.emp_workdays.php");
require_once("../inc/class/class.emp_monthlyattendance.php");
require_once("../inc/class/class.std_absent.php");
require_once("../inc/class/class.event.php");
$loginObj=new login_attempt;
$clientObj=new client_org;
$client_Obj=new client_org;
$userphotoObj=new photos;
$courseObj=new course;
$batchObj=new batch;
$subjectObj=new subjects;
$std_categoryObj=new std_category;
$emp_departmentObj=new add_department;
$emp_positionObj=new add_position;
$emp_leaveObj=new emp_leave;
$emp_regObj=new employee_info;
$emp_photoObj=new emp_photo;
$emp_subjectObj=new emp_subject;
$emp_attendanceObj=new emp_attendance;
$emp_absentObj=new emp_absent;
$emp_workdaysObj=new emp_workdays;
$emp_monthlyattendanceObj=new emp_monthlyattendance;
$studentObj=new student_info;
$guardianObj=new guardian_info;
$weekdaysObj=new weekdays;
$setweekdaysObj=new set_weekdays;
$timetableObj=new timetable;
$examcategoryObj=new exam_category;
$manageexamObj=new manage_exam;
$marklistObj=new marklist;
$feescategoryObj=new fees_category;
$particularObj=new particular;
$feesperiodObj=new fees_period;
$paymentObj=new payment;
$paymentmodeObj=new payment_mode;
$std_absentObj=new std_absent; 
$addeventObj=new event;
$org_id=$_SESSION['org_id'];
$client_Obj->select($org_id);
$dept=$_SESSION['dept'];
$month=$_SESSION['month'];
$year=$_SESSION['year'];
if(isset($_SESSION['parid']))
{
	$parid=$_SESSION['parid'];
}
if(isset($_SESSION['batch']))
{
	$batch=$_SESSION['batch'];
} 
if(isset($_SESSION['rollno']))
{
	$rollno=$_SESSION['rollno'];
	$reg=$_SESSION['reg'];
} 
$particularObj->select($parid);
$type=$particularObj->par_type;
$par_all=$particularObj->par_all;
$par_catid=$particularObj->par_catid;
$batchObj->select($batch);
$courseObj->select($batchObj->course_id);
$batchid=$batchObj->id;
$courseid=$courseObj->id; 
?>


<page backcolor="#FEFEFE" backimg="./res/page.png" backimgx="center" backimgy="bottom" backimgw="100%" backtop="0" backbottom="30mm" footer="date;heure;page" style="font-size: 12pt">
  <bookmark title="Lettre" level="0" ></bookmark>
  <table cellspacing="0" style="width: 100%; text-align: center; font-size: 14px">
    <tr>
      <td style="width: 75%;"></td>
      <td style="width: 25%; color: #444444;"><?php if(!$client_Obj->logo==''){ ?>
        <img src="<?php echo SITE_URL; ?><?php echo $client_Obj->logo; ?>" width="100" height="50" alt=""><br>
        <?php echo $client_Obj->school_name; } else { ?> <img src="<?php echo SITE_URL; ?>img/logo_main.png" alt=""><br>
        www.web-school.in
        <?php }?>
        <?php //echo $test; ?></td>
    </tr>
  </table>
  <br>
  <br>
  <table cellspacing="0" style="width: 100%;">
    <tr>
      <td style="width: 100%; text-align: center; text-decoration: underline; font-weight: bold; font-size: 20pt;"><span style="font-size: 10pt"><br>
        </span> Students Fees Payment Report </td>
      <td style="width: 10%;"></td>
    </tr>
  </table>
  <br>
  <table cellspacing="0" style="width: 100%; border: solid 2px #000000; ">
    <tr>
      <td style="width: 100%; font-size: 12pt;"><span style="font-size: 15pt; font-weight: bold;">Fees Report <br>
        </span> <br>
        <b>Course : <?php echo $courseObj->course_name;?>  
        <br>
          Batch : <?php echo $batchObj->batch ?></b></td>
    </tr>
  </table>
  <br>
  <style type="text/css">
.tftable {font-size:14px;color:#333333;width:100%;border-width: 1px;border-color: #729ea5;border-collapse: collapse;}
.tftable th {font-size:14px;background-color:#acc8cc;border-width: 1px;padding: 2px;border-style: solid;border-color: #729ea5;text-align:left;}
.tftable tr {background-color:#d4e3e5;}
.tftable td {font-size:14px;border-width: 1px;padding: 2px;border-style: solid;border-color: #729ea5; font-weight:bold;}
</style>

 <?php
if($type==1)
{
	
 $studentlist=$studentObj->selectall('course='.$courseid.' AND batch='.$batchid);

 
if(count($studentlist)>0)
		{ ?>
                                    
                                   
                                     <table id="" class="tftable"  data-page-size="40">
        <thead>
          <tr>
            <th data-toggle="true">Roll No</th>
            <th data-hide="phone,tablet">Student </th>
            <th data-hide="phone,tablet">Fees</th>
            <th data-hide="phone,tablet">Fees Paid</th>
            <th data-hide="phone,tablet">Balance</th>
            <th data-hide="phone,tablet">Status</th>
          </tr>
        </thead>
        <tbody>
          <?php foreach($studentlist as $s_list) { 
			  $check_payment=$paymentObj->check_payment($s_list->id,$particularObj->id); 
			  if($check_payment!=-1)
				{
				$paymentObj->select_payment($s_list->id,$particularObj->id);
					}			
			  ?>
          <tr>
            <td><?php echo $s_list->registerno; ?></td>
            <td><?php echo $s_list->first_name.' '.$s_list->midd_name.' '.$s_list->last_name; ?></td>
            <td><?php echo $particularObj->par_amount; ?></td>
            <td><?php if($check_payment==-1){ echo '-'; } else {echo $paymentObj->paid; } ?></td>
            <td><?php if($check_payment==-1){ echo '-'; } else { echo $paymentObj->balance; } ?></td>
            <td ><a   href="#" >
              <?php  if($check_payment!=-1)
				{
				$paymentObj->select_payment($s_list->id,$particularObj->id);
					if($particularObj->par_amount==$paymentObj->paid) {  echo 'Paid'; } else { echo 'Unpaid'; } } else { echo 'Unpaid'; }  ?>
              </a></td>
          </tr>
          <?php } ?>
        </tbody>
        
      </table>
   
<?php }
						else
						{
						?>
Sorry ! No result found. 
<?php
						} } ?>
                        <?php
if($type==2)
{
	
  
	
	$admnolist=$studentObj->selectall('registerno='.$reg.' AND batch='.$batch);
	
      	   
		if(count($admnolist)>0)
		{ ?>
                                    
                                   
                                     <table id="" class="tftable"  data-page-size="40">
    <thead>
          <tr>
            <th data-toggle="true">Roll No</th>
            <th data-hide="phone,tablet">Student </th>
            <th data-hide="phone,tablet">Fees</th>
            <th data-hide="phone,tablet">Fees Paid</th>
            <th data-hide="phone,tablet">Balance</th>
            <th data-hide="phone,tablet">Status</th>
          </tr>
        </thead>
        <tbody>
          <?php foreach($admnolist as $roll_list) { 
			  $check_payment=$paymentObj->check_payment($roll_list->id,$particularObj->id); 
			  if($check_payment!=-1)
				{
				$paymentObj->select_payment($roll_list->id,$particularObj->id);
				}	
				?>
          <tr>
            <td><?php echo $roll_list->registerno; ?></td>
            <td><?php echo $roll_list->first_name.' '.$roll_list->midd_name.' '.$roll_list->last_name; ?></td>
            <td><?php echo $particularObj->par_amount; ?></td>
            <td><?php if($check_payment==-1){ echo '-'; } else {echo $paymentObj->paid; } ?></td>
            <td><?php if($check_payment==-1){ echo '-'; } else { echo $paymentObj->balance; } ?></td>
            <td><a   href="#" >
              <?php if($particularObj->par_amount==$paymentObj->paid) { echo 'Paid'; } else { echo 'Unpaid'; } ?>
              </a></td>
          </tr>
          <?php } ?>
        </tbody>
        
      </table>
   
<?php }
						else
						{
						?>
Sorry ! No result found. 
<?php
						} } ?>
                        
                        <?php  if($type==3)
{
	 
 
	 
	 
	 $studentlist=$studentObj->selectall('course='.$courseid.' AND batch='.$batchid);
?>
<?php 
						if(count($studentlist)>0)
						{ ?> <table id="" class="tftable" data-filter="" data-page-size="40">
        <thead>
          <tr>
            <th data-toggle="true">Roll No</th>
            <th data-hide="phone,tablet">Student </th>
            <th data-hide="phone,tablet">Fees</th>
            <th data-hide="phone,tablet">Fees Paid</th>
            <th data-hide="phone,tablet">Balance</th>
            <th data-hide="phone,tablet">Status</th>
          </tr>
        </thead>
        <tbody>
          <?php foreach($studentlist as $s_list) {
				   $check_payment=$paymentObj->check_payment($s_list->id,$particularObj->id); 
			  if($check_payment!=-1)
				{
				$paymentObj->select_payment($s_list->id,$particularObj->id);
				}	
				 ?>
          <tr>
            <td><?php echo $s_list->registerno; ?></td>
            <td><?php echo $s_list->first_name.' '.$s_list->midd_name.' '.$s_list->last_name; ?></td>
            <td><?php echo $particularObj->par_amount; ?></td>
            <td><?php if($check_payment==-1){ echo '-'; } else {echo $paymentObj->paid; } ?></td>
            <td><?php if($check_payment==-1){ echo '-'; } else { echo $paymentObj->balance; } ?></td>
            <td><a   href="#" >
              <?php if($particularObj->par_amount==$paymentObj->paid) { echo 'Paid'; } else { echo 'Unpaid'; } ?>
              </a></td>
          </tr>
          <?php } ?>
          </tbody>
          </table>
          <?php }
						else
						{
						?>
 Sorry ! No result found.
<?php
						}?>
<?php } ?>
                      
  <br>
  <i> </i> <br>
  <br>
  <nobreak> </nobreak>
</page>