?
Current Path : /home1/savoy/public_html/savoyglobal.net/hr/application/views/Timesheet/ |
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/hr/application/views/Timesheet/xls_report_invoice.php |
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed'); $html='<html><head><body>'; $html.='<table width="100%"> <tr><td colspan="3" style="font-size:16px;" align="center"><b><u>Invoice Report</u></b></td></tr> </table><br><br>'; $html.='<hr>'; $html.='<table cellspacing="-1" style="width:100%;text-align:left"> <thead> <tr><td style="text-align:left" bgcolor="#7FCEFF">Sl No</td>'; foreach($report as $key=>$val) { $column_name = array_keys($val); } foreach($column_name as $key) $html .= '<td style="text-align:left" bgcolor="#7FCEFF">'.str_replace('_', ' ', $key).'</td>'; $html .='</tr></thead><tbody>'; $i=1; foreach($report as $rep) { //var_dump($rep); $inv=$this->mastermodel->get_data_srow('payroll_invoice',$rep['Total'],'invoice_id'); $start_date=$this->mastermodel->convertdateformat($inv->invoice_start_date); $end_date=$this->mastermodel->convertdateformat($inv->invoice_end_date); $poinfo=$this->mastermodel->get_data('payroll_invoice_purchase_order',$rep['Total'],'invoice_id'); $purchase_order_id=''; foreach($poinfo as $po) $purchase_order_id.=$po['po_id'].'~'; $client_timesheet=$this->timesheetmodel->get_client_timesheet_invoice_info($purchase_order_id,$start_date,$end_date); //$manpower_timesheet=$this->timesheetmodel->get_manpower_timesheet_invoice_info($purchase_order_id,$start_date,$end_date); $html.='<tr style="color:#555555"> <td>'.$i.'</td>'; foreach($column_name as $key) { $pos=strpos($key, 'Date'); if($pos !== false) { $rep[$key]=$this->mastermodel->convertdatenormalformat($rep[$key]); } if($key=='Total') { $slno=1; $grand_total=0; foreach($client_timesheet as $clientsheet) { $normal_hours=$clientsheet['normal_hours']; if($clientsheet['ot_rate']==$clientsheet['normal_rate']) { $normal_hours+=$clientsheet['ot_hours']; } if($clientsheet['hot_rate']==$clientsheet['normal_rate']) { $normal_hours+=$clientsheet['hot_hours']; } $total_amount = $normal_hours*$clientsheet['normal_rate'] + $clientsheet['ot_hours']*$clientsheet['ot_rate'] + $clientsheet['hot_hours']*$clientsheet['hot_rate']; $grand_total+=$total_amount; } $rep[$key]=$grand_total; } $html .= '<td>'.$rep[$key].'</td>'; } $html .='</tr>'; $i++; } $html.=' </tbody></table>'; $html.='<hr>'; $html.=' </body></html>'; $filename = "InvoiceReport"; header("Content-type: application/octet-stream"); header("Content-Disposition: attachment; filename=".$filename.".xls"); header("Pragma: no-cache"); header("Expires: 0"); print $html; exit; ?>