?
Current Path : /home1/savoy/public_html/savoyglobal.net/hr/application/views/Payroll/ |
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/Payroll/xls_pay_slip.php |
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed'); $start_date = date('Y-m-01', strtotime($salary->payroll_generation_year.'-'.$salary->payroll_generation_month.'-01')); $end_date = date('Y-m-t', strtotime($salary->payroll_generation_year.'-'.$salary->payroll_generation_month.'-01')); $html='<html><head><body>'; $html.='<table width="100%"> <tr><td colspan="20" style="font-size:16px;" align="center"><b><u>'.$salary->sponsor_name.'</u></b></td></tr> <tr><td colspan="20" style="font-size:16px;" align="center">'.nl2br($salary->sponsor_address).'</td></tr> </table><br><br>'; $html.='<hr>'; $html.='<table style="text-align:left"> <tr> <td>Name:</td><td>'.$salary->emp_non_full_name.'</td> <td></td><td></td> <td>Employee No:</td><td>'.$salary->emp_non_no_old.', '.$salary->emp_non_no.'</td> </tr> <tr> <td>Trade:</td><td>'.$salary->trade_name.'</td> <td>Salary Rate:</td><td>'.$salary->payroll_generation_basic_salary.'</td> <td>Year:</td><td>'.$salary->payroll_generation_year.'</td> </tr> <tr> <td>Job Site:</td><td>'.$this->payrollmodel->get_employee_site_date($salary->emp_non_id,$start_date,$end_date).'</td> <td></td><td></td> <td>Year:</td><td>'.$salary->payroll_generation_month.'</td> </tr> </table><table border=1><tr>'; $hours = $this->payrollmodel->get_employee_payroll_hours($salary->payroll_generation_details_id); $ot_hours_total = 0; $total_hours = 0; $date=$start_date; $absent=0; $no_days=1; $basic_hours = $this->payrollmodel->get_basic_hours($end_date); $ot_perc = $this->payrollmodel->get_ot_perc($end_date); $weekly_holidays=$this->mastermodel->getdatas('payroll_weekly_holiday','payroll_weekly_holiday_id'); $working_days=0; $holiday=array(); foreach ($weekly_holidays as $weekly) { $holiday[]=$weekly['payroll_weekly_holiday']; } while (strtotime($date) <= strtotime($end_date)) { $no_days++; if(array_key_exists($date,$hours)) { $html.='<td>'.date ("d", strtotime($date)).'</td>'; $date = date ("Y-m-d", strtotime("+1 day", strtotime($date))); } } $html .="</tr><tr>"; $date=$start_date; while (strtotime($date) <= strtotime($end_date)) { if(array_key_exists($date,$hours)) { if(is_numeric($hours[$date]) && $hours[$date]>0) $type_attendance='P'; else if(is_numeric($hours[$date]) && $hours[$date]==0) $type_attendance="<font color='red'>A</font>"; else $type_attendance="<font color='red'>".$hours[$date]."</font>"; $total_hours +=$hours[$date]; $html.='<td>'.$type_attendance.'</td>'; $date = date ("Y-m-d", strtotime("+1 day", strtotime($date))); } } $html .="</tr><tr>"; $date=$start_date; while (strtotime($date) <= strtotime($end_date)) { $ot_hours=0; if(array_key_exists($date,$hours)) { if($hours[$date] == "A" || $hours[$date] == "a" || $hours[$date] == "0") { $absent ++; $ot_hours += 0; } else if(in_array(date('l', strtotime($date)), $holiday)) { $ot_hours += $hours[$date]; $working_days--; } else if($this->mastermodel->number_rows('payroll_special_holiday','special_holiday_date',$date)>0) { $ot_hours += $hours[$date]; $working_days--; } else if($hours[$date] > $basic_hours) $ot_hours += ($hours[$date]-$basic_hours); $html.='<td>'.$ot_hours.'</td>'; $ot_hours_total+=$ot_hours; $date = date ("Y-m-d", strtotime("+1 day", strtotime($date))); } } $html .='</tr></table>'; $total_salary = $salary->payroll_generation_basic_salary+$salary->payroll_generation_ot_amount+$salary->payroll_generation_previous_balance+$salary->payroll_generation_special_allowance+$salary->payroll_generation_site_allowance-$salary->payroll_generation_absent_amount+$salary->payroll_generation_ticket_refundable+$salary->payroll_generation_refundable_amount+$salary->payroll_generation_other_allowance; $net_salary = number_format(round($total_salary - $salary->payroll_generation_salary_advance -$salary->payroll_generation_other_deductions ),2); $html.='<table style="text-align:left"> <tr> <td>TOTAL DAYS WORKED ('.$no_days.'*'.round($salary->payroll_generation_basic_salary/$no_days,2).'):</td><td>QAR</td><td style="text-align:right;">'.round($salary->payroll_generation_basic_salary,2).'</td> </tr> <tr> <td>TOTAL OVER TIME ('.$ot_hours_total.'*'.round($salary->payroll_generation_basic_salary/$no_days/$basic_hours,2).'*'.($ot_perc/100).')</td><td>QAR</td><td style="text-align:right;">'.$salary->payroll_generation_ot_amount.'</td> </tr> <tr> <td>SPECIAL ALLOWANCE:</td><td>QAR</td><td style="text-align:right;">'.number_format($salary->payroll_generation_special_allowance,2).'</td> </tr> <tr> <td>PREVIOUS ALLOWANCE:</td><td>QAR</td><td style="text-align:right;">'.number_format($salary->payroll_generation_previous_balance,2).'</td> </tr> <tr> <td>TICKET CASH:</td><td>QAR</td><td style="text-align:right;">'.number_format($salary->payroll_generation_ticket_refundable,2).'</td> </tr> <tr> <td>SITE ALLOWANCE:</td><td>QAR</td><td style="text-align:right;">'.number_format($salary->payroll_generation_site_allowance,2).'</td> </tr> <tr> <td>ABSENT AMOUNT:</td><td>QAR</td><td style="text-align:right;">'.number_format($salary->payroll_generation_absent_amount,2).'</td> </tr> <tr> <td>OTHER ALLOWANCE:</td><td>QAR</td><td style="text-align:right;">'.number_format($salary->payroll_generation_other_allowance,2).'</td> </tr> <tr> <td>TOTAL:</td><td>QAR</td><td style="text-align:right;">'.number_format($total_salary,2).'</td> </tr> <tr> <td>OTHER DEDUCTION:</td><td>QAR</td><td style="text-align:right;">'.$salary->payroll_generation_other_deductions.'</td> </tr> <tr> <td>TOTAL SALARY:</td><td>QAR</td><td style="text-align:right;">'.number_format(($total_salary - $salary->payroll_generation_other_deductions),2).'</td> </tr> <tr> <td>SALARY ADVANCE:</td><td>QAR</td><td style="text-align:right;">'.$salary->payroll_generation_salary_advance.'</td> </tr> <tr> <td>NET PAYABLE:</td><td>QAR</td><td style="text-align:right;">'.$net_salary.'</td> </tr> </table>'; $html.='<hr>'; header("Content-type: application/octet-stream"); header("Content-Disposition: attachment; filename=".$salary->emp_non_no.".xls"); header("Pragma: no-cache"); header("Expires: 0"); print $html; exit; ?>