<?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");
$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;
$std_regObj=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;
$org_id=$_SESSION['org_id'];
$client_Obj->select($org_id);
$batch=$_SESSION['batch'];
$mode=$_SESSION['mode'];
$stdid=$_SESSION['studentid'];
$month=$_SESSION['month'];
$year=$_SESSION['year'];?>

<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 Attendance 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;">Attendance Report<br>
        </span> <br>
        <b>Course :
        <?php $batchObj->select($batch);  $courseObj->select($batchObj->course_id); echo $courseObj->course_name; ?>
        <br>
        Batch :
        <?php $batchObj->select($batch); echo $batchObj->batch; ?>
        <br>
        Mode  :
        <?php if(1==$mode) { ?>
        Yearly
        <?php } ?>
        <?php if(2==$mode) { ?>
        Monthly
        <?php } ?>
        <?php if(3==$mode) { ?>
        Individual
        <?php } ?>
        <br>
        <?php if(3==$mode) { $std_regObj->select($stdid);?>
        Name :<?php echo $std_regObj->first_name.' '.$std_regObj->midd_name.' '.$std_regObj->last_name; ?> <br>
        Register No:<?php echo $std_regObj->registerno; } ?> <br>
        <?php if($mode==2){ ?>
        Month : <?php echo $month; } ?> <br>
        Year :<?php echo $year; ?></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: 8px;border-style: solid;border-color: #729ea5;text-align:left;}
.tftable tr {background-color:#d4e3e5;}
.tftable td {font-size:14px;border-width: 1px;padding: 8px;border-style: solid;border-color: #729ea5; font-weight:bold;}
</style>
  <?php 
	   if(!$batch=='')
								{
								$stdlist=$std_regObj->selectstudentattn($batch);
								
								
							
							if(count($stdlist)>0)
							{?>
  <?php if(!$batch=='' && $mode==1)
								{ ?>
  <table class="tftable" border="1">
    <thead>
											<tr>
												<th data-toggle="true">Student</th>
                                                <th data-hide="phone,tablet">Register No</th>
                                                
                                                <th >Leave</th>
                                                
											</tr>
										</thead>
										<tbody>
                                        
                                        <?php foreach($stdlist as $list)
										{?>
											<tr>
                                            <td><?php echo $list->first_name.' '.$list->midd_name.' '.$list->last_name; ?></td>
                                            <td data-value="<?php //echo $list->department.'_D'; ?>"><?php echo $list->registerno; ?></td>
                                            
                                            <td><?php $count=$std_absentObj->yearlyabsentcount($list->id,$year); echo count($count); ?></td>
                                            
                                            </tr>
                                        <?php } ?>
											
										</tbody>
  </table>
  <?php } ?>
  <?php if(!$batch=='' && $mode==2)
								{ ?>
  <table class="tftable" border="1">
    <thead>
											<tr>
												<th data-toggle="true">Student</th>
                                                <th data-hide="phone,tablet">Register No</th>
                                               
                                                <th >Leave</th>
                                                
											</tr>
										</thead>
										<tbody>
                                        
                                        <?php foreach($stdlist as $list)
										{?>
											<tr>
                                            <td><?php echo $list->first_name.' '.$list->midd_name.' '.$list->last_name; ?></td>
                                            <td data-value="<?php //echo $list->department.'_D'; ?>"><?php echo $list->registerno; ?></td>
                                            
                                            <td><?php $count=$std_absentObj->absentcount($list->id,$month,$year); echo count($count); ?></td>
                                            
                                            </tr>
                                        <?php } ?>
											
										</tbody>
  </table>
  <?php } ?>
  <?php if(!$batch=='' && $mode==3)
								{ ?>
  <table class="tftable" border="1">
    <thead>
											<tr>
												<th data-toggle="true">Student</th>
                                                <th data-hide="phone,tablet">Register No</th>
                                               
                                                <th data-hide="phone,tablet">Reason</th>
                                                <th data-hide="phone,tablet">Leave Date</th>
                                                <th >FN/AN</th>
                                                 
											</tr>
										</thead>
										<tbody>
                                        
                                        <?php
                                        $leavecountlist=$std_absentObj->individualabsentcount($stdid,$month,$year); 
										foreach($leavecountlist as $list)
										{
											 
										?>
											<tr>
                                            <td><?php  $std_regObj->select($list->std_id);  echo $std_regObj->first_name.' '.$std_regObj->midd_name.' '.$std_regObj->last_name; ?></td>
                                            <td data-value="<?php //echo $list->department.'_D'; ?>"><?php $std_regObj->select($list->std_id); echo $std_regObj->registerno; ?></td>
                                            
                                            <td><?php  $emp_leaveObj->select($list->leave_type); echo $emp_leaveObj->leavetype; ?></td>
                                            <td><?php echo date('d-M-Y',strtotime($list->leave_date)); ?></td>
                                           <td><?php if($list->fn==1 && $list->an==0){ echo 'FN';}
										   if($list->fn==0 && $list->an==1){ echo 'AN';}
										   if($list->fn==1 && $list->an==1){ echo 'FN and AN';} ?></td>
                                            
                                            </tr>
                                        <?php } ?>
											
										</tbody>
  </table>
  <?php } ?>
  <?php } }?>
  <br>
  <i> </i> <br>
  <br>
  <nobreak> </nobreak>
</page>
