?
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/revise_payroll_generation.php |
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed'); $this->load->view('documentreadyfunctions'); ?> <link href="<?=base_url()?>assets/css/tablesorttimesheet.css" rel="stylesheet" type="text/css"/> <link rel="stylesheet" type="text/css" href="<?=base_url()?>assets/css/tooltipster.css" /> <script type="text/javascript" src="<?=base_url()?>assets/js/jquery.freezecolumn.js"></script> <script type="text/javascript" src="<?=base_url()?>assets/js/jquery.tooltipster.js"></script> <script> $(document).ready(function() { $('.sorttimesheet').freezeTableColumn( { freezColumnCount:7, fixedWidth:45, tableBodyHeight : screen.height-380, filterOption : true }); $('.tooltip').tooltipster(); }); </script> <fieldset class="timesheetfieldset"> <?php $attributes=array('id'=>'validateform','class'=>'customForm'); echo form_open('payroll/update_payroll_generation_details',$attributes); ?> <ul> <li> <?php $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')); $slno=0; $no_days=1; $employee=$this->payrollmodel->get_payroll_generation_details($viewinfo->payroll_generation_id,'Complete',$start_date,$end_date); if(empty($employee)) { ?> <h2>No Payroll details for <?=$viewinfo->payroll_generation_month.' '.$viewinfo->payroll_generation_year;?> to be revised</h2> <?php } else { ?> <h2>Payroll for <?=$viewinfo->payroll_generation_month.' '.$viewinfo->payroll_generation_year;?></h2> <label for="submit"> </label> <input type="submit" class="clickimage" onclick="addformdata('validateform');" value="Save" style="width:80px;"/> </li> <li> <?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']; } $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); ?> <div id="freezTable" style="width: 99%;height: 80%;margin: 0 auto;"> <table class="sorttimesheet" id="payroll_table"> <tr> <th class="sltd"><input type="checkbox" class="check_pay" name="check_everything" style="width:20px;" id="check_everything" onclick="check_all()"/></th> <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="large">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='medium'>".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="tiny"> % <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 if(!empty($employee)) { $camp_list=$this->mastermodel->getdatas('camp','camp_id'); foreach($employee as $emp) { if($slno%2==0) $alt="alt"; else $alt="alt1"; $salary=$this->payrollmodel->get_employee_salary($emp['emp_non_id'],$end_date); $slno++; ?> <tr class="<?=$alt;?>"> <td class="sltd"> <input type="checkbox" class="check_pay" style="width:20px;" name="revise_row_<?=$slno;?>" id="revise_row_<?=$slno;?>" /> </td> <td class="sltd"> <?=$slno;?> <input type="hidden" name="employee_id_<?=$slno;?>" id="employee_id_<?=$slno;?>" value="<?=$emp['emp_non_id'];?>" </td> <td class="medium"><?=substr($emp['emp_non_full_name'],0,15);?></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="large"> <select name="employee_camp_id_<?=$slno;?>" id="employee_camp_id_<?=$slno;?>" style="width:80px;"> <?php foreach($camp_list as $list) { ?> <option value="<?=$list['camp_id'];?>"<?php if($list['camp_id']==$emp['payroll_generation_camp_id']){echo "selected";};?>><?=$list['camp_name'];?></option> <?php } ?> </select> </td> <td class="medium"> <input type="hidden" name="original_employee_camp_id_<?=$slno;?>" value="<?=$emp['payroll_generation_camp_id'];?>"/> <?=$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"><input readonly style="font-weight:bolder;" value="<?=$emp['payroll_generation_basic_salary'];?>" name="basic_salary_<?=$slno;?>" onchange="calculate_salary()" id="basic_salary_<?=$slno;?>" type="text" class="small required auto read_only_<?=$slno;?>"/></td> <td class="medium"> <input value="<?=$emp['payroll_generation_ot_amount'];?>" name="ot_amount_<?=$slno;?>" onchange="calculate_salary()" id="ot_amount_<?=$slno;?>" type="text" class="small auto read_only_<?=$slno;?>"/> <input id="ot_saved_amount_<?=$slno;?>" type="hidden" value="<?=$emp['payroll_generation_ot_amount'];?>"/> </td> <td class="medium"><input value="<?=$emp['payroll_generation_previous_balance'];?>" name="previous_balance_<?=$slno;?>" onchange="calculate_salary()" id="previous_balance_<?=$slno;?>" type="text" class="small auto read_only_<?=$slno;?>" /></td> <td class="medium"><input value="<?=$emp['payroll_generation_special_allowance'];?>" name="special_allowance_<?=$slno;?>" onchange="calculate_salary()" id="special_allowance_<?=$slno;?>"t ype="text" class="small auto read_only_<?=$slno;?>" /></td> <td class="medium"><input value="<?=$emp['payroll_generation_site_allowance'];?>" name="site_allowance_<?=$slno;?>" onchange="calculate_salary()" id="site_allowance_<?=$slno;?>" type="text" class="small auto read_only_<?=$slno;?>" /></td> <td class="medium"><input value="<?=$emp['payroll_generation_absent_amount'];?>" name="absent_<?=$slno;?>" onchange="calculate_salary()" id="absent_<?=$slno;?>" type="text" class="small auto read_only_<?=$slno;?>" /></td> <td class="medium" style="text-align:right;"><span id="gross_salary_<?=$slno;?>"></span></td> <td class="medium"><input value="<?=$emp['payroll_generation_ticket_refundable'];?>" name="ticket_refundable_<?=$slno;?>" onchange="calculate_salary()" id="ticket_refundable_<?=$slno;?>" type="text" class="small auto auto read_only_<?=$slno;?>" /></td> <td class="medium"><input value="<?=$emp['payroll_generation_refundable_amount'];?>" name="refundable_amount_<?=$slno;?>" onchange="calculate_salary()" id="refundable_amount_<?=$slno;?>" type="text" class="small read_only_<?=$slno;?>" /></td> <td class="medium"><input value="<?=$emp['payroll_generation_other_allowance'];?>" name="other_allowance_<?=$slno;?>" onchange="calculate_salary()" id="other_allowance_<?=$slno;?>" type="text" class="small auto read_only_<?=$slno;?>" /></td> <td class="medium" style="text-align:right;"><span id="total_salary_<?=$slno;?>"></span></td> <td class="medium"><input value="<?=$emp['payroll_generation_salary_advance'];?>" name="salary_advance_<?=$slno;?>" onchange="calculate_salary()" id="salary_advance_<?=$slno;?>" type="text" class="small auto read_only_<?=$slno;?>" /></td> <td class="medium"><input value="<?=$emp['payroll_generation_other_deductions'];?>" name="other_deductions_<?=$slno;?>" onchange="calculate_salary()" id="other_deductions_<?=$slno;?>" type="text" class="small auto" read_only_<?=$slno;?> /></td> <td class="medium" style="text-align:right;"><span id="net_salary_<?=$slno;?>"></span></td> <td class="medium"><input value="<?=$emp['payroll_generation_corrected_salary'];?>" name="corrected_salary_<?=$slno;?>" id="corrected_salary_<?=$slno;?>" type="text" class="small auto read_only_<?=$slno;?>" /></td> <td class="medium"> <input name="payment_status_<?=$slno;?>" id="payment_status_<?=$slno;?>" class="small" value="<?=$emp['payroll_generation_payment_status'];?>" readonly> </td> <td class="medium"><?=$emp['emp_non_no'];?></td> <?php if($emp['payroll_generation_payment_status']=='Paid') { $hours = $this->payrollmodel->get_employee_payroll_hours($emp['payroll_generation_details_id']); $flag_payroll=0; } else { $hours = $this->payrollmodel->get_employee_working_hours($emp['emp_non_id'],$start_date,$end_date); $hours1 = $this->payrollmodel->get_employee_payroll_hours($emp['payroll_generation_details_id']); foreach ($hours1 as $key => $value) { if(array_key_exists($key,$hours)) $hours[$key].='~'.$value; else $hours[$key].='0~'.$value; } $flag_payroll=1; } $ot_hours = 0; $total_hours = 0; $date=$start_date; $absent=0; $absent_orginal=0; $no_days=0; $emp_hours = ''; $i=0; $holiday_flag=0; while (strtotime($date) <= strtotime($end_date)) { $holiday_type=0; $no_days++; $readonly_status = 1; $flag=0; if(array_key_exists($date,$hours)) { $type_hours = explode('~', $hours[$date]); if($flag_payroll==0) { $hours_worked=$type_hours[0]; $reason_worked=$type_hours[1]; $hours_saved=$hours_worked; } else { $hours_worked=$type_hours[0]; $hours_saved=$type_hours[1]; $reason_worked=$type_hours[2]; } if($reason_worked !='') { $flag=1; if(is_numeric($hours_saved) || $hours_saved=="P") $color="style='background-color:#daf4b2'"; else $color="style='background-color:#f4b2b4'"; } $emp_hours=$hours_worked; ?> <?php if($emp_hours == 'A' || $emp_hours == '0' || $emp_hours == 'a' || $emp_hours == '' || $emp_hours == '-') { $readonly_status = 0; if($emp_hours!=$hours_saved && $reason_worked!='') { $emp_hours=$hours_saved; } if(is_numeric($emp_hours)) { $ot_hours += ($emp_hours-$basic_hours); } else { $absent++; $ot_hours += 0; $holiday_flag=1; } } else if(in_array(date('l', strtotime($date)), $holiday)) { $ot_hours += $emp_hours; $holiday_type=1; if($hours_worked==0 and $holiday_flag==1) { $holiday_flag=0; $emp_hours='A'; $hours_worked='A'; $absent++; } } else if(!empty ($special_holiday_array) && in_array($date, $special_holiday_array)) { $ot_hours += $emp_hours; $holiday_type=1; } else if($emp_hours > $basic_hours) $ot_hours += ($emp_hours-$basic_hours); $total_hours += $emp_hours; if($hours_worked == "A" || $hours_worked == '0' || $hours_worked == "a" || $hours_worked == '' || $emp_hours == "-") { $absent_orginal++; } ?> <?php } else { ?> <?=0;?> <?php $emp_hours = 0; $total_hours +=0; $ot_hours += 0; $absent ++; $reason_worked=''; ?> <?php } ?> <td class="medium" <?php if($flag==1){ echo $color; ?> title="<?=$reason_worked;?>" class="tooltip" <?php }?> onclick="show_reason('<?=$no_days;?>','<?=$slno;?>')"> <input type="hidden" class="small" id="<?=$no_days;?>_employee_date_<?=$slno;?>" name="<?=$no_days;?>_employee_date_<?=$slno;?>" value="<?=$date;?>" /> <input type="hidden" class="small" id="<?=$no_days;?>_employee_holiday_<?=$slno;?>" name="<?=$no_days;?>_employee_holiday_<?=$slno;?>" value="<?=$holiday_type;?>" /> <input <?php if($readonly_status){echo "readonly";}?> onchange="calculate_hours('<?=$slno;?>')" type="text" class="small read_only_<?=$slno;?>" id="<?=$no_days;?>_employee_hours_<?=$slno;?>" name="<?=$no_days;?>_employee_hours_<?=$slno;?>" value="<?=$emp_hours;?>"/> <input type="hidden" class="small" id="<?=$no_days;?>_reason_<?=$slno;?>" name="<?=$no_days;?>_reason_<?=$slno;?>" value="<?=$reason_worked;?>" /> </td> <?php $date = date ("Y-m-d", strtotime("+1 day", strtotime($date))); } ?> <td class="medium"> <span id="ot_changed_hours_<?=$slno;?>"><?=$ot_hours;?></span> <input type="hidden" id="ot_hours_<?=$slno;?>" name="ot_hours_<?=$slno;?>" value="<?=$ot_hours;?>"/> </td> <td class="medium"> <span id="absent_changed_days_<?=$slno;?>"><?=$absent;?></span> <input type="hidden" id="absent_days_<?=$slno;?>" name="absent_days_<?=$slno;?>" value="<?=$absent;?>"/> <input type="hidden" id="absent_original_days_<?=$slno;?>" name="absent_original_days_<?=$slno;?>" value="<?=$absent_orginal;?>"/> </td> <td class="medium"> <span id="total_changed_hours_<?=$slno;?>"> <?=$total_hours;?></span> <input type="hidden" id="total_hours_<?=$slno;?>" name="total_hours_<?=$slno;?>" value="<?=$total_hours;?>"/> <input type="hidden" id="total_saved_hours_<?=$slno;?>" value="<?=$emp['payroll_generation_total_hrs'];?>"> </td> <td class="medium" style="text-align:right"> <?php $timesheet = $this->payrollmodel->get_timesheet_rate($emp['emp_non_id'],$start_date,$end_date); echo $timesheet['basic_rate']; ?> <input type="hidden" id="normal_rate_<?=$slno;?>" name="normal_rate_<?=$slno;?>" value="<?=$timesheet['basic_rate'];?>"/> </td> <td class="medium" style="text-align:right"> <?=$timesheet['total_amount'];?> <input type="hidden" id="timesheet_amount_<?=$slno;?>" name="timesheet_amount_<?=$slno;?>" value="<?=$timesheet['total_amount'];?>"/> </td> <td class="tiny" style="text-align:right"> <span id="employee_contribution_<?=$slno;?>"></span> <input type="hidden" name="employee_contribution_<?=$slno;?>" id="employee_contributions_<?=$slno;?>" class="small" readonly/> </td> <td class="medium"> <input type="text" class="medium" readonly value="<?=$emp['payroll_generation_payroll_status'];?>" name="payroll_status_<?=$slno;?>" id="payroll_status_<?=$slno;?>"/> </td> <td class="medium" style="text-align:right"><span id="notes_500_<?=$slno;?>"></span></td> <td class="medium" style="text-align:right"><span id="notes_100_<?=$slno;?>"></span></td> <td class="medium" style="text-align:right"><span id="notes_50_<?=$slno;?>"></span></td> <td class="medium" style="text-align:right"><span id="notes_10_<?=$slno;?>"></span></td> <td class="medium" style="text-align:right"><span id="notes_5_<?=$slno;?>"></span></td> <td class="medium" style="text-align:right"><span id="notes_1_<?=$slno;?>"></span></td> <td class="medium" style="text-align:right"><span id="net_salary_notes_<?=$slno;?>"></span></td> </tr> <?php } } ?> <tr> <th colspan="11"></th> <th id="basic_salary_total" style="text-align:right;"></th> <th id="ot_amount_total" style="text-align:right;"></th> <th id="previous_balance_total" style="text-align:right;"></th> <th id="special_allowance_total" style="text-align:right;"></th> <th id="site_allowance_total" style="text-align:right;"></th> <th id="absent_amount_total" style="text-align:right;"></th> <th id="gross_salary_total" style="text-align:right;"></th> <th id="ticket_refundable_total" style="text-align:right;"></th> <th id="refundable_amount_total" style="text-align:right;"></th> <th id="other_allowance_total" style="text-align:right;"></th> <th id="total_salary_total" style="text-align:right;"></th> <th id="salary_advance_total" style="text-align:right;"></th> <th id="other_deductions_total" style="text-align:right;"></th> <th id="net_salary_total" style="text-align:right;"></th> <th colspan="<?=$no_days+7;?>"></th> <th id="timesheet_amount_total" style="text-align:right;"></th> <th id="employee_contribution_total" style="text-align:right;"></th> <th></th> <th id="notes_500_total" style="text-align:right;"></th> <th id="notes_100_total" style="text-align:right;"></th> <th id="notes_50_total" style="text-align:right;"></th> <th id="notes_10_total" style="text-align:right;"></th> <th id="notes_5_total" style="text-align:right;"></th> <th id="notes_1_total" style="text-align:right;"></th> <th id="net_salary_notes_total" style="text-align:right;"></th> </tr> <?php } ?> </table> </div> </li> <li> <input type="hidden" name="tab_name" value="payroll_generation"/> <input type="hidden" name="resfunction" value="search_payroll_generation"/> <input type="hidden" name="payroll_generation_id" value="<?=$viewinfo->payroll_generation_id;?>"/> <?php if(!empty($employee)) { ?> <input type="hidden" id="no_employees" name="no_employees" value="<?=$slno;?>"/> <input type="hidden" id="no_days" name="no_days" value="<?=$no_days;?>"/> <input type="hidden" id="basic_hours" value="<?=$basic_hours;?>"/> <input type="hidden" id="ot_perc" value="<?=$this->payrollmodel->get_ot_perc($end_date);?>"/> <?php } ?> </li> </ul> <?php echo form_close();?> </fieldset> <script type="text/javascript"> calculate_salary(); function calculate_salary() { var no_employees = $("#no_employees").val(); var no_days = $("#no_days").val(); var basic_hours = $("#basic_hours").val(); var ot_perc = $("#ot_perc").val(); var ot_hours; var absent; var absent_original; var ot_perc; var basic_salary; var ot_amount; var absent_amount; var gross_salary; var total_salary; var net_salary; var previous_balance; var site_allowance; var special_allowance; var ticket_refundable; var refundable_amount; var other_allowance; var salary_advance; var other_deductions; var timesheet_amount; var employee_contribution; var notes_500; var notes_100; var notes_50; var notes_10; var notes_5; var notes_1; var basic_salary_total=0; var ot_amount_total=0; var absent_amount_total=0; var gross_salary_total=0; var total_salary_total=0; var net_salary_total=0; var previous_balance_total=0; var site_allowance_total=0; var special_allowance_total=0; var ticket_refundable_total=0; var refundable_amount_total=0; var other_allowance_total=0; var salary_advance_total=0; var other_deductions_total=0; var timesheet_amount_total=0; var employee_contribution_total=0; var notes_500_total=0; var notes_100_total=0; var notes_50_total=0; var notes_10_total=0; var notes_5_total=0; var notes_1_total=0; var net_salary_total=0; for(i=1;i<=no_employees;i++) { ot_hours = $("#ot_hours_"+i).val(); absent = $("#absent_days_"+i).val(); absent_original = $("#absent_original_days_"+i).val(); if(absent_original == 0 && (isNaN($("#special_allowance_"+i).val()) || $("#special_allowance_"+i).val()==0)) $("#special_allowance_"+i).val(60); else if(absent_original > 0 && $("#special_allowance_"+i).val()=='60') $("#special_allowance_"+i).val(0); basic_salary = $("#basic_salary_"+i).val(); basic_salary = $("#basic_salary_"+i).val(); if (basic_salary=='' || isNaN(basic_salary)) basic_salary=0; basic_salary_total+=parseFloat(basic_salary); ot_amount = (basic_salary/no_days/basic_hours*ot_perc/100*ot_hours).toFixed(2); if($("#ot_saved_amount_"+i).val()=='' && $("#ot_amount_"+i).val()=='') { $("#ot_amount_"+i).val(ot_amount); $("#ot_saved_amount_"+i).val(ot_amount); } else if($("#ot_saved_amount_"+i).val()!='' && ot_amount !=$("#ot_amount_"+i).val() && $("#total_saved_hours_"+i).val()==$("#total_hours_"+i).val()) { ot_amount = $("#ot_amount_"+i).val(); $("#ot_amount_"+i).val(ot_amount); $("#ot_saved_amount_"+i).val(ot_amount); } else if($("#ot_saved_amount_"+i).val()!='' && $("#total_saved_hours_"+i).val()!=$("#total_hours_"+i).val()) { $("#ot_amount_"+i).val(ot_amount); $("#ot_saved_amount_"+i).val(ot_amount); $("#total_saved_hours_"+i).val($("#total_hours_"+i).val()); } else { $("#ot_amount_"+i).val(ot_amount); $("#ot_saved_amount_"+i).val(ot_amount); } absent_amount = (basic_salary/no_days*absent).toFixed(2); $("#absent_"+i).val(absent_amount); ot_amount_total+=parseFloat(ot_amount); absent_amount_total+=parseFloat(absent_amount); previous_balance = $("#previous_balance_"+i).val(); if(previous_balance =='' || isNaN(previous_balance)) previous_balance = 0; special_allowance = $("#special_allowance_"+i).val(); if(special_allowance =='' || isNaN(special_allowance)) special_allowance = 0; site_allowance = $("#site_allowance_"+i).val(); if(site_allowance =='' || isNaN(site_allowance)) site_allowance = 0; gross_salary = (parseFloat(basic_salary) + parseFloat(ot_amount) + parseFloat(previous_balance) + parseFloat(special_allowance) + parseFloat(site_allowance) - parseFloat(absent_amount)).toFixed(2); $("#gross_salary_"+i).text(gross_salary); previous_balance_total+=parseFloat(previous_balance); special_allowance_total+=parseFloat(special_allowance); site_allowance_total+=parseFloat(site_allowance); gross_salary_total+=parseFloat(gross_salary); ticket_refundable = $("#ticket_refundable_"+i).val(); if(ticket_refundable =='' || isNaN(ticket_refundable)) ticket_refundable = 0; refundable_amount = $("#refundable_amount_"+i).val(); if(refundable_amount =='' || isNaN(refundable_amount)) refundable_amount = 0; other_allowance = $("#other_allowance_"+i).val(); if(other_allowance =='' || isNaN(other_allowance)) other_allowance = 0; total_salary = (parseFloat(gross_salary) + parseFloat(ticket_refundable) + parseFloat(refundable_amount) + parseFloat(other_allowance)).toFixed(2); $("#total_salary_"+i).text(total_salary); ticket_refundable_total+=parseFloat(ticket_refundable); refundable_amount_total+=parseFloat(refundable_amount); other_allowance_total+=parseFloat(other_allowance); total_salary_total+=parseFloat(total_salary); salary_advance = $("#salary_advance_"+i).val(); if(salary_advance =='' || isNaN(salary_advance)) salary_advance = 0; other_deductions = $("#other_deductions_"+i).val(); if(other_deductions =='' || isNaN(other_deductions)) other_deductions = 0; net_salary = Math.round(parseFloat(total_salary) - parseFloat(salary_advance) - parseFloat(other_deductions)); $("#net_salary_"+i).text(net_salary); salary_advance_total+=parseFloat(salary_advance); other_deductions_total+=parseFloat(other_deductions); net_salary_total+=parseFloat(net_salary); timesheet_amount = $("#timesheet_amount_"+i).val(); if(timesheet_amount =='' || isNaN(timesheet_amount) || timesheet_amount==0) employee_contribution = 0; else employee_contribution = (gross_salary/timesheet_amount*100).toFixed(2); $("#employee_contribution_"+i).text(employee_contribution); $("#employee_contributions_"+i).val(employee_contribution); timesheet_amount_total+=parseFloat(timesheet_amount); employee_contribution_total+=parseFloat(employee_contribution); notes_500 = parseInt(net_salary / 500); $("#notes_500_"+i).text(notes_500); notes_100 = parseInt(net_salary%500/100); $("#notes_100_"+i).text(notes_100); notes_50 = parseInt(net_salary%500%100/50); $("#notes_50_"+i).text(notes_50); notes_10 = parseInt(net_salary%500%100%50/10); $("#notes_10_"+i).text(notes_10); notes_5 = parseInt(net_salary%500%100%50%10/5); $("#notes_5_"+i).text(notes_5); notes_1 = parseInt(net_salary%500%100%50%10%5/1); $("#notes_1_"+i).text(notes_1); notes_500_total+=parseFloat(notes_500); notes_100_total+=parseFloat(notes_100); notes_50_total+=parseFloat(notes_50); notes_10_total+=parseFloat(notes_10); notes_5_total+=parseFloat(notes_5); notes_1_total+=parseFloat(notes_1); $("#net_salary_notes_"+i).text(net_salary); } $("#basic_salary_total").text(basic_salary_total.toFixed(2)); $("#ot_amount_total").text(ot_amount_total.toFixed(2)); $("#previous_balance_total").text(previous_balance_total.toFixed(2)); $("#special_allowance_total").text(special_allowance_total.toFixed(2)); $("#site_allowance_total").text(site_allowance_total.toFixed(2)); $("#absent_amount_total").text(absent_amount_total.toFixed(2)); $("#gross_salary_total").text((gross_salary_total).toFixed(2)); $("#ticket_refundable_total").text(ticket_refundable_total.toFixed(2)); $("#refundable_amount_total").text(refundable_amount_total.toFixed(2)); $("#other_allowance_total").text(other_allowance_total.toFixed(2)); $("#total_salary_total").text(total_salary_total.toFixed(2)); $("#salary_advance_total").text(salary_advance_total.toFixed(2)); $("#other_deductions_total").text(other_deductions_total.toFixed(2)); $("#net_salary_total").text((net_salary_total).toFixed(2)); $("#timesheet_amount_total").text((timesheet_amount_total).toFixed(2)); $("#employee_contribution_total").text((parseFloat(gross_salary_total/timesheet_amount_total*100)).toFixed(2)); $("#notes_500_total").text(notes_500_total); $("#notes_100_total").text(notes_100_total); $("#notes_50_total").text(notes_50_total); $("#notes_10_total").text(notes_10_total); $("#notes_5_total").text(notes_5_total); $("#notes_1_total").text(notes_1_total); $("#net_salary_notes_total").text(net_salary_total); } function calculate_hours(row_no) { var no_days = $("#no_days").val(); var total_hours=0; var hours_day; var absent_days=0; var basic_hours = $("#basic_hours").val(); var ot_hours=0; var holiday_type=0; for(var i=1;i<=no_days;i++) { //alert(i); hours_day = $('#'+i+'_employee_hours_'+row_no).val(); holiday_type=$('#'+i+'_employee_holiday_'+row_no).val(); //alert(holiday_type); if(hours_day=="0" || hours_day=="A" || hours_day=="a" || hours_day=="" || hours_day=="0.00" || hours_day=="-") absent_days++; else if(!isNaN(hours_day)) { if(holiday_type==1) { ot_hours=parseFloat(ot_hours)+parseFloat(hours_day); } else if(parseFloat(hours_day) > parseFloat(basic_hours)) { ot_hours=parseFloat(ot_hours)+parseFloat(hours_day)-parseFloat(basic_hours); } total_hours=parseFloat(total_hours)+parseFloat(hours_day); } } $("#ot_hours_"+row_no).val(ot_hours); $("#ot_changed_hours_"+row_no).text(ot_hours); $("#total_hours_"+row_no).val(total_hours); $("#total_changed_hours_"+row_no).text(total_hours); $("#absent_days_"+row_no).val(absent_days); $("#absent_changed_days_"+row_no).text(absent_days); calculate_salary(); } function check_all() { if($("#check_everything").is(':checked')) $('.check_pay').attr('checked','checked'); else $('.check_pay').removeAttr('checked'); } function show_reason(day,slno) { var input_field = day+"_reason_"+slno; marker = $('<span />').insertBefore('#'+input_field); $('#'+input_field).detach().attr('type', 'text').insertAfter(marker).focus(); marker.remove(); } </script>