payslip incentives edit

This commit is contained in:
venbatechnologies 2018-05-02 13:43:21 +05:30
parent ce44c0bd75
commit f34c4b8452
4 changed files with 59 additions and 34 deletions

View File

@ -507,6 +507,7 @@ function phpAlert($msg) {
public function monthlyInputs() public function monthlyInputs()
{ {
$current = date("m-Y"); $current = date("m-Y");
//echo $current;
$data['month'] = $this->monthlypay_model->monthlyListing($current); $data['month'] = $this->monthlypay_model->monthlyListing($current);
// $data['fresh'] = $this-> monthlypay_model->getEmpPayDetails($current); // $data['fresh'] = $this-> monthlypay_model->getEmpPayDetails($current);
$data['dropdownvalue'] = $current; $data['dropdownvalue'] = $current;
@ -526,7 +527,7 @@ 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
$MasterIncentives=$value->Incentives;//Master values get $MasterIncentives=$value->MasterIncentives;//Master values get
// echo 'master'.$MasterIncentives; // echo 'master'.$MasterIncentives;
$Allowances =$value->Allowances; $Allowances =$value->Allowances;
@ -534,21 +535,21 @@ foreach($data['fresh'] as $value){
$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 $MonthIncentive = $value->MonthlyIncentives;//T_Monthly_Pay_Inputs,for change month
//echo 'month'. $MonthIncentive; //echo 'month'. $MonthIncentive;
$Incentive = 0; // $Incentive = 0;
if(empty($MonthIncentive)) // if(empty($MonthIncentive))
{ // {
$Incentive = $MasterIncentives; // $Incentive = $MasterIncentives;
} // }
else // else
{ // {
$Incentive = $MonthIncentive; // $Incentive = $MonthIncentive;
} // }
//echo $Incentive; //echo $Incentive;
@ -600,7 +601,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 + $Incentive; $salaryInCurrentdays = $currentDaySalary + $totSalayOT + $currentDayHra + $dayFood_Allowance + $Allowances + $MasterIncentives;
$salaryInCurrentday = $salaryInCurrentdays - ($esiAmount + $pfAmount) - $Monthly_Due; $salaryInCurrentday = $salaryInCurrentdays - ($esiAmount + $pfAmount) - $Monthly_Due;
$employeeSalary []= round($salaryInCurrentday); $employeeSalary []= round($salaryInCurrentday);
@ -644,7 +645,7 @@ 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
$MasterIncentives=$value->Incentives;//Master values get $MasterIncentives=$value->MasterIncentives;//Master values get
// echo 'master'.$MasterIncentives; // echo 'master'.$MasterIncentives;
$Allowances =$value->Allowances; $Allowances =$value->Allowances;
@ -652,7 +653,7 @@ foreach($data['fresh'] as $value){
$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 $MonthIncentive = $value->MonthlyIncentives;//T_Monthly_Pay_Inputs,for change month
//echo 'month'. $MonthIncentive; //echo 'month'. $MonthIncentive;
$Incentive = 0; $Incentive = 0;

View File

@ -12,12 +12,20 @@ class monthlypay_model extends CI_Model
*/ */
function monthlyListing($current="") function monthlyListing($current="")
{ {
//echo $current;
$month = $current;
if(strlen($month) == 6)
{
$month = '0'.$month;
}
//echo $month;
$curr_split = explode('-',$current); $curr_split = explode('-',$current);
$month_val = $curr_split[0]; $month_val = $curr_split[0];
$year_val = $curr_split[1]; $year_val = $curr_split[1];
$date_val =cal_days_in_month(CAL_GREGORIAN,$month_val,$year_val); $date_val =cal_days_in_month(CAL_GREGORIAN,$month_val,$year_val);
$lastdate = $year_val.'-'.$month_val.'-'.$date_val; $lastdate = $year_val.'-'.$month_val.'-'.$date_val;
//echo $lastdate ;
// $this->db->select('T_Monthly_Pay_Inputs.*,T_Employee_Details.FirstName,T_Employee_Details.LastName,T_Payroll.Key,T_Loan_Master.Loan_ID'); // $this->db->select('T_Monthly_Pay_Inputs.*,T_Employee_Details.FirstName,T_Employee_Details.LastName,T_Payroll.Key,T_Loan_Master.Loan_ID');
// $this->db->from('T_Monthly_Pay_Inputs'); // $this->db->from('T_Monthly_Pay_Inputs');
@ -43,6 +51,7 @@ class monthlypay_model extends CI_Model
return $result; return $result;
} }
function getEmpPayDetails($current="",$s="") function getEmpPayDetails($current="",$s="")
{ {
@ -90,18 +99,19 @@ if(strlen($month) == 6)
//echo $lastdate; //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(?) //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 $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_Payroll.Key,T_Monthly_Pay_Inputs.Incentives as MonthlyIncentives
from T_Emp_Pay_Data 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 T_Payroll.PayOn = ? 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_Monthly_Pay_Inputs on T_Monthly_Pay_Inputs.EmpID = T_Emp_Pay_Data.EmpID and T_Monthly_Pay_Inputs.Month_Year = ?
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($month,$lastdate,$current,$current)); $query = $this->db->query($sql,array($month,$month,$lastdate,$current,$current));
return $query->result(); return $query->result();
} }

View File

@ -49,7 +49,7 @@
<div class="col-md-3"> <div class="col-md-3">
<label>Nature of Maintenance:</label></br> <label>Nature of Maintenance:</label></br>
<input type="radio" id="radiobtn1" name="radiobtn" value="0" checked>Maintenance &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <input type="radio" id="radiobtn1" name="radiobtn" value="0" checked>Preventive &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<input type="radio" id="radiobtn2" name="radiobtn" value="1" >Breakdown <input type="radio" id="radiobtn2" name="radiobtn" value="1" >Breakdown
</div> </div>

View File

@ -1,6 +1,6 @@
<?php <?php
$sample = array_merge($month,$fresh); $sample = array_merge($month,$fresh);
// print_r($fresh);
//print_r("month"+$month); //print_r("month"+$month);
$ex = explode('-',$dropdownvalue); $ex = explode('-',$dropdownvalue);
@ -68,7 +68,7 @@ $('html').bind('keypress', function(e)
</div><!-- /.box-header --> </div><!-- /.box-header -->
<?php <?php
print_r($sample);
$year = date("Y"); $year = date("Y");
$current = date("m-Y"); $current = date("m-Y");
@ -230,7 +230,17 @@ $('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->Incent)){echo $record->Incent;}else {echo $record->Incentives;} ?></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->MasterIncentives)){echo $record->MasterIncentives;}else {echo $record->MonthlyIncentives;} ?> -->
<?php if(!empty($record->MonthlyIncentives)){echo $record->MonthlyIncentives;}else {echo $record->MasterIncentives;} ?>
</td>
<!-- else{ echo number_format(0.00,2,'.','');;} --> <!-- 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>
@ -418,11 +428,13 @@ function isCheckKeyCode(event){
{ {
if(year == 1) if(year == 1)
{ {
$("#savebutton").hide(); // $("#savebutton").hide();
$("#savebutton").show();
} }
else else
{ {
$("#savebutton").hide(); //$("#savebutton").hide();
$("#savebutton").show();
} }
} }
else if(savebuttonstatus < 0 ) else if(savebuttonstatus < 0 )
@ -434,16 +446,19 @@ function isCheckKeyCode(event){
} }
else if(year == 0) else if(year == 0)
{ {
$("#savebutton").hide(); // $("#savebutton").hide();
$("#savebutton").show();
} }
else else
{ {
$("#savebutton").hide(); //$("#savebutton").hide();
$("#savebutton").show();
} }
} }
else if(savebuttonstatus == 0 && year == 0) else if(savebuttonstatus == 0 && year == 0)
{ {
$("#savebutton").hide(); //$("#savebutton").hide();
$("#savebutton").show();
} }
else if(savebuttonstatus == 1) else if(savebuttonstatus == 1)
{ {
@ -464,7 +479,6 @@ function isCheckKeyCode(event){
{ {
//alert("hello");
var str=event.target.id; var str=event.target.id;
var sno = str.substr(8); var sno = str.substr(8);
//alert(sno); //alert(sno);
@ -491,7 +505,7 @@ function isCheckKeyCode(event){
var hraAmt =parseFloat(document.getElementById('hraAmt'+sno).value); var hraAmt =parseFloat(document.getElementById('hraAmt'+sno).value);
//console.log(incentie); //con(incentie);
var dayWorkPaid=dayWorks+paidLeave; var dayWorkPaid=dayWorks+paidLeave;
// console.log("day"+dayWorkPaid); // console.log("day"+dayWorkPaid);