?
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/pdf_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++; $n=0; $temp_dept=''; foreach($report as $rep) { if($rep['department_id'] != $temp_dept) { $temp_dept=$rep['department_id']; if($n==0) $html.=''; else $html.='</table>'; $html.="<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']." "; $status .= $attendance_status." "; $type .= 'TI : '.$attendance_type." "; $j=1; } if($punch['attendance_mode']==2 && $a !=1) { if($j==0) $html.='<td></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']." "; $status .= $attendance_status." "; $type .= 'BO : '.$attendance_type." "; $j=2; $a=1; } if($punch['attendance_mode']==3 && $b !=1) { if($j==0) $html.='<td></td><td></td>'; if($j==1) $html.='<td></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']." "; $status .= $attendance_status." "; $type .= 'BI : '.$attendance_type." "; $j=3; $b=1; } if($i==count($punches) && $punch['attendance_mode']==1) { if($j==0) $html.='<td></td><td></td><td></td>'; if($j==1) $html.='<td></td><td></td>'; if($j==2) $html.='<td></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']." "; $status .= $attendance_status." "; $type .= 'TO : '.$attendance_type." "; $j=4; } if($i==count($punches)) { if($j==0) $html.='<td></td><td></td><td></td><td></td>'; if($j==1) $html.='<td></td><td></td><td></td>'; if($j==2) $html.='<td></td><td></td>'; if($j==3) $html.='<td></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/>'; $n++; } $html.='<hr>'; //echo $html; $html.='<script type="text/php"> if ( isset($pdf) ) { $font = Font_Metrics::get_font("verdana", "normal"); $pdf->page_text(75, 580, "'.$company_details->footer.' Page {PAGE_NUM} of {PAGE_COUNT}", $font, 10, array(0,0,0)); } </script> </body></html>'; pdf_create($html, 'Punch-Report',1); ?>