?
Current Path : /home1/savoy/public_html/savoyglobal.net/sgms/application/views/HR/ |
Linux gator3171.hostgator.com 4.19.286-203.ELK.el7.x86_64 #1 SMP Wed Jun 14 04:33:55 CDT 2023 x86_64 |
Current File : /home1/savoy/public_html/savoyglobal.net/sgms/application/views/HR/xls_report_monthly_time.php~ |
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed'); $company_details= $this->mastermodel->get_data_srow('company','1','company_id'); $html='<html><head><body>'; $html.='<table width="100%"> <tr><td colspan="2"></td><td align="right"><img src="'.base_url().'assets/images/'.$company_details->logo.'" style="float:right"/></td> <tr><td colspan="3" style="font-size:16px;" align="center"><b><u>Report - Monthly Attendance</u></b></td></tr> <tr><td colspan="3">Printout Date: '.date('d-m-Y').', '.date('h:i:s a').'</td></tr> </table><br><br>'; $html.='<hr>'; $ts = strtotime($postdata['month']." ".$postdata['year']); $start_date=date('Y-m-01', $ts); $end_date=date('Y-m-t', $ts); $diff = abs(strtotime($start_date) - strtotime($end_date)); $days = floor($diff/(60*60*24)); $days++; $html.='<table cellspacing="-1" style="width:100%;text-align:left"> <thead> <tr><th style="text-align:left" bgcolor="#7FCEFF">Sl No</th> <th style="text-align:left" bgcolor="#7FCEFF">Employee<br/>Name</th> <th style="text-align:left" bgcolor="#7FCEFF">Employee<br/>No</th> <th style="text-align:left" bgcolor="#7FCEFF">Designation</th>'; $date=$start_date; while (strtotime($date) <= strtotime($end_date)) { $html.='<th style="text-align:left" bgcolor="#7FCEFF">'.date ("d", strtotime($date)).'</th>'; $date = date ("Y-m-d", strtotime("+1 day", strtotime($date))); } $html .='<th style="text-align:left" bgcolor="#7FCEFF">Total</th></tr></thead><tbody>'; $i=1; $weekly_holidays=$this->mastermodel->getdatas('timesheet_weekly_holiday','weekly_holiday_id'); $holiday=array(); foreach ($weekly_holidays as $weekly) { $holiday[]=$weekly['weekly_holiday']; } foreach($report as $rep) { $date=$start_date; $employee_device_id=$this->mastermodel->getSingleFieldValue('employee','device_no','employee_id',$rep['employee_id']); $html.='<tr><td>'.$i.'</td>'; $html.='<td>'.$rep['employee_name'].'</td>'; $html.='<td>'.$rep['employee_no'].'</td>'; $html.='<td>'.$rep['designation_name'].'</td>'; $total=0; while (strtotime($date) <= strtotime($end_date)) { $hours = $this->hrmodel->get_time_day($employee_device_id,$date); if($hours == -1) { $day_type='<font color="red">X</font>'; } else if($hours !=0) { $day_type=$this->hrmodel->get_time_day($employee_device_id,$date); $total += $day_type; } else if(in_array(date('l', strtotime($date)), $holiday)) { $day_type= substr(date('l', strtotime($date)), 0,1); } else if($this->mastermodel->number_rows('timesheet_special_holiday','special_holiday_date',$date)>0) { $day_type='H'; } else if($this->hrmodel->get_leave_day($rep['employee_id'],$date)>0) { $day_type='L'; } else { $day_type='A'; } $html.='<td>'.$day_type.'</td>'; $date = date("Y-m-d", strtotime("+1 day", strtotime($date))); } $html.='<td>'.$total.'</td>'; $html.='</tr>'; $i++; } $html.='</tbody></table>'; $html.='<hr>'; $html.='</body></html>'; $filename = "Monthly-Time"; header("Content-type: application/octet-stream"); header("Content-Disposition: attachment; filename=".$filename.".xls"); header("Pragma: no-cache"); header("Expires: 0"); print $html; exit; ?>