totalpayslip

This commit is contained in:
venbatechnologies 2018-05-23 16:08:40 +05:30
parent 937a1e23ff
commit 52fe1273e6
3 changed files with 118 additions and 44 deletions

View File

@ -819,12 +819,14 @@ function phpAlert($msg) {
} }
function saveMonthlyData() function saveMonthlyData()
{ {
$month = $this->input->post('param2'); $month = $this->input->post('param2');
$jsondata =$this->input->post('param1'); $jsondata =$this->input->post('param1');
$json = json_decode($jsondata,true); $json = json_decode($jsondata,true);
$mon=''; $mon='';
$year=''; $year='';
@ -854,8 +856,12 @@ function phpAlert($msg) {
$total = 0; $total = 0;
$ErrorEmpId = ''; $ErrorEmpId = '';
$TotalErrorFlag = 0; $TotalErrorFlag = 0;
foreach($json as $j) $i = sizeof($json);
$len = $i-2;
foreach($json as $index=>$j)
{ {
if($index<=$len){
$ErrorFlag = 0; $ErrorFlag = 0;
$Emp = $j['Employee']; $Emp = $j['Employee'];
@ -873,6 +879,7 @@ function phpAlert($msg) {
$Incentives = $j['Incentives in ₹']; $Incentives = $j['Incentives in ₹'];
$Festival_Bonus = $j['Festival Bonus in ₹']; $Festival_Bonus = $j['Festival Bonus in ₹'];
$Other_Deductions = $j['Other Deductions in ₹']; $Other_Deductions = $j['Other Deductions in ₹'];
$Estimate =$j['Estimate in ₹'];
$Created_By = $this->session->userdata ( 'userId' ); $Created_By = $this->session->userdata ( 'userId' );
if(!is_numeric($DaysWorked) || ($DaysWorked > 31) || (strlen((string)$DaysWorked)) > 5 ) if(!is_numeric($DaysWorked) || ($DaysWorked > 31) || (strlen((string)$DaysWorked)) > 5 )
@ -942,6 +949,13 @@ function phpAlert($msg) {
//echo $EmpID . "-Loan Recoverd Invalid Data!"; //echo $EmpID . "-Loan Recoverd Invalid Data!";
$ErrorFlag++; $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) if($ErrorFlag != 0)
{ {
@ -956,6 +970,7 @@ function phpAlert($msg) {
} }
}
@ -963,8 +978,11 @@ function phpAlert($msg) {
if($TotalErrorFlag == 0) if($TotalErrorFlag == 0)
{ {
foreach($json as $j)
foreach($json as $index=>$j)
{ {
$Emp = $j['Employee']; $Emp = $j['Employee'];
$EmpID = substr($Emp,0,4); $EmpID = substr($Emp,0,4);
@ -984,12 +1002,15 @@ function phpAlert($msg) {
$Incentives = $j['Incentives in ₹']; $Incentives = $j['Incentives in ₹'];
$Festival_Bonus = $j['Festival Bonus in ₹']; $Festival_Bonus = $j['Festival Bonus in ₹'];
$Other_Deductions = $j['Other Deductions in ₹']; $Other_Deductions = $j['Other Deductions in ₹'];
$Estimate =$j['Estimate in ₹'];
$Created_By = $this->session->userdata ( 'userId' ); $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); $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);
$result = $this->monthlypay_model->saveMonthlyData_model($monthlypaydata); //print_r($monthlypaydata);
$total = $total + $result; $result = $this->monthlypay_model->saveMonthlyData_model($monthlypaydata);
} $total = $total + $result;
}
} }
//echo "<script> alert($ErrorEmpId + '- are have Invalid Data!'); </script>"; //echo "<script> alert($ErrorEmpId + '- are have Invalid Data!'); </script>";
if(!empty($ErrorEmpId)) if(!empty($ErrorEmpId))

View File

@ -99,7 +99,7 @@ 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 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 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 = ?
@ -115,7 +115,7 @@ if(strlen($month) == 6)
$query = $this->db->query($sql,array($month,$month,$lastdate,$current,$current)); $query = $this->db->query($sql,array($month,$month,$lastdate,$current,$current));
return $query->result(); return $query->result();
} }
function getPublicHoldays($current="") function getPublicHoldays($current="")
{ {
if(!empty($current)) if(!empty($current))

View File

@ -196,11 +196,10 @@ $('html').bind('keypress', function(e)
{ {
//print_r($sample); //print_r($sample); die;
$index = 0; $index = 0;
$i = 0; $i = 0;
$totalempSal = [];
//$totalinst =[];
foreach($sample as $i=> $record) foreach($sample as $i=> $record)
{ {
//echo 'PAY'.$record->Key; //echo 'PAY'.$record->Key;
@ -221,7 +220,7 @@ $('html').bind('keypress', function(e)
?> ?>
<tr> <tr class="lastvalue">
<td style="text-align:right;" style="background-color:blue;"><?php echo $index; ?></td> <td style="text-align:right;" style="background-color:blue;"><?php echo $index; ?></td>
<!-- <td style="text-align:right;"><?php echo $record->EmpID ?></td> --> <!-- <td style="text-align:right;"><?php echo $record->EmpID ?></td> -->
<td style="max-width:80px"><?php echo $record->EmpID ."-".$record->FirstName ."". $record->LastName ?></td> <td style="max-width:80px"><?php echo $record->EmpID ."-".$record->FirstName ."". $record->LastName ?></td>
@ -255,24 +254,28 @@ $('html').bind('keypress', function(e)
<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 }?> > <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->MasterIncentives)){echo $record->MasterIncentives;}else {echo $record->MonthlyIncentives;} ?> -->
<?php if(!empty($record->MonthlyIncentives)){echo $record->MonthlyIncentives;}else {echo $record->MasterIncentives;} ?> <?php if(!empty($record->MonthlyIncentives)){echo $record->MonthlyIncentives; $totalinst [] = $record->MonthlyIncentives;}else {echo $record->MasterIncentives; $totalinst [] = $record->MasterIncentives;}
?>
<!-- <?php $totalinst [] =$MasterIncentives[$i]; ?>
-->
</td> </td>
<?php ?>
<!-- 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;$totalotherDet [] = $record->Other_Deductions;}else{ echo number_format(0.00,2,'.','');} ?></td>
<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; }else{ echo number_format(0.00,2,'.','');;} ?></td> <?php $totalotherDet [] = $Other_Deductions;?>
<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="empsal<?php echo $index?>"><?php echo $empSalary[$i];?></td>
<?php $totalempSal [] = $empSalary[$i];?> <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>
@ -298,8 +301,9 @@ $('html').bind('keypress', function(e)
<input type="hidden" id = "eid" value="<?php echo $record->OT_Hrs_Worked?>"> <input type="hidden" id = "eid" value="<?php echo $record->OT_Hrs_Worked?>">
<input type="hidden" id = "eid" value="<?php echo $record->NoofDays?>"> <input type="hidden" id = "eid" value="<?php echo $record->NoofDays?>">
<input type="hidden" id = "eid" value="<?php echo $record->Monthly_Due?>"> --> <input type="hidden" id = "eid" value="<?php echo $record->Monthly_Due?>"> -->
</tr> </tr>
<?php <?php
@ -308,22 +312,24 @@ $('html').bind('keypress', function(e)
} }
} }
//print_r($totalinst);
?> ?>
</tbody> </tbody>
<tfoot><tr> <tfoot><tr>
<th colspan="4"></th> <th colspan="4"></th>
<th colspan="3"></th> <th colspan="3"></th>
<th>Total</th> <th>Total</th>
<th id="inst"><?php echo array_sum($totalinst);?></th> <th id="inst"><?php echo array_sum($totalinst);?></th>
<th id="other"><?php echo array_sum($totalotherDet);?></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="totalsal"><?php echo array_sum($totalempSal);?></th> <th id="estsal"><?php echo array_sum($estTotal);?></th>
</tr> </tr>
</tfoot> </tfoot>
</table> </table>
<p>&nbsp;</p> <p>&nbsp;</p>
<div class="row"> <div class="row">
<div class="col-md-3" id="savebutton"> <div class="col-md-3" id="savebutton">
@ -341,8 +347,29 @@ $('html').bind('keypress', function(e)
</div> </div>
<script type="text/javascript" src="<?php echo base_url(); ?>assets/js/common.js" charset="utf-8"></script> <script type="text/javascript" src="<?php echo base_url(); ?>assets/js/common.js" charset="utf-8"></script>
<script type="text/javascript"> <script type="text/javascript">
$(function () { var estTotal = [];
var totalinst = [];
var totalotherDet =[];
$(function () {
var i = 0;
$('tr.lastvalue').each(function(){
i = i+1;
estTotal [i]=$(this).find('td').eq(11).text();
});
var i = 0;
$('tr.lastvalue').each(function(){
i = i+1;
totalinst [i]=$(this).find('td').eq(8).text();
});
var i = 0;
$('tr.lastvalue').each(function(){
i = i+1;
totalotherDet [i]=$(this).find('td').eq(9).text();
});
/* $('#monthlylisting').DataTable({ /* $('#monthlylisting').DataTable({
"paging": true, "paging": true,
@ -355,7 +382,7 @@ $('html').bind('keypress', function(e)
}); */ }); */
var key = <?php echo $show_hide_column_value; ?> //var key = <?php echo $show_hide_column_value; ?>;
@ -365,7 +392,7 @@ $('html').bind('keypress', function(e)
show_hide_column(11,key); // show_hide_column(11,key);
var t = $('#monthlylistings').DataTable( { var t = $('#monthlylistings').DataTable( {
"columnDefs": [ { "columnDefs": [ {
"searchable": false, "searchable": false,
@ -523,17 +550,18 @@ function isCheckKeyCode(event){
} }
var totalinst = [];
var totalotherDet =[];
var totalfestival =[]; var totalfestival =[];
var totalempSal=[]; var totalempSal=[];
var grandtotal = [];
function changeInput(event,k) function changeInput(event,k)
{ {
var str=event.target.id; var str=event.target.id;
var sno = str.substr(8); var sno = str.substr(8);
//alert(sno);
var dayWorks=parseFloat(document.getElementById('dayWork'+sno).textContent); var dayWorks=parseFloat(document.getElementById('dayWork'+sno).textContent);
var lopDay=parseFloat(document.getElementById('lopDay'+sno).textContent); var lopDay=parseFloat(document.getElementById('lopDay'+sno).textContent);
@ -546,11 +574,10 @@ function isCheckKeyCode(event){
totalinst[sno] = incentie;
var otherDet =parseFloat(document.getElementById('otherDet'+sno).textContent); var otherDet =parseFloat(document.getElementById('otherDet'+sno).textContent);
totalotherDet[sno] = otherDet; //totalotherDet[sno] = otherDet;
var Festival =parseFloat(document.getElementById('Festival'+sno).textContent); var Festival =parseFloat(document.getElementById('Festival'+sno).textContent);
totalfestival[sno]= Festival ; totalfestival[sno]= Festival ;
@ -688,12 +715,11 @@ totalfestival[sno]= Festival ;
{ {
esiAmount = 0; esiAmount = 0;
} }
var pfAmount = currentDaySalary * pfRate / 100; var pfAmount = currentDaySalary * pfRate / 100;
// console.log("11daypf"+pfAmount); // 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 empSalarySub = current_loan_amt + esiAmount + pfAmount + otherDets; var empSalarySub = current_loan_amt + esiAmount + pfAmount + otherDets;
@ -708,12 +734,37 @@ totalfestival[sno]= Festival ;
var cals =(employeeSalary).toFixed(0); var cals =(employeeSalary).toFixed(0);
document.getElementById("empsal"+sno).innerHTML = cals; document.getElementById("empsal"+sno).innerHTML = cals;
$.each(estTotal,function(i,value){
if(sno==i){
estTotal[i] = cals;
}
});
//console.log(estTotal);
totalempSal[sno]= cals ; $.each(totalinst,function(i,value){
if(sno==i){
totalinst[i] = incentie;
}
});
$.each(totalotherDet,function(i,value){
if(sno==i){
totalotherDet[i] = otherDet;
}
});
//console.log(totalinst);
calculategrandtotal(); calculategrandtotal();
} }
@ -760,7 +811,9 @@ function calculategrandtotal(){
} }
$('#fest').text(parseFloat(sum).toFixed(2)); $('#fest').text(parseFloat(sum).toFixed(2));
$.each(totalempSal, function( index, value )
$.each(estTotal, function( index, value )
{ {
//var res2 = value.split('-'); //var res2 = value.split('-');
tempTotal[index]=parseFloat(value); tempTotal[index]=parseFloat(value);
@ -771,7 +824,7 @@ function calculategrandtotal(){
for (var i = 0; i < tempTotal.length; i++) { for (var i = 0; i < tempTotal.length; i++) {
sum += tempTotal[i] << 0; sum += tempTotal[i] << 0;
} }
$('#totalsal').text(parseFloat(sum).toFixed(2)); $('#estsal').text(parseFloat(sum).toFixed(2));
} }