Payslip - Allowances and FoodAllowances Editable Changes : ps

This commit is contained in:
VE10-Sanjeev 2024-03-16 11:12:55 +05:30
parent 48eb7b0ef7
commit 4903cb9fb6
3 changed files with 103 additions and 14 deletions

View File

@ -911,6 +911,8 @@ function phpAlert($msg) {
$Loan_Recovered = $j['Manual Loan Due ₹'];
$Incentives = $j['Incentives in ₹'];
$Festival_Bonus = $j['Festival Bonus in ₹'];
$Allowances = $j['Allowances in ₹'];
$Food_Allowances = $j['Food Allowances in ₹'];
$Other_Deductions = $j['Other Deductions in ₹'];
$Estimate =$j['Estimate in ₹'];
$Created_By = $this->session->userdata ( 'userId' );
@ -975,6 +977,17 @@ function phpAlert($msg) {
{
$ErrorFlag++;
}
$Allowances_first = explode(".",$Allowances);
if(!is_numeric($Allowances) || (strlen((string)$Allowances))>8 || (strlen((string)$Allowances_first[0]))> 5)
{
$ErrorFlag++;
}
$Foodallowances_first = explode(".",$Food_Allowances);
if(!is_numeric($Food_Allowances) || (strlen((string)$Food_Allowances))>8 || (strlen((string)$Foodallowances_first[0]))> 5)
{
$ErrorFlag++;
}
$Other_Deductions_first = explode(".",$Other_Deductions);
if(!is_numeric($Other_Deductions) || (strlen((string)$Other_Deductions))>8 || (strlen((string)$Other_Deductions_first[0]))> 5)
@ -1040,11 +1053,13 @@ function phpAlert($msg) {
}
$Incentives = $j['Incentives in ₹'];
$Festival_Bonus = $j['Festival Bonus in ₹'];
$Allowances = $j['Allowances in ₹'];
$Food_Allowances = $j['Food Allowances in ₹'];
$Other_Deductions = $j['Other Deductions in ₹'];
$Estimate =$j['Estimate in ₹'];
$Created_By = $this->session->userdata ( 'userId' );
$monthlypaydata = array('Month_Year'=>$month,'EmpID'=>$EmpID,'Days_worked'=>$DaysWorked,'LOP_Days'=>$LOP_Days,'Paid_leave'=>$Paid_leave,'OT_Hrs_Worked'=>$OT_Hrs_Worked,'Loan_Recovered'=>$Loan_Recovered,'Incentives'=>$Incentives,'Festival_Bonus'=>$Festival_Bonus,'Other_Deductions'=>$Other_Deductions,'Estimate'=>$Estimate,'Created_By'=>$Created_By);
$monthlypaydata = array('Month_Year'=>$month,'EmpID'=>$EmpID,'Days_worked'=>$DaysWorked,'LOP_Days'=>$LOP_Days,'Paid_leave'=>$Paid_leave,'OT_Hrs_Worked'=>$OT_Hrs_Worked,'Loan_Recovered'=>$Loan_Recovered,'Incentives'=>$Incentives,'Festival_Bonus'=>$Festival_Bonus,'Allowances'=>$Allowances,'Food_Allowances'=>$Food_Allowances,'Other_Deductions'=>$Other_Deductions,'Estimate'=>$Estimate,'Created_By'=>$Created_By);
//print_r($monthlypaydata);
$result = $this->monthlypay_model->saveMonthlyData_model($monthlypaydata);
$total = $total + $result;

View File

@ -97,9 +97,10 @@ if(strlen($month) == 6)
//$monthyear_val = date('Y-m',strtotime($current));
$lastdate = $year_val.'-'.$month_val.'-'.$date_val;
//echo $lastdate;
//left join T_Payroll on T_Employee_Details.EmpID = T_Payroll.EmpID and month(T_Payroll.PayOn) = month(?) and year(T_Payroll.PayOn) = year(?)
$sql ="select T_Emp_Pay_Data.EmpID, T_Emp_Pay_Data.Incentives as MasterIncentives,T_Emp_Pay_Data.*,T_Employee_Details.FirstName,T_Employee_Details.LastName,T_Employee_Details.DateofJoining,T_Attendance.Days_Worked as Days_worked,T_Attendance.Absent as LOP_Days,T_Attendance.Paid_Leave as Paid_leave,T_Attendance.Total_OTHrs as OT_Hrs_Worked,T_Attendance.NoofDays,T_Loan_Master.Loan_ID,T_Loan_Master.Monthly_Due,T_Loan_Master.Due_Start_Date as DueDate,T_Loan_Master.Loan_Amount,T_Loan_Master.Paid_Amount,T_Payroll.Key,T_Monthly_Pay_Inputs.Incentives as MonthlyIncentives,T_Monthly_Pay_Inputs.Loan_Recovered,T_Monthly_Pay_Inputs.Estimate,T_Monthly_Pay_Inputs.Festival_Bonus,T_Monthly_Pay_Inputs.Other_Deductions,T_Loan_History .Balance_Amount
,T_Emp_Pay_Data.Allowances as MasterAllowances,T_Emp_Pay_Data.Food_Allowances as MasterFoodAllowances,T_Monthly_Pay_Inputs.Allowances as MonthlyAllowances,T_Monthly_Pay_Inputs.Food_Allowances as MonthlyFoodAllowances
from T_Emp_Pay_Data
left join T_Employee_Details on T_Employee_Details.EmpID = T_Emp_Pay_Data.EmpID
left join T_Payroll on T_Employee_Details.EmpID = T_Payroll.EmpID and T_Payroll.PayOn = ?

View File

@ -1,4 +1,4 @@
<?php
<?php
$sample = array_merge($month,$fresh);
$show_hide_column_value = true;
//print_r($sample);die();
@ -154,7 +154,7 @@ $('html').bind('keypress', function(e)
<div class="col-md-3">
<form id="formid">
<?php echo form_dropdown('monthyear',$ot,set_value('monthyear',$currentselection),'id="monthyear"' ,'class="form-control select2');?>
</form>
</form>
</div>
</div>
<div class="box-body">
@ -177,7 +177,8 @@ $('html').bind('keypress', function(e)
<th>Incentives in </th>
<th>Other Deductions in </th>
<th>Festival Bonus in </th>
<th>Allowances in </th>
<th>Food Allowances in </th>
<th>Estimate in </th>
@ -272,6 +273,32 @@ $('html').bind('keypress', function(e)
<td id="Festival<?php echo $index?>"onkeypress="return isNumber(event);" onkeyup="changeInput(event);"<?php if(empty($record->Key)){echo "contenteditable='true';"; } ?> <?php if(!empty($record->Key)){?> title="Payslip Calculated" style="text-align:right;color:blue;"<?php } else{?>style="text-align:right;"<?php }?> ><?php if(!empty($record->Festival_Bonus)){echo $record->Festival_Bonus;$totalfestival [] = $record->Festival_Bonus;}else{ echo number_format(0.00,2,'.','');;} ?></td>
<?php $totalfestival [] = $Festival_Bonus;?>
<td id="Allowanc<?php echo $index?>"onkeypress="return isNumber(event);" onkeyup="changeInput(event);"<?php if(empty($record->Key)){echo "contenteditable='true';"; } ?> <?php if(!empty($record->Key)){?> title="Payslip Calculated" style="text-align:right;color:blue;"<?php } else{?>style="text-align:right;"<?php }?> >
<?php
if (!empty($record->MonthlyAllowances) && $record->MonthlyAllowances != 'NULL') {
echo $record->MonthlyAllowances;
$totalnew [] = $record->MonthlyAllowances;
} else {if(!empty($record->MasterAllowances)){
echo $record->MasterAllowances;
$totalnew [] = $record->MasterAllowances;
}else{ echo number_format(0.00,2,'.','');}
} ?>
<?php $totalnew [] = $Allowances;?>
<td id="foodAllo<?php echo $index?>"onkeypress="return isNumber(event);" onkeyup="changeInput(event);"<?php if(empty($record->Key)){echo "contenteditable='true';"; } ?> <?php if(!empty($record->Key)){?> title="Payslip Calculated" style="text-align:right;color:blue;"<?php } else{?>style="text-align:right;"<?php }?> >
<?php if(!empty($record->MonthlyFoodAllowances) && $record->MonthlyFoodAllowances != 'NULL'){
echo $record->MonthlyFoodAllowances;
$totalfood [] = $record->MonthlyFoodAllowances;}
else {
if(!empty($record->MasterFoodAllowances) && $record->MasterFoodAllowances != 'NULL' ){
$fa = ($record->Days_worked)*($record->MasterFoodAllowances);
echo number_format($fa,2,'.',''); $totalfood [] = $fa;
}else{ echo number_format(0.00,2,'.','');}
} ?>
</td>
<?php $totalfood [] = $Food_Allowances;?>
<td id="empsal<?php echo $index?>"<?php if(empty($record->Key)){echo "contenteditable='false';"; } ?> <?php if(!empty($record->Key)){?> title="Payslip Calculated" style="text-align:right;color:blue;"<?php }?>> <?php if(!empty($record->Estimate)){echo $record->Estimate; $estTotal [] = $record->Estimate; }else { echo $empSalary[$i]; $estTotal [] = $empSalary[$i];
}?></td>
@ -288,8 +315,9 @@ $('html').bind('keypress', function(e)
<input type="hidden" id = "pdi" value="<?php echo $record->Pay_Data_ID?>"> -->
<input type="hidden" id = "bPay<?php echo $index?>" value="<?php echo $record->Basic_Pay?>">
<input type="hidden" id = "hraRate<?php echo $index?>" value="<?php echo $record->HRA_Rate?>">
<input type="hidden" id = "allow<?php echo $index?>" value="<?php echo $record->Allowances?>">
<input type="hidden" id = "fAllow<?php echo $index?>" value="<?php echo $record->Food_Allowances?>">
<!-- <input type="hidden" id = "allow<?php echo $index?>" value="<?php echo $record->Allowances?>">
<input type="hidden" id = "fAllow<?php echo $index?>" value="<?php echo $record->Food_Allowances?>"> -->
<input type="hidden" id = "pfRate<?php echo $index?>" value="<?php echo $record->PF_Rate?>">
<input type="hidden" id = "eslRate<?php echo $index?>" value="<?php echo $record->ESI_Rate?>">
<input type="hidden" id = "hraAmt<?php echo $index?>" value="<?php echo $record->HRA_Amount?>">
@ -329,7 +357,9 @@ $('html').bind('keypress', function(e)
<th id="monthloan"><?php echo array_sum($totalmanualoan);?></th>
<th id="inst"><?php echo array_sum($totalinst);?></th>
<th id="other"><?php echo array_sum($totalotherDet);?></th>
<th id="fest"><?php echo array_sum($totalfestival);?></th>
<th id="fest"><?php echo array_sum($totalfestival);?></th>
<th id="newfooter"><?php echo array_sum($totalnew);?></th>
<th id="newfooters"><?php echo array_sum($totalfood);?></th>
<th id="estsal"><?php echo array_sum($estTotal);?></th>
</tr>
@ -363,7 +393,7 @@ $('html').bind('keypress', function(e)
var i = 0;
$('tr.lastvalue').each(function(){
i = i+1;
estTotal [i]=$(this).find('td').eq(11).text();
estTotal [i]=$(this).find('td').eq(13).text();
});
var i = 0;
@ -385,7 +415,7 @@ $('html').bind('keypress', function(e)
var i = 0;
$('tr.lastvalue').each(function(){
i = i+1;
totalmanualoan [i]=$(this).find('td').eq(6).text();
totalmanualoan [i]=$(this).find('td').eq(6).text();
});
//console.log(totalmanualoan);
@ -578,6 +608,8 @@ function isCheckKeyCode(event){
var totalfestival =[];
var jsarrAllowances =[];
var jsarrFoodAllowances =[];
var totalempSal=[];
var grandtotal = [];
function changeInput(event,k)
@ -587,6 +619,7 @@ function isCheckKeyCode(event){
var str=event.target.id;
var sno = str.substr(8);
@ -627,13 +660,18 @@ function isCheckKeyCode(event){
var Festival =parseFloat(document.getElementById('Festival'+sno).textContent);
totalfestival[sno]= Festival ;
var New =parseFloat(document.getElementById('Allowanc'+sno).textContent);
jsarrAllowances[sno]= New ;
var Newfood =parseFloat(document.getElementById('foodAllo'+sno).textContent);
jsarrFoodAllowances[sno]= Newfood ;
var empsal =parseFloat(document.getElementById('empsal'+sno).textContent);
var bpay =parseFloat(document.getElementById('bPay'+sno).value);
var hraRate=parseFloat(document.getElementById('hraRate'+sno).value);
var allow=parseFloat(document.getElementById('allow'+sno).value);
var fAllow =parseFloat(document.getElementById('fAllow'+sno).value);
// var allow=parseFloat(document.getElementById('allow'+sno).value);
// var fAllow =parseFloat(document.getElementById('fAllow'+sno).value);
var pfRate =parseFloat(document.getElementById('pfRate'+sno).value);
var eslRate =parseFloat(document.getElementById('eslRate'+sno).value);
var hraAmt =parseFloat(document.getElementById('hraAmt'+sno).value);
@ -652,7 +690,7 @@ totalfestival[sno]= Festival ;
// console.log("day"+dayWorkPaid);
var NoofDays=dayWorks+paidLeave +lopDay;
// console.log("monthday"+NoofDays);
var Food_Allowances = fAllow * dayWorks;
// var Food_Allowances = fAllow * dayWorks;
// console.log("workedFA"+Food_Allowances);
var daySalary = bpay / NoofDays;
@ -747,6 +785,15 @@ totalfestival[sno]= Festival ;
}
if(parseFloat(New) == parseFloat(New)){
var News =parseFloat(New);
}
if(parseFloat(Newfood) == parseFloat(Newfood)){
var Newfoods =parseFloat(Newfood);
}
if(parseFloat( otherDet) == parseFloat( otherDet)){
var otherDets =parseFloat( otherDet);
@ -776,7 +823,8 @@ totalfestival[sno]= Festival ;
var pfAmount = currentDaySalary * pfRate / 100;
// console.log("11daypf"+pfAmount);
var empSalaryAdd= currentDaySalary + totSalayOT + currentDayHra + Food_Allowances + allow +incent+Festivals ;
// var empSalaryAdd= currentDaySalary + totSalayOT + currentDayHra + Food_Allowances + allow +incent+Festivals ;
var empSalaryAdd= currentDaySalary + totSalayOT + currentDayHra + Newfoods + News +incent+Festivals ;
var empSalarySub = current_loan_amt + esiAmount + pfAmount + otherDets;
@ -888,7 +936,32 @@ function calculategrandtotal(){
}
$('#fest').text(parseFloat(sum).toFixed(2));
$.each(jsarrAllowances, function( index, value )
{
tempTotal[index]=parseFloat(value);
});
var sum = 0;
for (var i = 0; i < tempTotal.length; i++) {
sum += tempTotal[i] << 0;
}
$('#newfooter').text(parseFloat(sum).toFixed(2));
$.each(jsarrFoodAllowances, function( index, value )
{
tempTotal[index]=parseFloat(value);
});
var sum = 0;
for (var i = 0; i < tempTotal.length; i++) {
sum += tempTotal[i] << 0;
}
$('#newfooters').text(parseFloat(sum).toFixed(2));
$.each(estTotal, function( index, value )
{