?
Current Path : /home1/savoy/www/savoyglobal.net/sibs_draft/system/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/sibs_draft/system/application/views/HR/pdf_monthly_time_report.php |
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed'); $company_details= $this->mastermodel->get_data_srow('mycompany','1','id'); $html='<html><head><body>'; $html.='<table width="100%"> <tr><td colspan="3"><img src="'.base_url().'logo/default_header.jpg" width="400" height="148"/></td></tr> <tr><td colspan="3" style="font-size:16px;"><b>Monthly Time Report</b></td></tr> <tr><td colspan="3">Period: '.$month.' '.$year.'</td></tr> </table><br><br>'; $html.='<hr>'; $ts = strtotime($month." ".$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++; $i=1; $weekly_holidays=$this->mastermodel->getdatas('timesheet_weekly_holiday','weekly_holiday_id'); $holiday=array(); foreach ($weekly_holidays as $weekly) { $holiday[]=$weekly['weekly_holiday']; } $temp_dept=''; // var_dump($report); foreach($report as $rep) { if($rep['deptid'] != $temp_dept) { $temp_dept=$rep['deptid']; $i=1; $html.="</table><table><tr><td>Department:</td><td>".$rep['departmentname']."</td></tr></table>"; $html.='<table cellspacing="-1" border=1 style="width:100%;text-align:left"> <thead> <tr><td bgcolor="#cdc9c9">Sl No</td> <td bgcolor="#cdc9c9">Employee Name</td> <td bgcolor="#cdc9c9">Employee No</td> <td bgcolor="#cdc9c9">Designation</td>'; $date=$start_date; while (strtotime($date) <= strtotime($end_date)) { $html.='<td bgcolor="#cdc9c9">'.date ("d", strtotime($date)).'</td>'; $date = date ("Y-m-d", strtotime("+1 day", strtotime($date))); } $html .='<td bgcolor="#cdc9c9">Total</td>'; $html .='</tr></thead><tbody>'; } $date=$start_date; $employee_device_id=$rep['device_no']; $html.='<tr><td>'.$i.'</td>'; $html.='<td>'.$rep['name'].'</td>'; $html.='<td>'.$rep['employeeid'].'</td>'; $html.='<td>'.$rep['designation'].'</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=$hours; $total += $hours; } else { if($date<=date("Y-m-d")) $day_type='-'; else $day_type=''; } $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.='<script type="text/php"> if ( isset($pdf) ) { $font = Font_Metrics::get_font("verdana", "normal"); $pdf->page_text(75, 580," Page {PAGE_NUM} of {PAGE_COUNT}", $font, 10, array(0,0,0)); } </script> </body></html>'; pdf_create($html,'Monthly-Time',true); ?>