?
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/xls_payroll_report.php |
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed'); $this->load->view('documentreadyfunctions'); if(empty($employee)) { echo "<table> <tr><td colspan='7'><strong>No Payroll details for ".$viewinfo->payroll_generation_month." ".$viewinfo->payroll_generation_year." with search criteria entered</td></tr></table>"; } else { echo "<table> <tr><td colspan='7'><strong>Payroll for ".$viewinfo->payroll_generation_month." ".$viewinfo->payroll_generation_year."</td></tr></table>"; $weekly_holidays=$this->mastermodel->getdatas('payroll_weekly_holiday','payroll_weekly_holiday_id'); $holiday=array(); foreach ($weekly_holidays as $weekly) { $holiday[]=$weekly['payroll_weekly_holiday']; } $start_date = date('Y-m-01', strtotime($viewinfo->payroll_generation_year.'-'.$viewinfo->payroll_generation_month.'-01')); $end_date = date('Y-m-t', strtotime($viewinfo->payroll_generation_year.'-'.$viewinfo->payroll_generation_month.'-01')); $special_holiday=$this->payrollmodel->get_special_holiday($start_date,$end_date); $special_holiday_array=array(); foreach ($special_holiday as $special) { $special_holiday_array[]=$special['special_holiday_date']; } $diff = abs(strtotime($end_date) - strtotime($start_date)); $days = floor($diff/(60*60*24)); $days++; $basic_hours = $this->payrollmodel->get_basic_hours($end_date); ?> <table class="sorttimesheet" id="payroll_table"> <tr> <th class="sltd">Sl No</th> <th class="medium">Employee Name</th> <th class="medium">Current Employee Number</th> <th class="medium">Current Trade</th> <th class="medium">Site</th> <th class="medium">Camp</th> <th class="medium">Date of Arrival</th> <th class="medium">Basic Salary</th> <th class="medium">Actual Trade</th> <th class="medium">Old Employee Number</th> <th class="medium">New Basic Salary</th> <th class="medium">Over Time</th> <th class="medium">Previous Balance</th> <th class="medium">Special Allowance</th> <th class="medium">Site Allowance</th> <th class="medium">Absent</th> <th class="medium">Gross Salary</th> <th class="medium">Ticket Refundable</th> <th class="medium">Refundable Amount</th> <th class="medium">Other Allowance</th> <th class="medium">Total Salary</th> <th class="medium">Salary Advance</th> <th class="medium">Other Deductions</th> <th class="medium">Net Salary</th> <th class="medium">Corrected Salary</th> <th class="medium">Payment Status</th> <th class="medium">Employee Number</th> <?php $date=$start_date; while (strtotime($date) <= strtotime($end_date)) { echo "<th class='tiny'>".date ("d", strtotime($date))."</th>"; $date = date ("Y-m-d", strtotime("+1 day", strtotime($date))); } ?> <th class="medium"> OT </th> <th class="medium"> Absent </th> <th class="medium"> Total Hrs </th> <th class="medium"> Normal Rate </th> <th class="medium"> Amount </th> <th class="medium"> % <th class="medium"> Payroll Status </th> <th class="medium"> 500 </th> <th class="medium"> 100 </th> <th class="medium"> 50 </th> <th class="medium"> 10 </th> <th class="medium"> 5 </th> <th class="medium"> 1 </th> <th class="medium"> Total </th> </tr> <?php $slno=0; $no_days=1; $basic_salary_total=0; $ot_amount_total=0; $absent_amount_total=0; $gross_salary_total=0; $total_salary_total=0; $net_salary_total=0; $previous_balance_total=0; $site_allowance_total=0; $special_allowance_total=0; $ticket_refundable_total=0; $refundable_amount_total=0; $other_allowance_total=0; $salary_advance_total=0; $other_deductions_total=0; $timesheet_amount_total=0; $employee_contribution_total=0; $notes_500_total=0; $notes_100_total=0; $notes_50_total=0; $notes_10_total=0; $notes_5_total=0; $notes_1_total=0; $emp_flag=0; foreach($employee as $emp) { if(($this->mastermodel->number_rows('payroll_generation_details','payroll_generation_id',$emp['payroll_generation_id'],'payroll_generation_employee_id',$emp['payroll_generation_employee_id']) > 1) && $emp_flag==0) $emp_flag=1; else $emp_flag=0; if($slno%2==0) $alt="alt"; else $alt="alt1"; $salary=$this->payrollmodel->get_employee_salary($emp['emp_non_id'],$end_date); ?> <tr class="<?=$alt;?>"> <td class="sltd"> <?=++$slno;?> </td> <td class="medium"><?=substr($emp['emp_non_full_name'],0,25);?></td> <td class="medium"><?=$emp['emp_non_no'];?></td> <td class="medium"><?=$this->payrollmodel->get_employee_trade_date($emp['emp_non_id'],$start_date,$end_date,1);?></td> <td class="medium"><?=$this->payrollmodel->get_employee_site_date($emp['emp_non_id'],$start_date,$end_date);?></td> <td class="medium"><?=$this->mastermodel->getSingleFieldValue('camp','camp_name','camp_id',$emp['payroll_generation_camp_id']);?></td> <td class="medium"><?=$this->mastermodel->convertdatenormalformat($emp['emp_non_date_joining']);?></td> <td class="medium"><?=$salary['basic_salary'];?></td> <td class="medium"><?=$this->payrollmodel->get_employee_trade_date($emp['emp_non_id'],$start_date,$end_date,0);?></td> <td class="medium"><?=$emp['emp_non_no_old'];?></td> <td class="medium"> <?php echo $emp['payroll_generation_basic_salary']; if($emp_flag==0) $basic_salary_total+=$emp['payroll_generation_basic_salary']; ?> </td> <td class="medium"> <?php echo $emp['payroll_generation_ot_amount']; if($emp_flag==0) $ot_amount_total+=$emp['payroll_generation_ot_amount']; ?> </td> <td class="medium"> <?php echo $emp['payroll_generation_previous_balance']; if($emp_flag==0) $previous_balance_total+=$emp['payroll_generation_previous_balance']; ?> </td> <td class="medium"> <?php echo $emp['payroll_generation_special_allowance']; if($emp_flag==0) $special_allowance_total+=$emp['payroll_generation_special_allowance']; ?> </td> <td class="medium"> <?php echo $emp['payroll_generation_site_allowance']; if($emp_flag==0) $site_allowance_total+=$emp['payroll_generation_site_allowance']; ?> </td> <td class="medium"> <?php echo $emp['payroll_generation_absent_amount']; if($emp_flag==0) $absent_amount_total+=$emp['payroll_generation_absent_amount']; ?> </td> <td class="medium"> <?php echo $gross_salary=$emp['payroll_generation_basic_salary']+$emp['payroll_generation_ot_amount']+$emp['payroll_generation_previous_balance']+$emp['payroll_generation_special_allowance']+$emp['payroll_generation_site_allowance']-$emp['payroll_generation_absent_amount']; if($emp_flag==0) $gross_salary_total+=$gross_salary; ?> </td> <td class="medium"> <?php echo $emp['payroll_generation_ticket_refundable']; if($emp_flag==0) $ticket_refundable_total+=$emp['payroll_generation_ticket_refundable']; ?> </td> <td class="medium"> <?php echo $emp['payroll_generation_refundable_amount']; if($emp_flag==0) $refundable_amount_total+=$emp['payroll_generation_refundable_amount']; ?> </td> <td class="medium"> <?php echo $emp['payroll_generation_other_allowance']; if($emp_flag==0) $other_allowance_total+=$emp['payroll_generation_other_allowance']; ?> </td> <td class="medium"> <?php echo $total_salary=$gross_salary+$emp['payroll_generation_ticket_refundable']+$emp['payroll_generation_refundable_amount']+$emp['payroll_generation_other_allowance']; if($emp_flag==0) $total_salary_total+=$total_salary; ?> </td> <td class="medium"> <?php echo $emp['payroll_generation_salary_advance']; if($emp_flag==0) $salary_advance_total+=$emp['payroll_generation_salary_advance']; ?> </td> <td class="medium"> <?php echo $emp['payroll_generation_other_deductions']; if($emp_flag==0) $other_deductions_total+=$emp['payroll_generation_other_deductions']; ?> </td> <td class="medium"> <?php echo $net_salary=round($total_salary-$emp['payroll_generation_salary_advance']-$emp['payroll_generation_other_deductions']); if($emp_flag==0) $net_salary_total+=$net_salary; ?> </td> <td class="medium"><?=$emp['payroll_generation_corrected_salary'];?></td> <td class="medium"><?=$emp['payroll_generation_payment_status'];?></td> <td class="medium"><?=$emp['emp_non_no'];?></td> <?php $hours = $this->payrollmodel->get_employee_payroll_hours($emp['payroll_generation_details_id']); $ot_hours = 0; $total_hours = 0; $date=$start_date; $absent=0; $no_days=1; while (strtotime($date) <= strtotime($end_date)) { $color_holiday=0; $no_days++; if(in_array(date('l', strtotime($date)), $holiday)) { $color_holiday="style='background-color:#f3d972'"; } if(array_key_exists($date,$hours)) { $type_hours = explode('~', $hours[$date]); $hours_worked=$type_hours[0]; $reason_worked=$type_hours[1]; $flag=0; if($reason_worked !='') { $flag=1; if(is_numeric($hours_worked) || $hours_worked=="P" || preg_match('/[0-9]/', $hours_worked)) $color="style='background-color:#daf4b2'"; else $color="style='background-color:#f4b2b4'"; } ?> <td class="tiny" <?php if($flag==1){ echo $color; ?> title="<?=$reason_worked;?>" class="tooltip" <?php }elseif($color_holiday!='0') { echo $color_holiday;}?>> <?php if(!is_numeric($hours_worked)){echo "<font color=green>";} if($hours_worked == 'A' || $hours_worked == '0' || $hours_worked == '-'){echo "<font color=red>";}?> <?=$hours_worked;?> <?php if(!is_numeric($hours_worked)){echo "</font>";}?> <?php $total_hours +=$hours_worked; 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(!empty ($special_holiday_array) && in_array($date, $special_holiday_array)) { $ot_hours += $hours_worked; } else if($hours_worked > $basic_hours) $ot_hours += ($hours_worked-$basic_hours); ?> </td> <?php } else { ?> <td class="medium"<?php if($color_holiday!='0') { echo $color_holiday;}?>> <?=0;?> <?php $total_hours +=0; $ot_hours += 0; ?> </td> <?php } $date = date ("Y-m-d", strtotime("+1 day", strtotime($date))); } ?> <td class="medium"><?=number_format($emp['payroll_generation_timesheet_ot'],2);?></td> <td class="medium"><?=$absent;?></td> <td class="medium"><?=$emp['payroll_generation_total_hrs'];?></td> <td class="medium"><?=number_format($emp['payroll_generation_normal_rate'],2);?></td> <td class="medium"> <?php echo number_format($emp['payroll_generation_timesheet_amount'],2); if($emp_flag==0) $timesheet_amount_total+=$emp['payroll_generation_timesheet_amount']; ?> </td> <td class="medium"> <?php echo number_format($emp['payroll_generation_employee_contribution'],2); if($emp_flag==0) $employee_contribution_total+=$emp['payroll_generation_employee_contribution']; ?> </td> <td class="medium"><?=$emp['payroll_generation_payroll_status'];?></td> <?php if($emp_flag==1) { ?> <td colspan="6" class="medium" style="text-align:right"></td> <?php } else { ?> <td class="medium" style="text-align:right"> <?php echo intval($net_salary/500); $notes_500_total+=intval($net_salary/500); ?> </td> <td class="medium" style="text-align:right"> <?php echo intval($net_salary%500/100); $notes_100_total+=intval($net_salary%500/100); ?> </td> <td class="medium" style="text-align:right"> <?php echo intval($net_salary%500%100/50); $notes_50_total+=intval($net_salary%500%100/50); ?> </td> <td class="medium" style="text-align:right"> <?php echo intval($net_salary%500%100%50/10); $notes_10_total+=intval($net_salary%500%100%50/10); ?> </td> <td class="medium" style="text-align:right"> <?php echo intval($net_salary%500%100%50%10/5); $notes_5_total+=intval($net_salary%500%100%50%10/5); ?> </td> <td class="medium" style="text-align:right"> <?php echo intval($net_salary%500%100%50%10%5/1); $notes_1_total+=intval($net_salary%500%100%50%10%5/1); ?> </td> <?php } ?> <td class="medium" style="text-align:right"><?=$net_salary;?></td> </tr> <?php } ?> <tr> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td style="background-color: #DFE5E5;text-align: right;font-weight: bold;" class="medium" colspan="4">Total</td> <td style="background-color: #DFE5E5;text-align: right;font-weight: bold;" class="medium" id="basic_salary_total" style="text-align:right;"><?=number_format($basic_salary_total,2);?></td> <td style="background-color: #DFE5E5;text-align: right;font-weight: bold;" class="medium" id="ot_amount_total" style="text-align:right;"><?=number_format($ot_amount_total,2);?></td> <td style="background-color: #DFE5E5;text-align: right;font-weight: bold;" class="medium" id="previous_balance_total" style="text-align:right;"><?=number_format($previous_balance_total,2);?></td> <td style="background-color: #DFE5E5;text-align: right;font-weight: bold;" class="medium" id="special_allowance_total" style="text-align:right;"><?=number_format($special_allowance_total,2);?></td> <td style="background-color: #DFE5E5;text-align: right;font-weight: bold;" class="medium" id="site_allowance_total" style="text-align:right;"><?=number_format($site_allowance_total,2);?></td> <td style="background-color: #DFE5E5;text-align: right;font-weight: bold;" class="medium" id="absent_amount_total" style="text-align:right;"><?=number_format($absent_amount_total,2);?></td> <td style="background-color: #DFE5E5;text-align: right;font-weight: bold;" class="medium" id="gross_salary_total" style="text-align:right;"><?=number_format($gross_salary_total,2);?></td> <td style="background-color: #DFE5E5;text-align: right;font-weight: bold;" class="medium" id="ticket_refundable_total" style="text-align:right;"><?=number_format($ticket_refundable_total,2);?></td> <td style="background-color: #DFE5E5;text-align: right;font-weight: bold;" class="medium" id="refundable_amount_total" style="text-align:right;"><?=number_format($refundable_amount_total,2);?></td> <td style="background-color: #DFE5E5;text-align: right;font-weight: bold;" class="medium" id="other_allowance_total" style="text-align:right;"><?=number_format($other_allowance_total,2);?></td> <td style="background-color: #DFE5E5;text-align: right;font-weight: bold;" class="medium" id="total_salary_total" style="text-align:right;"><?=number_format($total_salary_total,2);?></td> <td style="background-color: #DFE5E5;text-align: right;font-weight: bold;" class="medium" id="salary_advance_total" style="text-align:right;"><?=number_format($salary_advance_total,2);?></td> <td style="background-color: #DFE5E5;text-align: right;font-weight: bold;" class="medium" id="other_deductions_total" style="text-align:right;"><?=number_format($other_deductions_total,2);?></td> <td style="background-color: #DFE5E5;text-align: right;font-weight: bold;" class="medium" id="net_salary_total" style="text-align:right;"><?=number_format($net_salary_total,2);?></td> <td style="background-color: #DFE5E5;text-align: right;font-weight: bold;" class="medium" colspan="<?=$no_days+6;?>"></td> <td style="background-color: #DFE5E5;text-align: right;font-weight: bold;" class="medium" id="timesheet_amount_total" style="text-align:right;"><?=number_format($timesheet_amount_total,2);?></td> <td style="background-color: #DFE5E5;text-align: right;font-weight: bold;" class="medium" id="employee_contribution_total" style="text-align:right;"><?=number_format(round($employee_contribution_total/$slno,2),2);?></td> <td style="background-color: #DFE5E5;text-align: right;font-weight: bold;" class="medium"></td> <td style="background-color: #DFE5E5;text-align: right;font-weight: bold;" class="medium" id="notes_500_total" style="text-align:right;"><?=$notes_500_total;?></td> <td style="background-color: #DFE5E5;text-align: right;font-weight: bold;" class="medium" id="notes_100_total" style="text-align:right;"><?=$notes_100_total;?></td> <td style="background-color: #DFE5E5;text-align: right;font-weight: bold;" class="medium" id="notes_50_total" style="text-align:right;"><?=$notes_50_total;?></td> <td style="background-color: #DFE5E5;text-align: right;font-weight: bold;" class="medium" id="notes_10_total" style="text-align:right;"><?=$notes_10_total;?></td> <td style="background-color: #DFE5E5;text-align: right;font-weight: bold;" class="medium" id="notes_5_total" style="text-align:right;"><?=$notes_5_total;?></td> <td style="background-color: #DFE5E5;text-align: right;font-weight: bold;" class="medium" id="notes_1_total" style="text-align:right;"><?=$notes_1_total;?></td> <td style="background-color: #DFE5E5;text-align: right;font-weight: bold;" class="medium" id="net_salary_total" style="text-align:right;"><?=$net_salary_total;?></td> </tr> </table> <?php } $filename = "PayrollDetails"; header("Content-type: application/octet-stream"); header("Content-Disposition: attachment; filename=".$filename.".xls"); header("Pragma: no-cache"); header("Expires: 0"); exit; ?>