diff --git a/application/controllers/payslip.php b/application/controllers/payslip.php index 93228cff..4fa76a59 100755 --- a/application/controllers/payslip.php +++ b/application/controllers/payslip.php @@ -819,12 +819,14 @@ function phpAlert($msg) { } - function saveMonthlyData() + function saveMonthlyData() { $month = $this->input->post('param2'); $jsondata =$this->input->post('param1'); $json = json_decode($jsondata,true); + + $mon=''; $year=''; @@ -854,8 +856,12 @@ function phpAlert($msg) { $total = 0; $ErrorEmpId = ''; $TotalErrorFlag = 0; - foreach($json as $j) + $i = sizeof($json); + $len = $i-2; + foreach($json as $index=>$j) { + if($index<=$len){ + $ErrorFlag = 0; $Emp = $j['Employee']; @@ -873,6 +879,7 @@ function phpAlert($msg) { $Incentives = $j['Incentives in ₹']; $Festival_Bonus = $j['Festival Bonus in ₹']; $Other_Deductions = $j['Other Deductions in ₹']; + $Estimate =$j['Estimate in ₹']; $Created_By = $this->session->userdata ( 'userId' ); if(!is_numeric($DaysWorked) || ($DaysWorked > 31) || (strlen((string)$DaysWorked)) > 5 ) @@ -942,6 +949,13 @@ function phpAlert($msg) { //echo $EmpID . "-Loan Recoverd Invalid Data!"; $ErrorFlag++; } + + $Estimate_first = explode(".",$Estimate); + if(!is_numeric($Estimate) || (strlen((string)$Estimate))>8 || (strlen((string)$Estimate_first[0]))> 5) + { + //echo $EmpID . "-Loan Recoverd Invalid Data!"; + $ErrorFlag++; + } if($ErrorFlag != 0) { @@ -956,6 +970,7 @@ function phpAlert($msg) { } + } @@ -963,8 +978,11 @@ function phpAlert($msg) { if($TotalErrorFlag == 0) { - foreach($json as $j) + + + foreach($json as $index=>$j) { + $Emp = $j['Employee']; $EmpID = substr($Emp,0,4); @@ -984,12 +1002,15 @@ function phpAlert($msg) { $Incentives = $j['Incentives in ₹']; $Festival_Bonus = $j['Festival Bonus 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,'Created_By'=>$Created_By); - $result = $this->monthlypay_model->saveMonthlyData_model($monthlypaydata); - $total = $total + $result; - } + $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); + //print_r($monthlypaydata); + $result = $this->monthlypay_model->saveMonthlyData_model($monthlypaydata); + $total = $total + $result; + + } } //echo ""; if(!empty($ErrorEmpId)) diff --git a/application/models/monthlypay_model.php b/application/models/monthlypay_model.php index 751e5530..90ab0e31 100755 --- a/application/models/monthlypay_model.php +++ b/application/models/monthlypay_model.php @@ -99,7 +99,7 @@ if(strlen($month) == 6) //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.Loan_Amount,T_Loan_Master.Paid_Amount,T_Payroll.Key,T_Monthly_Pay_Inputs.Incentives as MonthlyIncentives,T_Monthly_Pay_Inputs.Loan_Recovered,T_Loan_History .Balance_Amount + $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.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 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 = ? @@ -115,7 +115,7 @@ if(strlen($month) == 6) $query = $this->db->query($sql,array($month,$month,$lastdate,$current,$current)); return $query->result(); } - + function getPublicHoldays($current="") { if(!empty($current)) diff --git a/application/views/monthlypayinputs.php b/application/views/monthlypayinputs.php index 4bfccb71..8f71a052 100755 --- a/application/views/monthlypayinputs.php +++ b/application/views/monthlypayinputs.php @@ -196,11 +196,10 @@ $('html').bind('keypress', function(e) { - //print_r($sample); + //print_r($sample); die; $index = 0; $i = 0; - $totalempSal = []; - //$totalinst =[]; + foreach($sample as $i=> $record) { //echo 'PAY'.$record->Key; @@ -221,7 +220,7 @@ $('html').bind('keypress', function(e) ?> - + EmpID ."-".$record->FirstName ."". $record->LastName ?> @@ -255,24 +254,28 @@ $('html').bind('keypress', function(e) Key)){echo "contenteditable='true';"; } ?> Key)){?> title="Payslip Calculated" style="text-align:right;color:blue;"style="text-align:right;" > - MonthlyIncentives)){echo $record->MonthlyIncentives;}else {echo $record->MasterIncentives;} ?> + MonthlyIncentives)){echo $record->MonthlyIncentives; $totalinst [] = $record->MonthlyIncentives;}else {echo $record->MasterIncentives; $totalinst [] = $record->MasterIncentives;} + + ?> - - + - Key)){echo "contenteditable='true';"; } ?> Key)){?> title="Payslip Calculated" style="text-align:right;color:blue;"style="text-align:right;" >Other_Deductions)){echo $record->Other_Deductions; }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;" >Other_Deductions)){echo $record->Other_Deductions;$totalotherDet [] = $record->Other_Deductions;}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;" >Festival_Bonus)){echo $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;" >Festival_Bonus)){echo $record->Festival_Bonus;$totalfestival [] = $record->Festival_Bonus;}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]; +}?> + + + @@ -298,8 +301,9 @@ $('html').bind('keypress', function(e) --> - - + + + - + Total - + + +

 

@@ -341,8 +347,29 @@ $('html').bind('keypress', function(e)