<?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;
$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; 
$addeventObj=new event;
$org_id=$_SESSION['org_id'];
$client_Obj->select($org_id);
$dept=$_SESSION['dept'];
$month=$_SESSION['month'];
$year=$_SESSION['year'];
if($dept!='' && $month!='' && $year!='')
{
$num = cal_days_in_month(CAL_GREGORIAN, $month, $year); // Total number of days in a month
}
?>
<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> Employee Attendance Sheet </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;">Employee Attendance <br>
        </span> <br>
        <b>Department :
        <?php $emp_departmentObj->select($dept);  echo $emp_departmentObj->department; ?>
        <br>
        
       
        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: 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>
<div>Present: X</div><div>Absent: <img src="<?php echo SITE_URL; ?>img/absent.png"  title="Absent"  width="16" height="16"/></div><div>Non Working Day: H</div><div>Event Holiday: h</div>
 <?php if($num!=''){ ?>
                                    
                                   
                                    <table class="tftable" border="1">
									<thead>
                                      <tr>
                                    <th></th>
                                    <?php for($i=1;$i<=$num;$i++)
												{ $leavedate=$year.'-'.$month.'-'.$i;?>
                                                <th ><?php echo substr(date('l',strtotime($leavedate)),0,1); ?></th>
                                                <?php } ?>
                                    </tr>
                                    <tr>
                                    <th>Name</th>
                                    <?php for($i=1;$i<=$num;$i++)
												{ ?>
                                                <th data-hide="phone,tablet"><?php echo $i; ?></th>
                                                <?php } ?>
                                    </tr>
                                    </thead>
		
				<tbody>
                  <?php if(!$dept=='')
								{
								$emplist=$emp_regObj->selectemployee($dept);
				  $i=1; foreach($emplist as $list)
										{  $emp_id=$list->id;   $deptid=$list->department; ?>
											<tr class="alt">
                                           
                                            <td><?php echo $list->first_name.' <br>'.$list->mid_name.' <br>'.$list->last_name; ?></td>
                                             
                                         
						<?php 
											 
											 for($a=1;$a<=$num;$a++)
												{ ?>
                                                     
                                                
            <td ><?php  $leavedate=$year.'-'.$month.'-'.$a;
			$workingdays=''.date('l',strtotime($leavedate)).'';
            $weekdaysObj->selectworkingdays($workingdays); if($weekdaysObj->status==-1) { echo 'H';} else {
			
			 $check_absent=$emp_absentObj->checkabsent($emp_id,$deptid,$leavedate); ?><?php  if($check_absent!=-1){ ?><img src="<?php echo SITE_URL; ?>img/absent.png"  title="Absent"  width="16" height="16"/><?php  } else { ?>
          
          <!--Event Holiday-->
            <?php  
			$eventlist=$addeventObj->selectholiday($deptid,$leavedate);
			
			if($eventlist==-1)
			{
				echo 'X';
			}
			else 
			{
				echo 'h';
			}
			?>
			 <!--Event Holiday-->
             
             <?php  } } ?></td>
            <input type="hidden"  name="leave_date-<?php echo $a; ?>" id="leave_date-<?php echo $a; ?>"   value="<?php echo $leavedate; ?>"/>
                                               <?php  } ?> 
                                            </tr>
                                        <?php $i++; } ?>
                
                

</tbody>
</table>
<?php }} ?>
  
  <br>
  <i> </i> <br>
  <br>
  <nobreak> </nobreak>
</page>