?
Current Path : /home1/savoy/www/savoyglobal.net/horeitia/application/views/Reports/ |
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/horeitia/application/views/Reports/xls_report_absencelist.php~ |
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed'); $html='<html><head><body>'; $html.='<table width="100%"> <tr><td colspan="2"></td><td align="right"><img src="'.base_url().'assets/images/logo.gif" style="float:right"/></td> <tr><td colspan="3" style="font-size:16px;" align="center"><b><u>Daily & Monthly Absence Report</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>'; $html.='<table cellspacing="-1" style="width:100%;text-align:left"> <thead> <tr bgcolor="#7FCEFF"><th style="text-align:left" bgcolor="#7FCEFF">Sl No</th> <th style="text-align:left" bgcolor="#7FCEFF">Date</th> <th style="text-align:left" bgcolor="#7FCEFF">Employee No</th> <th style="text-align:left" bgcolor="#7FCEFF">Employee Name</th> <th style="text-align:left" bgcolor="#7FCEFF">Trade</th> <th style="text-align:left" bgcolor="#7FCEFF">Camp</th> <th style="text-align:left" bgcolor="#7FCEFF">Site</th> <th style="text-align:left" bgcolor="#7FCEFF">Reason</th></tr></thead><tbody>'; $i=1; foreach($report as $rep) { print_r($rep); $atdate=$rep['attendance_date']; $empname=$rep['emp_non_full_name']; $empno="⁣".$this->mastermodel->correctempno($rep['emp_non_no']); $reason=$rep['attendance_list_reason']; $camp=$this->reportmodel->findemployeecamp($rep['employee_id'],$atdate); if(!empty ($camp)) { $campname=$camp->camp_name; $campid=$camp->camp_id; } else { $campname=""; $campid=""; } $trade=$this->reportmodel->findemployeetrade($rep['employee_id'],$atdate); if(!empty ($trade)) { $tradename=$trade->trade_name; } else { $tradename=""; } $site=$this->reportmodel->findemployeesite($rep['employee_id'],$atdate); if(!empty ($site)) { $sitename=$site->site_name; } else { $sitename=""; } $atdate= $this->mastermodel->convdatformat($atdate); if(!empty($postdata['camp_name'])) { if($postdata['camp_name']==$campid) { $html.='<tr style="color:#555555"><td>'.$i.'</td> <td>'.$atdate.'</td> <td>'.$empno.'</td> <td>'.$empname.'</td> <td>'.$tradename.'</td> <td>'.$campname.'</td> <td>'.$sitename.'</td> <td>'.$reason.'</td></tr>'; $i++; } } else { $html.='<tr style="color:#555555"> <td>'.$i.'</td> <td>'.$atdate.'</td> <td>'.$empno.'</td> <td>'.$empname.'</td> <td>'.$tradename.'</td> <td>'.$campname.'</td> <td>'.$sitename.'</td> <td>'.$reason.'</td> </tr>'; $i++; } } $html.='</tbody></table><br/><br/><br/>'; $html.='<hr>'; if(!empty($postdata['camp_name'])) { $camp_count=array(); $total_reason_count = 0; $camp_list=$this->mastermodel->get_data('camp',$postdata['camp_name'],'camp_id'); $attendance_list=$this->mastermodel->getdatas('attendance_list','attendance_list_reason'); $html .= '<table cellspacing="-1" style="width:100%;text-align:left;"> <thead> <tr bgcolor="#B5B5B5"><th style="text-align:left" bgcolor="#B5B5B5"></th>'; $k=1; foreach($camp_list as $camp) { $html .= '<th style="text-align:left" bgcolor="#B5B5B5">'.$camp['camp_name'].'</th>'; $camp_count[$k]=0; $k++; } $html .= '<th style="text-align:left" bgcolor="#B5B5B5">Total</th></tr>'; foreach($attendance_list as $reason) { $html .= '<tr><td style="text-align:left">'.$reason['attendance_list_reason'].'</td>'; $reason_count=0; $i=1; $k=1; foreach($camp_list as $camp) { $count=0; $count = $this->reportmodel->get_reason_absent_count($camp['camp_id'],$reason['attendance_list_id'],$postdata['from_date'],$postdata['to_date'],$postdata['employee_status']); if($count==0) $count=""; $reason_count+=$count; $camp_count[$k]+=$count; $k++; $html .= '<td>'.$count.'</td>'; } $html .= '<td>'.$reason_count.'</td></tr>'; $total_reason_count+=$reason_count; } $html .= '<tr bgcolor="#B5B5B5"><td bgcolor="#B5B5B5">Total</td>'; $k=1; foreach($camp_list as $camp) { $html .= '<td bgcolor="#B5B5B5">'.$camp_count[$k].'</td>'; $k++; } $html .= '<td bgcolor="#B5B5B5">'.$total_reason_count.'</td></tr>'; $html .= '</table>'; } else { $camp_count=array(); $total_reason_count = 0; $camp_list=$this->mastermodel->getdatas('camp','camp_name'); $attendance_list=$this->mastermodel->getdatas('attendance_list','attendance_list_reason'); $html .= '<table cellspacing="-1" style="width:100%;text-align:left;"> <thead> <tr bgcolor="#B5B5B5"><th style="text-align:left" bgcolor="#B5B5B5"></th>'; $k=1; foreach($camp_list as $camp) { $html .= '<th style="text-align:left" bgcolor="#B5B5B5">'.$camp['camp_name'].'</th>'; $camp_count[$k]=0; $k++; } $html .= '<th style="text-align:left" bgcolor="#B5B5B5">Total</th></tr>'; foreach($attendance_list as $reason) { $html .= '<tr><td style="text-align:left">'.$reason['attendance_list_reason'].'</td>'; $reason_count=0; $i=1; $k=1; foreach($camp_list as $camp) { $count=0; $count = $this->reportmodel->get_reason_absent_count($camp['camp_id'],$reason['attendance_list_id'],$postdata['from_date'],$postdata['to_date'],$postdata['employee_status']); if($count==0) $count=""; $reason_count+=$count; $camp_count[$k]+=$count; $k++; $html .= '<td>'.$count.'</td>'; } $html .= '<td>'.$reason_count.'</td></tr>'; $total_reason_count+=$reason_count; } $html .= '<tr bgcolor="#B5B5B5"><td bgcolor="#B5B5B5">Total</td>'; $k=1; foreach($camp_list as $camp) { $html .= '<td bgcolor="#B5B5B5">'.$camp_count[$k].'</td>'; $k++; } $html .= '<td bgcolor="#B5B5B5">'.$total_reason_count.'</td></tr>'; $html .= '</table>'; } $html.='</body></html>'; $html.='<script type="text/php"> if ( isset($pdf) ) { $font = Font_Metrics::get_font("verdana", "normal"); $pdf->page_text(75, 570, "Horeitia Global WLL | T. 44674442 | F. 44673111 | info@horeitiaglobal.com | www.horeitiaglobal.net | Po Box 31450, Doha, Qatar Page {PAGE_NUM} of {PAGE_COUNT}", $font, 10, array(0,0,0)); } </script>'; $html.='</body></html>'; $filename = "Daily & Monthly Absence Report"; header("Content-type: application/octet-stream"); header("Content-Disposition: attachment; filename=".$filename.".xls"); header("Pragma: no-cache"); header("Expires: 0"); print $html; exit; ?>