Payslip generate not edit monthlypayslip

This commit is contained in:
venbatechnologies 2018-04-30 18:14:35 +05:30
parent 3d1ffa6238
commit 9b6d03b814
3 changed files with 166 additions and 108 deletions

View File

@ -512,11 +512,10 @@ function phpAlert($msg) {
$data['dropdownvalue'] = $current; $data['dropdownvalue'] = $current;
$data['fresh'] = $this->monthlypay_model->getEmpPayDetailsforMonthInputs($current); $data['fresh'] = $this->monthlypay_model->getEmpPayDetailsforMonthInputs($current);
//print_r( $data['fresh']); //print_r( $data['fresh']);
$employeeSalary = []; $employeeSalary = [];
foreach($data['fresh'] as $value){ foreach($data['fresh'] as $value){
//print_r($value);
$NoofDays=$value->NoofDays;//Month day 30,31,28 $NoofDays=$value->NoofDays;//Month day 30,31,28
$HRA_Amount = $value->HRA_Amount; $HRA_Amount = $value->HRA_Amount;
$Basic_Pay = $value->Basic_Pay; $Basic_Pay = $value->Basic_Pay;
@ -527,12 +526,30 @@ foreach($data['fresh'] as $value){
$Paid_leave = $value->Paid_leave; // leave day $Paid_leave = $value->Paid_leave; // leave day
$OT_Hrs_Worked = $value->OT_Hrs_Worked; //OT hours $OT_Hrs_Worked = $value->OT_Hrs_Worked; //OT hours
$Monthly_Due= $value->Monthly_Due;// loan due amt $Monthly_Due= $value->Monthly_Due;// loan due amt
$Incentives=$value->Incentives; $MasterIncentives=$value->Incentives;//Master values get
// echo 'master'.$MasterIncentives;
$Allowances =$value->Allowances; $Allowances =$value->Allowances;
$HRA_Rate=$value->HRA_Rate; $HRA_Rate=$value->HRA_Rate;
$PF_Rate=$value->PF_Rate; $PF_Rate=$value->PF_Rate;
$ESI_Rate=$value->ESI_Rate; $ESI_Rate=$value->ESI_Rate;
$MonthIncentive = $value->Incent;//T_Monthly_Pay_Inputs,for change month
//echo 'month'. $MonthIncentive;
$Incentive = 0;
if(empty($MonthIncentive))
{
$Incentive = $MasterIncentives;
}
else
{
$Incentive = $MonthIncentive;
}
//echo $Incentive;
@ -583,7 +600,7 @@ foreach($data['fresh'] as $value){
/** pf amount per day**/ /** pf amount per day**/
//echo $totalothour;die; //echo $totalothour;die;
$salaryInCurrentdays = $currentDaySalary + $totSalayOT + $currentDayHra + $dayFood_Allowance + $Allowances + $Incentives; $salaryInCurrentdays = $currentDaySalary + $totSalayOT + $currentDayHra + $dayFood_Allowance + $Allowances + $Incentive;
$salaryInCurrentday = $salaryInCurrentdays - ($esiAmount + $pfAmount) - $Monthly_Due; $salaryInCurrentday = $salaryInCurrentdays - ($esiAmount + $pfAmount) - $Monthly_Due;
$employeeSalary []= round($salaryInCurrentday); $employeeSalary []= round($salaryInCurrentday);
@ -592,16 +609,20 @@ foreach($data['fresh'] as $value){
} }
$data['empSalary'] = $employeeSalary; $data['empSalary'] = $employeeSalary;
//echo sizeof($data['fresh'])."-".sizeof($data['empSalary']);die;
$this->global['pageTitle'] = 'Siddharth : Payroll Monthly Inputs'; $this->global['pageTitle'] = 'Siddharth : Payroll Monthly Inputs';
$this->loadViews("monthlypayinputs", $this->global,$data,NULL); $this->loadViews("monthlypayinputs", $this->global,$data,NULL);
} }
function changeMonth() function changeMonth()
{ {
$current = $this->input->post('monthyear'); $current = $this->input->post('monthyear');
//echo $current;
//$month = '0'.$current;
//echo 'c'.$month;
$data['month'] = $this->monthlypay_model->monthlyListing($current); $data['month'] = $this->monthlypay_model->monthlyListing($current);
//print_r($data['month']); //print_r($data['month']);
@ -612,7 +633,7 @@ foreach($data['fresh'] as $value){
$employeeSalary = []; $employeeSalary = [];
foreach($data['fresh'] as $value){ foreach($data['fresh'] as $value){
//print_r($value);
$NoofDays=$value->NoofDays;//Month day 30,31,28 $NoofDays=$value->NoofDays;//Month day 30,31,28
$HRA_Amount = $value->HRA_Amount; $HRA_Amount = $value->HRA_Amount;
$Basic_Pay = $value->Basic_Pay; $Basic_Pay = $value->Basic_Pay;
@ -623,12 +644,30 @@ foreach($data['fresh'] as $value){
$Paid_leave = $value->Paid_leave; // leave day $Paid_leave = $value->Paid_leave; // leave day
$OT_Hrs_Worked = $value->OT_Hrs_Worked; //OT hours $OT_Hrs_Worked = $value->OT_Hrs_Worked; //OT hours
$Monthly_Due= $value->Monthly_Due;// loan due amt $Monthly_Due= $value->Monthly_Due;// loan due amt
$Incentives=$value->Incentives; $MasterIncentives=$value->Incentives;//Master values get
// echo 'master'.$MasterIncentives;
$Allowances =$value->Allowances; $Allowances =$value->Allowances;
$HRA_Rate=$value->HRA_Rate; $HRA_Rate=$value->HRA_Rate;
$PF_Rate=$value->PF_Rate; $PF_Rate=$value->PF_Rate;
$ESI_Rate=$value->ESI_Rate; $ESI_Rate=$value->ESI_Rate;
$MonthIncentive = $value->Incent;//T_Monthly_Pay_Inputs,for change month
//echo 'month'. $MonthIncentive;
$Incentive = 0;
if(empty($MonthIncentive))
{
$Incentive = $MasterIncentives;
}
else
{
$Incentive = $MonthIncentive;
}
//echo $Incentive;
@ -679,7 +718,7 @@ foreach($data['fresh'] as $value){
/** pf amount per day**/ /** pf amount per day**/
//echo $totalothour;die; //echo $totalothour;die;
$salaryInCurrentdays = $currentDaySalary + $totSalayOT + $currentDayHra + $dayFood_Allowance + $Allowances + $Incentives; $salaryInCurrentdays = $currentDaySalary + $totSalayOT + $currentDayHra + $dayFood_Allowance + $Allowances + $Incentive;
$salaryInCurrentday = $salaryInCurrentdays - ($esiAmount + $pfAmount) - $Monthly_Due; $salaryInCurrentday = $salaryInCurrentdays - ($esiAmount + $pfAmount) - $Monthly_Due;
$employeeSalary []= round($salaryInCurrentday); $employeeSalary []= round($salaryInCurrentday);

View File

@ -67,7 +67,16 @@ class monthlypay_model extends CI_Model
function getEmpPayDetailsforMonthInputs($current="") function getEmpPayDetailsforMonthInputs($current="")
{ {
//echo $current; //$month = '0'.$current;
$month = $current;
if(strlen($month) == 6)
{
$month = '0'.$month;
}
//echo $month;
$current = '01-'.$current; $current = '01-'.$current;
//echo $current; //echo $current;
$current = date_create($current); $current = date_create($current);
@ -79,16 +88,20 @@ class monthlypay_model extends CI_Model
//$monthyear_val = date('Y-m',strtotime($current)); //$monthyear_val = date('Y-m',strtotime($current));
$lastdate = $year_val.'-'.$month_val.'-'.$date_val; $lastdate = $year_val.'-'.$month_val.'-'.$date_val;
//echo $lastdate; //echo $lastdate;
$sql = "select T_Emp_Pay_Data.EmpID, T_Emp_Pay_Data.Incentives,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_Payroll.Key from T_Emp_Pay_Data
//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,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_Payroll.Key,T_Monthly_Pay_Inputs.Incentives as Incent
from T_Emp_Pay_Data
left join T_Employee_Details on T_Employee_Details.EmpID = T_Emp_Pay_Data.EmpID 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 month(T_Payroll.PayOn) = month(?) and year(T_Payroll.PayOn) = year(?) left join T_Payroll on T_Employee_Details.EmpID = T_Payroll.EmpID and T_Payroll.PayOn = ?
left join T_Attendance on T_Emp_Pay_Data.EmpID = T_Attendance.EmpID left join T_Attendance on T_Emp_Pay_Data.EmpID = T_Attendance.EmpID
left join T_Monthly_Pay_Inputs on T_Monthly_Pay_Inputs.EmpID = T_Emp_Pay_Data.EmpID
left join T_Loan_Master on T_Emp_Pay_Data.EmpID = T_Loan_Master.EmpID and T_Loan_Master.is_Active = 1 left join T_Loan_Master on T_Emp_Pay_Data.EmpID = T_Loan_Master.EmpID and T_Loan_Master.is_Active = 1
where T_Employee_Details.DateofJoining <= ? where T_Employee_Details.DateofJoining <= ?
and month(T_Attendance.Month_Year) = month(?) and year(T_Attendance.Month_Year) = year(?) and month(T_Attendance.Month_Year) = month(?) and year(T_Attendance.Month_Year) = year(?)
order by T_Employee_Details.EmpID"; order by T_Employee_Details.EmpID";
$query = $this->db->query($sql,array($current,$current,$lastdate,$current,$current)); $query = $this->db->query($sql,array($month,$lastdate,$current,$current));
return $query->result(); return $query->result();
} }

View File

@ -1,5 +1,8 @@
<?php <?php
$sample = array_merge($month,$fresh); $sample = array_merge($month,$fresh);
// print_r($fresh);
//print_r("month"+$month);
$ex = explode('-',$dropdownvalue); $ex = explode('-',$dropdownvalue);
if(strlen($ex[0])== '2') if(strlen($ex[0])== '2')
@ -68,6 +71,8 @@ $('html').bind('keypress', function(e)
$year = date("Y"); $year = date("Y");
$current = date("m-Y"); $current = date("m-Y");
//echo $current;
$month = date("m"); $month = date("m");
if($month < 10) if($month < 10)
{ {
@ -184,7 +189,7 @@ $('html').bind('keypress', function(e)
$i = 0; $i = 0;
foreach($sample as $i=> $record) foreach($sample as $i=> $record)
{ {
//echo 'PAY'.$record->Key;
$index++; $index++;
if(in_array($record->EmpID,$testarray)) if(in_array($record->EmpID,$testarray))
@ -225,7 +230,8 @@ $('html').bind('keypress', function(e)
<td id="loanRecd<?php echo $index?>" onkeypress="return isCheckKeyCode(event);" onkeyup="changeInput(event);"<?php if(empty($record->Key) && !empty($record->Loan_ID)){ echo "contenteditable='true'; style='background-color:#ffcccc;text-align:right' title='Loan Pending'"; } ?> <?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->Loan_Recovered)){if(is_numeric($record->Loan_Recovered)){echo number_format($record->Loan_Recovered,2,'.','');}else {echo $record->Loan_Recovered;}}else{echo number_format(0.00,2,'.','');} ?></td> <td id="loanRecd<?php echo $index?>" onkeypress="return isCheckKeyCode(event);" onkeyup="changeInput(event);"<?php if(empty($record->Key) && !empty($record->Loan_ID)){ echo "contenteditable='true'; style='background-color:#ffcccc;text-align:right' title='Loan Pending'"; } ?> <?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->Loan_Recovered)){if(is_numeric($record->Loan_Recovered)){echo number_format($record->Loan_Recovered,2,'.','');}else {echo $record->Loan_Recovered;}}else{echo number_format(0.00,2,'.','');} ?></td>
<td id="incentie<?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->Incentives)){echo $record->Incentives;}else{ echo number_format(0.00,2,'.','');;} ?></td> <td id="incentie<?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->Incent)){echo $record->Incent;}else {echo $record->Incentives;} ?></td>
<!-- else{ echo number_format(0.00,2,'.','');;} -->
<td id ="otherDet<?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->Other_Deductions)){echo $record->Other_Deductions; }else{ echo number_format(0.00,2,'.','');;} ?></td> <td id ="otherDet<?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->Other_Deductions)){echo $record->Other_Deductions; }else{ echo number_format(0.00,2,'.','');;} ?></td>
@ -552,7 +558,7 @@ var manualLoan =parseFloat(loanRecd);
current_loan_amt = manualLoan; current_loan_amt = manualLoan;
} }
console.log(current_loan_amt); // console.log(current_loan_amt);
if(parseFloat(incentie) == parseFloat(incentie)){ if(parseFloat(incentie) == parseFloat(incentie)){