?
Current Path : /home1/savoy/public_html/savoyglobal.net/horeitia/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/horeitia/application/views/Payroll/pdf_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 style="font-size:16px;" align="center"><b><u>'.$salary->sponsor_name.'</u></b></td></tr> <tr><td style="font-size:16px;" align="center">'.nl2br($salary->sponsor_address).'</td></tr> </table><br><br>'; $html.='<hr>'; $html.='<table style="text-align:left" width="100%"> <tr> <td>Name:</td><td><u>'.$salary->emp_non_full_name.'</u></td> <td></td><td></td> <td>Employee No:</td><td><u>'.$salary->emp_non_no_old.', '.$salary->emp_non_no.'</u></td> </tr> <tr> <td>Trade:</td><td><u>'.$salary->trade_name.'</u></td> <td>Salary Rate:</td><td><u>'.$salary->payroll_generation_basic_salary.'</u></td> <td>Year:</td><td><u>'.$salary->payroll_generation_year.'</u></td> </tr> <tr> <td>Job Site:</td><td><u>'.$this->payrollmodel->get_employee_site_date($salary->emp_non_id,$start_date,$end_date).'</u></td> <td></td><td></td> <td>Month:</td><td><u>'.$salary->payroll_generation_month.'</u></td> </tr> </table><br><br><table border=1 cellspacing="-1" width="100%"><tr><td>Date</td>'; $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=0; $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'); $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><td>Attendance</td>"; $date=$start_date; while (strtotime($date) <= strtotime($end_date)) { if(array_key_exists($date,$hours)) { $type_hours = explode('~', $hours[$date]); $hours_worked=$type_hours[0]; if(is_numeric($hours_worked) && $hours_worked>0) $type_attendance='P'; else if($hours_worked == 'A' || $hours_worked == '0' || $hours_worked == 'a' || $hours_worked == '' || $hours_worked == '-') $type_attendance="<font color='red'>A</font>"; else $type_attendance="<font color='red'>".$hours_worked."</font>"; $total_hours +=$hours_worked; $html.='<td>'.$type_attendance.'</td>'; $date = date ("Y-m-d", strtotime("+1 day", strtotime($date))); } } $html .="</tr><tr><td>OT</td>"; $date=$start_date; while (strtotime($date) <= strtotime($end_date)) { $ot_hours=0; if(array_key_exists($date,$hours)) { $type_hours = explode('~', $hours[$date]); $hours_worked=$type_hours[0]; if($hours_worked == 'A' || $hours_worked == '0' || $hours_worked == 'a' || $hours_worked == '' || $hours_worked == '-') { $absent ++; $ot_hours += 0; } else if(in_array(date('l', strtotime($date)), $holiday)) { $ot_hours += $hours_worked; } else if($this->mastermodel->number_rows('payroll_special_holiday','special_holiday_date',$date)>0) { $ot_hours += $hours_worked; } else if(is_numeric ($hours_worked) && ($hours_worked > $basic_hours)) $ot_hours += ($hours_worked-$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_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.='<br><br><table width="100%"><tr><td><table width="70%;" border=1 cellspacing=-1 style="text-align:left;float:left" > <tr> <td width="70%">TOTAL DAYS WORKED ('.($no_days-$absent).'*'.round($salary->payroll_generation_basic_salary/($no_days-$absent),2).')</td><td width="10%">QAR</td><td width="20%"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 colspan=3></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>REFUNDABLE AMOUNT</td><td>QAR</td><td style="text-align:right;">'.number_format($salary->payroll_generation_refundable_amount,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>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 colspan=3></td> </tr> <tr> <td><b>NET PAYABLE</b></td><td><b>QAR</b></td><td style="text-align:right;">'.$net_salary.'</b></td> </tr> </table><td><td><br/><br/><br/><br/><table width="70%" border=1 cellspacing=-1 style="text-align:right;float:right"> <tr> <td style="height:100px;width:150px;"> </td> </tr></table></td></tr></table>'; echo $html; // 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; ?>