?
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/enter_client_timesheet.php |
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed'); $this->load->view('Timesheet/timesheetfunctions.php'); ?> <script type="text/javascript" src="<?=base_url()?>assets/js/datepickr.js"></script> <script type="text/javascript" src="<?=base_url()?>assets/js/jquery.freezecolumn.js"></script> <script type="text/javascript"> jQuery(document).ready(function() { $('.sorttimesheet').freezeTableColumn( { freezColumnCount:5, fixedWidth:40, tableBodyHeight : screen.height-390, showDeleteButton : true, deleteImgsrc : "<?=base_url()?>assets/images/delete-icon.png", showAddButton : true, addImgSrc : "<?=base_url()?>assets/images/add-icon.png" }); }); function set_value(status) { if(status==0) { if($('#timesheet_status_check').is(":checked")) $('#timesheet_status').val("Complete"); else $('#timesheet_status').val("Incomplete"); } else { if($('#timesheet_status_check_'+status).is(":checked")) $('#timesheet_status_'+status).val("Complete"); else $('#timesheet_status_'+status).val("Incomplete"); } } </script> <script language="javascript" type="text/javascript"> jQuery(document).ready(function() { var trade_string = $('#trade_string').val(); var end_date = $('#end_date').val(); suggestValues(<?=$viewinfo->client_timesheet_id;?>,trade_string,end_date); }); </script> <div id="timesheet-success-panel"></div> <fieldset class="timesheetfieldset"> <?php $attributes=array('id'=>'validateform','class'=>'customForm'); echo form_open('timesheet/enter_client_timesheet_details',$attributes); $trade_string=''; $po_trades=$this->mastermodel->get_data('payroll_purchase_order_details',$viewinfo->purchase_order_id,'purchase_order_id'); foreach($po_trades as $trade) { $trade_string .= $trade['purchase_order_trade_id'].','; } ?> <input type="hidden" name="trade_string" id="trade_string" value="<?=$trade_string;?>"/> <input type="hidden" name="end_date" id="end_date" value="<?=$viewinfo->client_timesheet_end_date;?>"/> <ul> <li> <h2><?=$viewinfo->purchase_order_company_name;?></h2> <h2> Timesheet for <?php echo $this->mastermodel->getSingleFieldValue('payroll_customer','customer_name','customer_id',$viewinfo->customer_id);?> for <?php echo $this->mastermodel->getSingleFieldValue('site','site_name','site_id',$viewinfo->purchase_order_site_id);?> for the Period of <?=$this->mastermodel->convertdatenormalformat($viewinfo->client_timesheet_start_date)?> to <?=$this->mastermodel->convertdatenormalformat($viewinfo->client_timesheet_end_date)?> </h2> </li> <li> <div class="timesheet_header"> <input id="from_date" class="date-pick medium" value="<?=$this->mastermodel->convertdatenormalformat($viewinfo->client_timesheet_start_date)?>"/> <script type="text/javascript"> new datepickr('from_date', { dateFormat: 'd-m-Y' }); </script> </div> <div class="timesheet_header"> <input id="to_date" class="date-pick medium" value="<?=$this->mastermodel->convertdatenormalformat($viewinfo->client_timesheet_end_date)?>"/> <script type="text/javascript"> new datepickr('to_date', { dateFormat: 'd-m-Y' }); </script> </div> <div class="timesheet_header"> <input type="text" name="hours" id="hours" class="tiny" value="<?=$viewinfo->purchase_order_hours_basic;?>"> </div> <div class="timesheet_header" style="padding-top:7px;"> <a href="#" onclick="fill_hours()">Fill</a> </div> <input type="submit" class="clickimage" onclick="return check_hours_added();" value="Save" style="width:80px;"/> </li> <li> <div id="freezTable" style="width: 99%;height: 80%;margin: 0 auto;"> <table class="sorttimesheet"> <?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']; } $diff = abs(strtotime($viewinfo->client_timesheet_end_date) - strtotime($viewinfo->client_timesheet_start_date)); $days = floor($diff/(60*60*24)); $days++; ?> <tr> <th class="large">Employee Name</th> <th class="medium">Trade</th> <th class="medium">Employee No</th> <th class="large">Company</th> <th class="medium">Trade Code</th> <?php $date=$viewinfo->client_timesheet_start_date; while (strtotime($date) <= strtotime($viewinfo->client_timesheet_end_date)) { echo "<th class='medium'>".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> <th class="medium">Normal Rate</th> <th class="medium">OT Rate</th> <th class="medium">HOT Rate</th> <th class="medium">Normal Amount</th> <th class="medium">OT Amount</th> <th class="medium">HOT Amount</th> <th class="medium">Total Amount</th> <th class="large">Status</th> <!-- <th class="medium"></th>--> </tr> <tr> <td class="large"> <input class="medium" type="text" name="employee" id="employee" onblur="get_employee_details();" /> <input type="hidden" name="employee_id" id="employee_id" /> </td> <td class="medium"><span id="employee_trade"></span><input type="hidden" name="trade_id" id="trade_id"/></td> <td class="medium"><span id="employee_no"></span></td> <td class="large"><span id="employee_company"></span><input type="hidden" name="company_id" id="company_id"/></td> <td class="medium"><input type="text" name="trade_code" id="trade_code" class="medium" onfocus="get_employee_details();"/></td> <?php $date=$viewinfo->client_timesheet_start_date; $i=1; $holiday_string = ''; while (strtotime($date) <= strtotime($viewinfo->client_timesheet_end_date)) { if(in_array(date('l', strtotime($date)), $holiday)) { $day_type= substr(date('l', strtotime($date)), 0,1); $color=1; $holiday_string .= $date.', '; } else if($this->mastermodel->number_rows('payroll_special_holiday','special_holiday_date',$date)>0) { $day_type='H'; $color=1; $holiday_string .= $date.', '; } else { $day_type=''; $color=0; } ?> <td class="medium"> <input type="hidden" id="attendance_date<?=$i;?>" name="attendance_date<?=$i;?>" value="<?=$date;?>" alt='noclear' data-default='<?=$date;?>'/> <input type='hidden' value="<?=$day_type;?>" class='tiny' id="attendance_day_hidden<?=$i;?>" alt='noclear' data-default='<?=$day_type;?>'/> <input name="attendance_day<?=$i;?>" type='text' onchange="check_hours(this.id);check_employee_hours_client(this.id,'<?=$date;?>',0);calculate_hours();" class='small <?=$date;?>' <?php if($color==1){?> style="color:#ff0000;" alt='noclear' data-default='<?=$day_type;?>' <?php } ?> id="attendance_day<?=$i;?>" value="<?=$day_type;?>" /></td> <?php $i++; $date = date("Y-m-d", strtotime("+1 day", strtotime($date))); } ?> <td class="medium"> <input type='text' name="normal_hours" class='small' id="normal_hours" value="0" onchange="calculate_total_amounts();"/> <input type='hidden' id="rates_po" /> </td> <td class="medium"> <input type='text' name="ot_hours" class='small' id="ot_hours" value="0" onchange="calculate_total_amounts();" /> </td> <td class="medium"> <input type='text' name="hot_hours" class='small' id="hot_hours" value="0" onchange="calculate_total_amounts();"/> </td> <td class="medium"> <span id="total_hours"></span> </td> <td class="medium"> <input type='text' name="basic_rate" class='small' id="basic_rate" value="0" onchange="calculate_total_amounts();"/> </td> <td class="medium"> <input type='text' name="ot_rate" class='small' id="ot_rate" value="0" onchange="calculate_total_amounts();"/> </td> <td class="medium"> <input type='text' name="hot_rate" class='small' id="hot_rate" value="0" onchange="calculate_total_amounts();" /> </td> <td class="medium"> <span id="normal_amount"></span> </td> <td class="medium"> <span id="ot_amount"></span> </td> <td class="medium"> <span id="hot_amount"></span> </td> <td class="medium"> <span id="total_amount"></span> </td> <td class="large"> <input type="checkbox" id="timesheet_status_check" onclick="set_value(0)" style="width:15px;"/> <input type="hidden" id="timesheet_status" name="timesheet_status" value="Incomplete" /> </td> </tr> <?php $timesheet_details=$this->timesheetmodel->get_client_timesheet_details($viewinfo->client_timesheet_id); $x=1; $j=1; foreach ($timesheet_details as $timesheet) { if($timesheet['client_timesheet_company_id']==0) { $employee=$this->mastermodel->get_data_srow('employee_non_main',$timesheet['client_timesheet_employee_id'],'emp_non_id'); $employee_name = $employee->emp_non_full_name; $employee_no = $employee->emp_non_no; $trade_id=$timesheet['client_timesheet_trade_id']; $po_ot_rate_type=$this->timesheetmodel->get_po_ot_type($viewinfo->purchase_order_id,$trade_id); $company_name = 'Horeitia'; $company_id=0; } else { $employee=$this->mastermodel->get_data_srow('payroll_manpower_hiring_employee',$timesheet['client_timesheet_employee_id'],'manpower_hiring_employee_id'); $employee_name = $employee->manpower_hiring_employee_name; $employee_no = $employee->manpower_hiring_employee_no; $trade_id=$timesheet['client_timesheet_trade_id']; $po_ot_rate_type=$this->timesheetmodel->get_po_ot_type($viewinfo->purchase_order_id,$trade_id); $company_name = $this->mastermodel->getSingleFieldValue('payroll_manpower_hiring','company_name','company_id',$employee->manpower_hiring_employee_company_id); $company_id=$employee->manpower_hiring_employee_company_id; } if($j%2==0) $alt="alt1"; else $alt="alt"; ?> <tr id="<?=$x++;?>" class="<?=$alt;?>"> <td class="medium"><?=$employee_name;?></td> <td class="medium"> <input type="hidden" name="trade_id[]" value="<?=$trade_id;?>"/> <?=$this->mastermodel->getSingleFieldValue('trade','trade_name','trade_id',$trade_id);?></td> <td><?=$employee_no;?> <input type="hidden" name="employee_id[]" id="employee_id_<?=$j;?>" value="<?=$timesheet['client_timesheet_employee_id'];?>"/> </td> <td class="medium"><?=$company_name;?> <input type="hidden" name="company_id[]" value="<?=$timesheet['client_timesheet_company_id'];?>"/> </td> <td class="medium"> <input type="text" class="medium" name="trade_code[]" value="<?=$timesheet['trade_code'];?>"/> </td> <?php $i=1; $total_hours_second=0; $attendance_days = $this->mastermodel->get_data('payroll_client_timesheet_details',$timesheet['client_timesheet_main_id'],'client_timesheet_main_id','client_timesheet_date'); foreach ($attendance_days as $att) { $is_holiday=0; if(in_array(date('l', strtotime($att['client_timesheet_date'])), $holiday)) { $is_holiday=1; } else if($this->mastermodel->number_rows('payroll_special_holiday','special_holiday_date',$att['client_timesheet_date'])>0) { $is_holiday=1; } ?> <td> <input type="hidden" name="attendance_date<?=$i;?>[]" value="<?=$att['client_timesheet_date'];?>"/> <input type="hidden" name="attendance_holiday<?=$i;?>_<?=$j;?>"id="attendance_holiday<?=$i;?>_<?=$j;?>" value="<?=$is_holiday;?>"/> <input type="text" onfocus="check_employee_hours_client(this.id,'<?=$att['client_timesheet_date'];?>','<?=$timesheet['client_timesheet_employee_id'].'~'.$timesheet['client_timesheet_company_id'];?>');" onchange="check_hours(this.id);check_employee_hours_client(this.id,'<?=$att['client_timesheet_date'];?>','<?=$timesheet['client_timesheet_employee_id'].'~'.$timesheet['client_timesheet_company_id'];?>');calculate_total_hours('<?=$j;?>','<?=$po_ot_rate_type;?>');" id="attendance_date<?=$i;?>_<?=$j;?>" <?php if(!is_numeric($att['client_timesheet_no_hours']) && $att['client_timesheet_no_hours'] !=''){?> style="color:#ff0000;" <?php } ?> name="attendance_day<?=$i;?>[]" value="<?=$att['client_timesheet_no_hours'];?>" class="small" alt="attendance_holiday"/> </td> <?php $total_hours_second+=$att['client_timesheet_no_hours']; $i++; } ?> <td> <input type='text' class='small' id="calc_normal_hours_<?=$j;?>" name="normal_hours[]" value="<?=$timesheet['normal_hours'];?>" onchange="calculate_total_amounts_row(<?=$j;?>)" /> </td> <td> <input type='text' class='small' id="calc_ot_hours_<?=$j;?>" name="ot_hours[]" value="<?=$timesheet['ot_hours'];?>" onchange="calculate_total_amounts_row(<?=$j;?>)" /> </td> <td> <input type='text' class='small' id="calc_hot_hours_<?=$j;?>" name="hot_hours[]" value="<?=$timesheet['hot_hours'];?>" onchange="calculate_total_amounts_row(<?=$j;?>)" /> </td> <td> <span id="cal_total_hours_<?=$j;?>"><?=$total_hours_second;?></span> </td> <td> <input type='text' class='small' id="calc_basic_rate_<?=$j;?>" name="basic_rate[]" value="<?=$timesheet['basic_rate'];?>" onchange="calculate_total_amounts_row(<?=$j;?>)" /> </td> <td> <input type='text' class='small' id="calc_ot_rate_<?=$j;?>" name="ot_rate[]" value="<?=$timesheet['ot_rate'];?>" onchange="calculate_total_amounts_row(<?=$j;?>)" /> </td> <td> <input type='text' class='small' id="calc_hot_rate_<?=$j;?>" name="hot_rate[]" value="<?=$timesheet['hot_rate'];?>" onchange="calculate_total_amounts_row(<?=$j;?>)" /> </td> <td> <span id="calc_normal_amount_<?=$j;?>"><?=$timesheet['basic_rate']*$timesheet['normal_hours'];?></span> </td> <td> <span id="calc_ot_amount_<?=$j;?>"><?=$timesheet['ot_rate']*$timesheet['ot_hours'];?></span> </td> <td> <span id="calc_hot_amount_<?=$j;?>"><?=$timesheet['hot_rate']*$timesheet['hot_hours'];?></span> </td> <td> <span id="calc_total_amount_<?=$j;?>"><?=($timesheet['basic_rate']*$timesheet['normal_hours'])+($timesheet['ot_rate']*$timesheet['ot_hours'])+($timesheet['hot_rate']*$timesheet['hot_hours']);?></span> </td> <td class="large"> <input type="checkbox" id="timesheet_status_check_<?=$j;?>" <?php if($timesheet['timesheet_status']=='Complete'){echo "checked";}?> onclick="set_value(<?=$j;?>)" style="width:15px;"/> <input type="hidden" id="timesheet_status_<?=$j;?>" value="<?php if($timesheet['timesheet_status']=='Complete'){echo "Complete";}else{echo 'Incomplete';}?>" name="timesheet_status[]" /> </td> </tr> <?php $j++; } ?> <!-- <tr id="final_row"> </tr>--> </table> </div> </li> <li> <input type='hidden' id="total_no_days" value="<?=$days;?>" /> <input type='hidden' id="purchase_order_id" value="<?=$viewinfo->purchase_order_id;?>" /> <input type='hidden' id="basic_hours" value="<?=$viewinfo->purchase_order_hours_basic;?>" /> <input type="hidden" id="holiday_string" value="<?=$holiday_string;?>"/> <input type="hidden" name="trcount" id="trcount" value="1"/> <input type="hidden" name="tab_name" value="payroll_client_timesheet"/> <input type="hidden" name="resfunction" value="search_client_timesheet"/> <input type="hidden" id="client_timesheet_id" name="client_timesheet_id" value="<?=$viewinfo->client_timesheet_id;?>"/> </li> </ul> <?php echo form_close();?> </fieldset>