diff --git a/application/controllers/payslip.php b/application/controllers/payslip.php index 434cea5b..41c1a60e 100644 --- a/application/controllers/payslip.php +++ b/application/controllers/payslip.php @@ -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; diff --git a/application/models/monthlypay_model.php b/application/models/monthlypay_model.php index bff0ab9f..a78009db 100644 --- a/application/models/monthlypay_model.php +++ b/application/models/monthlypay_model.php @@ -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 = ? diff --git a/application/views/monthlypayinputs.php b/application/views/monthlypayinputs.php index 09895d34..9e98be75 100644 --- a/application/views/monthlypayinputs.php +++ b/application/views/monthlypayinputs.php @@ -1,4 +1,4 @@ -
-
+
@@ -177,7 +177,8 @@ $('html').bind('keypress', function(e) Incentives in ₹ Other Deductions in ₹ Festival Bonus in ₹ - + Allowances in ₹ + Food Allowances in ₹ Estimate in ₹ @@ -272,6 +273,32 @@ $('html').bind('keypress', function(e) Key)){echo "contenteditable='true';"; } ?> Key)){?> title="Payslip Calculated" style="text-align:right;color:blue;"style="text-align:right;" >Festival_Bonus)){echo $record->Festival_Bonus;$totalfestival [] = $record->Festival_Bonus;}else{ echo number_format(0.00,2,'.','');;} ?> + Key)){echo "contenteditable='true';"; } ?> Key)){?> title="Payslip Calculated" style="text-align:right;color:blue;"style="text-align:right;" > + 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,'.','');} + } ?> + + + Key)){echo "contenteditable='true';"; } ?> Key)){?> title="Payslip Calculated" style="text-align:right;color:blue;"style="text-align:right;" > + 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,'.','');} + } ?> + + + Key)){echo "contenteditable='false';"; } ?> Key)){?> title="Payslip Calculated" style="text-align:right;color:blue;"> Estimate)){echo $record->Estimate; $estTotal [] = $record->Estimate; }else { echo $empSalary[$i]; $estTotal [] = $empSalary[$i]; }?> @@ -288,8 +315,9 @@ $('html').bind('keypress', function(e) --> - - + + @@ -329,7 +357,9 @@ $('html').bind('keypress', function(e) - + + + @@ -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 ) {