?
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_internal_timesheet.php |
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed'); $this->load->view('documentreadyfunctions'); echo " <table> <tr><td colspan='7'><strong>".$this->mastermodel->getSingleFieldValue('camp','camp_name','camp_id',$viewinfo->internal_job_camp_id)."</strong></td></tr> <tr><td colspan='7'><strong>Timesheet for ".$viewinfo->internal_job_code." for the Period of ".$this->mastermodel->convertdatenormalformat($viewinfo->internal_timesheet_start_date)." to ".$this->mastermodel->convertdatenormalformat($viewinfo->internal_timesheet_end_date)."</strong></td></tr> </table>"; ?> <table class="sorttimesheet"> <?php $diff = abs(strtotime($viewinfo->internal_timesheet_end_date) - strtotime($viewinfo->internal_timesheet_start_date)); $days = floor($diff/(60*60*24)); $days++; ?> <tr> <th class="sltd">Sl No</th> <th class="medium">Employee Name</th> <th class="medium">Employee No</th> <?php $date=$viewinfo->internal_timesheet_start_date; while (strtotime($date) <= strtotime($viewinfo->internal_timesheet_end_date)) { echo "<th class='tiny'>".date ("d", strtotime($date))."</th>"; $date = date ("Y-m-d", strtotime("+1 day", strtotime($date))); } ?> <th class="medium"> Normal Hrs </th> <th class="medium"> OT Hrs </th> <th class="medium"> HOT Hrs </th> <th class="medium"> Total Hrs </th> </tr> <?php $weekly_holidays=$this->mastermodel->getdatas('payroll_weekly_holiday','payroll_weekly_holiday_id'); $holiday=array(); foreach ($weekly_holidays as $weekly) { $holiday[]=$weekly['payroll_weekly_holiday']; } $timesheet_details=$this->timesheetmodel->get_timesheet_employee_details_internal($viewinfo->internal_timesheet_id); $x=1; $grand_working_hours=0; $grand_hours_basic=0; $grand_ot_hours=0; $grand_hot_hours=0; $flag=''; foreach ($timesheet_details as $timesheet) { ?> <?php if($flag!=$timesheet['trade_name']) { $flag=$timesheet['trade_name']; if(isset ($trade_working_hours)) { ?> <tr> <td class="sltd" style="background-color: #DFE5E5;"></td> <td class="medium" style="background-color: #DFE5E5;"></td> <td class="medium" style="background-color: #DFE5E5;text-align: right;font-weight: bold;">Total</td> <td style="background-color: #DFE5E5;" colspan="<?=$days;?>"></td> <td class="medium" style="background-color: #DFE5E5;text-align: right;font-weight: bold;"><?=number_format($trade_hours_basic,2);?></td> <td class="medium" style="background-color: #DFE5E5;text-align: right;font-weight: bold;"><?=number_format($trade_ot_hours,2);?></td> <td class="medium" style="background-color: #DFE5E5;text-align: right;font-weight: bold;"><?=number_format($trade_hot_hours,2);?></td> <td class="medium" style="background-color: #DFE5E5;text-align: right;font-weight: bold;"><?=number_format($trade_working_hours,2);?></td> </tr> <?php } ?> <tr> <td class="sltd"></td> <td class="medium"></td> <td class="medium" style="height:20px;"><strong><?=$flag;?></strong></td> <td colspan="<?=$days+3;?>"></td> </tr> <?php $slno=1; $trade_working_hours=0; $trade_hours_basic=0; $trade_ot_hours=0; $trade_hot_hours=0; } ?> <tr> <td class="sltd"><?=$slno++;?></td> <td class="medium"><?=$timesheet['emp_non_full_name'];?></td> <td class="medium"><?=$timesheet['emp_non_no'];?> <input type="hidden" name="employee_id[]" value="<?=$timesheet['internal_timesheet_employee_id'];?>"/> </td> <?php $i=1; $total_hours=0; $normal_ot_hours=0; $holiday_ot_hours=0; $working_days=$days; $normal_hours=0; $attendance_days = $this->timesheetmodel->get_attendance_days_internal($viewinfo->internal_timesheet_id,$timesheet['internal_timesheet_employee_id']); foreach ($attendance_days as $att) { ?> <td class="tiny" style="text-align: right;"> <?php if(!is_numeric($att['internal_timesheet_no_hours'])) echo "<font color='#ff0000'>".$att['internal_timesheet_no_hours']."</font>"; else echo $att['internal_timesheet_no_hours']; $total_hours+=$att['internal_timesheet_no_hours']; $basic_hours=$this->timesheetmodel->get_basic_hours($att['internal_timesheet_date']); if(in_array(date('l', strtotime($att['internal_timesheet_date'])), $holiday)) { $working_days=$working_days-1; $holiday_ot_hours+=$att['internal_timesheet_no_hours']; } else if($this->mastermodel->number_rows('payroll_special_holiday','special_holiday_date',$att['internal_timesheet_date'])>0) { $working_days=$working_days-1; $holiday_ot_hours+=$att['internal_timesheet_no_hours']; } else { if($att['internal_timesheet_no_hours']>$basic_hours) $normal_ot_hours+=$att['internal_timesheet_no_hours']-$basic_hours; if($att['internal_timesheet_no_hours']<=$basic_hours) $normal_hours+=$att['internal_timesheet_no_hours']; else $normal_hours+=$basic_hours; } ?> </td> <?php $i++; } ?> <td class="medium" style="text-align: right;"> <?php echo number_format($normal_hours, 2); ?> </td> <td class="medium" style="text-align: right;"> <?=number_format($normal_ot_hours, 2);?> </td> <td class="medium" style="text-align: right;"> <?=number_format($holiday_ot_hours, 2);?> </td> <td class="medium" style="text-align: right;"> <?=number_format($total_hours, 2);?> </td> </tr> <?php $trade_working_hours+=$total_hours; $trade_hours_basic+=$normal_hours; $trade_ot_hours+=$normal_ot_hours; $trade_hot_hours+=$holiday_ot_hours; $grand_working_hours+=$total_hours; $grand_hours_basic+=$normal_hours; } ?> <tr> <td class="sltd" style="background-color: #DFE5E5;"></td> <td class="medium" style="background-color: #DFE5E5;"></td> <td class="medium" style="background-color: #DFE5E5;text-align: right;font-weight: bold;">Total</td> <td style="background-color: #DFE5E5;" colspan="<?=$days;?>"></td> <td class="medium" style="text-align: right;font-weight: bold;"><?=number_format($trade_hours_basic,2);?></td> <td class="medium" style="text-align: right;font-weight: bold;"><?=number_format($trade_ot_hours,2);?></td> <td class="medium" style="text-align: right;font-weight: bold;"><?=number_format($trade_hot_hours,2);?></td> <td class="medium" style="text-align: right;font-weight: bold;"><?=number_format($trade_working_hours,2);?></td> </tr> <tr> <td class="sltd" style="background-color: #DFE5E5;"></td> <td class="medium" style="background-color: #DFE5E5;"></td> <td class="medium" style="background-color: #DFE5E5;text-align: right;font-weight: bold;">Grand Total</td> <td style="background-color: #DFE5E5;" colspan="<?=$days;?>"></td> <td class="medium" style="text-align: right;font-weight: bold;"><?=number_format($grand_hours_basic,2);?></td> <td class="medium" style="text-align: right;font-weight: bold;"><?=number_format($grand_ot_hours,2);?></td> <td class="medium" style="text-align: right;font-weight: bold;"><?=number_format($grand_hot_hours,2);?></td> <td class="medium" style="text-align: right;font-weight: bold;"><?=number_format($grand_working_hours,2);?></td> </tr> </table> <?php $filename = "InternalTimesheet"; header("Content-type: application/octet-stream"); header("Content-Disposition: attachment; filename=".$filename.".xls"); header("Pragma: no-cache"); header("Expires: 0"); exit; ?>