?
Current Path : /home1/savoy/www/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/www/savoyglobal.net/sgms/application/views/HR/xls_report_punch.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="3" style="font-size:16px;"><b>Punch Report</b></td></tr> <tr><td colspan="3">Period: '.$postdata['starting_date'].' - '.$postdata['ending_date'].'</td></tr> </table>'; $html.='<hr>'; $start_date=$postdata['starting_date']; $end_date=$postdata['ending_date']; $diff = abs(strtotime($start_date) - strtotime($end_date)); $days = floor($diff/(60*60*24)); $days++; $temp_dept=''; foreach($report as $rep) { if($rep['department_id'] != $temp_dept) { $temp_dept=$rep['department_id']; $html.="</table><table><tr><td></td></tr> </table><table><tr><td><b>Department : ".$rep['department_name']."</b></td></tr></table>"; } $html.="<table><tr><td></td></tr> </table>"; $html.="<table><tr><td>Employee Name : ".$rep['employee_name']."</td></tr> <tr><td>Employee No : ".$rep['employee_no']."</td></tr> </table>"; $html.='<table cellspacing="-1" border=1 style="width:100%;text-align:left"> <thead><tr> <th style="height:30px;text-align:center;" bgcolor="#cdc9c9">Date</th> <th style="height:30px;text-align:center;" bgcolor="#cdc9c9">Time In</th> <th style="height:30px;text-align:center;" bgcolor="#cdc9c9">Break Out</th> <th style="height:30px;text-align:center;" bgcolor="#cdc9c9">Break In</th> <th style="height:30px;text-align:center;" bgcolor="#cdc9c9">Time Out</th> <th style="height:30px;text-align:center;" bgcolor="#cdc9c9">Remarks</th> <th style="height:30px;text-align:center;" bgcolor="#cdc9c9">Status</th> <th style="height:30px;text-align:center;" bgcolor="#cdc9c9">Type</th></tr></thead><tbody>'; $date=$start_date; while (strtotime($date) <= strtotime($end_date)) { $punches = $this->hrmodel->get_punches($rep['device_no'],$date); $html.='<tr><td>'.$this->mastermodel->convertdatenormalformat($date).'</td>'; $i=0; $j=0; $remarks = ''; $status = ''; $type = ''; $a=0; $b=0; foreach($punches as $punch) { $i++; if($i==1 && $punch['attendance_mode']==0) { $attendance_status=$this->hrmodel->get_employee_attendance_status($rep['device_no'],$rep['employee_id'],$punch['attendance_date'],$punch['attendance_mode']); $attendance_type = $punch['attendance_type']?"Manual":"Device"; $html.='<td>'.substr($punch['attendance_date'],11,5).'</td>'; $remarks .= 'TI : '.$punch['attendance_remarks']."<br/>"; $status .= $attendance_status."<br/>"; $type .= 'TI : '.$attendance_type."<br/>"; $j=1; } if($punch['attendance_mode']==2 && $a !=1) { if($j==0) $html.='<td colspan="1"></td>'; $attendance_type = $punch['attendance_type']?"Manual":"Device"; $attendance_status=$this->hrmodel->get_employee_attendance_status($rep['device_no'],$rep['employee_id'],$punch['attendance_date'],$punch['attendance_mode']); $html.='<td>'.substr($punch['attendance_date'],11,5).'</td>'; $remarks .= 'BO : '.$punch['attendance_remarks']."<br/>"; $status .= $attendance_status."<br/>"; $type .= 'BO : '.$attendance_type."<br/>"; $j=2; $a=1; } if($punch['attendance_mode']==3 && $b !=1) { if($j==0) $html.='<td colspan="2"></td>'; if($j==1) $html.='<td colspan="1"></td>'; $attendance_type = $punch['attendance_type']?"Manual":"Device"; $attendance_status=$this->hrmodel->get_employee_attendance_status($rep['device_no'],$rep['employee_id'],$punch['attendance_date'],$punch['attendance_mode']); $html.='<td>'.substr($punch['attendance_date'],11,5).'</td>'; $remarks .= 'BI : '.$punch['attendance_remarks']."<br/>"; $status .= $attendance_status."<br/>"; $type .= 'BI : '.$attendance_type."<br/>"; $j=3; $b=1; } if($i==count($punches) && $punch['attendance_mode']==1) { if($j==0) $html.='<td colspan="3"></td>'; if($j==1) $html.='<td colspan="2"></td>'; if($j==2) $html.='<td colspan="1"></td>'; $attendance_type = $punch['attendance_type']?"Manual":"Device"; $attendance_status=$this->hrmodel->get_employee_attendance_status($rep['device_no'],$rep['employee_id'],$punch['attendance_date'],$punch['attendance_mode']); $html.='<td>'.substr($punch['attendance_date'],11,5).'</td>'; $remarks .= 'TO : '.$punch['attendance_remarks']."<br/>"; $status .= $attendance_status."<br/>"; $type .= 'TO : '.$attendance_type."<br/>"; $j=4; } if($i==count($punches)) { if($j==0) $html.='<td colspan="4"></td>'; if($j==1) $html.='<td colspan="3"></td>'; if($j==2) $html.='<td colspan="2"></td>'; if($j==3) $html.='<td colspan="1"></td>'; $html.='<td>'.$remarks.'</td>'; $html.='<td>'.$status.'</td>'; $html.='<td>'.$type.'</td></tr>'; $j=0; } } $date = date("Y-m-d", strtotime("+1 day", strtotime($date))); } $html.='</tbody></table><br/><br/>'; } $html.='<hr>'; $html.='</body></html>'; $filename = "Punch Report"; header("Content-type: application/octet-stream"); header("Content-Disposition: attachment; filename=".$filename.".xls"); header("Pragma: no-cache"); header("Expires: 0"); print $html; exit; ?>