Change in UAN number pattern : GWM

This commit is contained in:
bitbucket 2024-08-21 14:19:01 +05:30
parent 2ccef97eb2
commit c3f406fbde
4 changed files with 785 additions and 745 deletions

View File

@ -778,7 +778,7 @@ class Payslip extends BaseController
$data['esi'] = $esi;
$data['pf'] = $pf;
$data['over_time'] = $ot;
// dd($data);
//echo sizeof($data['fresh'])."-".sizeof($data['empSalary']);die;
$this->global['pageTitle'] = 'Payroll Monthly Inputs';
$this->loadViews("monthlypayinputs", $this->global, $data, NULL);
@ -824,9 +824,9 @@ class Payslip extends BaseController
$ErrorFlag = 0;
$Emp = $j['Employee'];
$EmpID = substr($Emp, 0, 4);
$EmpID = $j['Emp ID'];
//$Name = $j['Employee Name'];
//echo $EmpID; die;
@ -838,7 +838,7 @@ class Payslip extends BaseController
$Loan_Recovered = $j['Manual Loan Due ₹'];
$Incentives = $j['Incentives in ₹'];
$Festival_Bonus = $j['Festival Bonus in ₹'];
$Other_Deductions = $j['Other Deductions in ₹'];
$Other_Deductions = $j['TDS Deductions in ₹'];
$Estimate = $j['Estimate in ₹'];
$Created_By = $this->session->get('userId');
@ -921,18 +921,13 @@ class Payslip extends BaseController
foreach ($json as $index => $j) {
$Emp = $j['Employee'];
// $EmpID = substr($Emp, 0, 4);
$parts = explode("-", $Emp);
$EmpID = $parts[0];
//$Name = $j['Employee'];
$EmpID = $j['Emp ID'];
$DaysWorked = $j['Days Worked'];
$LOP_Days = $j['LOP Days'];
$Paid_leave = $j['Paid Leave'];
$OT_Hrs_Worked = $j['OT Hrs'];
$LOP_Days = isset($j['LOP Days']) ? $j['LOP Days'] : 0.00;
$Paid_leave = isset($j['Paid Leave']) ? $j['Paid Leave'] : 0.00;
$OT_Hrs_Worked = isset($j['OT Hrs']) ? $j['OT Hrs'] : 0.00;
$Loan_Recovered = isset($j['Manual Loan Due ₹']) ? $j['Manual Loan Due ₹'] : 0.00;
if (is_string($Loan_Recovered)) {
$Loan_Recovered = strtoupper($Loan_Recovered);
@ -944,7 +939,7 @@ class Payslip extends BaseController
$Created_By = $this->session->get('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);
// print_r($monthlypaydata); die;
//print_r($monthlypaydata); die;
$result = $this->monthlypay_model->saveMonthlyData_model($monthlypaydata);
$total = $total + $result;
}
@ -993,8 +988,6 @@ class Payslip extends BaseController
$Data['Payon'] = $this->payroll_model->getPayOn();
$this->global['pageTitle'] = 'Payroll Generater';
$this->loadViews("payslipgenerate", $this->global, $Data, NULL);
@ -1015,6 +1008,7 @@ class Payslip extends BaseController
$id = $this->request->getPost('id1');
$result = $this->payroll_model->getEmployeelist2($id);
$HTML = "";
if (count($result) > 0) {

View File

@ -394,7 +394,7 @@ function onlyAlphabets(evt) {
function validatePF() {
var regpf = /^([a-zA-Z]){5}([0-9]){17}$/;
var regpf = /^\d{12}$/;
var PF = $('#pfno').val();
@ -1005,8 +1005,8 @@ legend {
<input type="text" id="pfno" name="pfno" maxlength="22"
onchange="validatePF();" class="form-control"
style="text-transform:uppercase"
pattern="([a-zA-Z]){5}([0-9]){17}"
title=" 5 Character and 17 Digit number (ex:ABCDE12345678901234567)"
pattern="\d{12}"
title="12 Digit number"
onkeypress="return alpha(event);">
</div>
</div>

View File

@ -494,7 +494,7 @@ function validateESI() {
}
function validatePF() {
var regpf = /^([a-zA-Z]){5}([0-9]){17}?$/;
var regpf = /^\d{12}$/;
var PF = $('#pfno').val();
@ -1307,8 +1307,8 @@ legend {
value="<?php echo $pfno; ?>"
onchange="validatePF();" class="form-control"
style="text-transform:uppercase"
pattern="([a-zA-Z]){5}([0-9]){17}"
title=" 5 Character and 17 Digit number (ex:ABCDE12345678901234567)"
pattern="\d{12}"
title="12 Digit number"
onkeypress="return alpha(event);">
</div>
</div>

View File

@ -35,28 +35,24 @@
?>
<script src="<?php echo base_url()?>public/assets/lightswitch/lightswitch/lib/jquery.tabletojson.js"></script>
<script src="<?php echo base_url()?>public/assets/lightswitch/lightswitch/lib/jquery.tabletojson.min.js"></script>
<script src="<?php echo base_url()?>public/assets/lightswitch/lightswitch/lib/jquery.tabletojson.js"></script>
<script src="<?php echo base_url()?>public/assets/lightswitch/lightswitch/lib/jquery.tabletojson.min.js"></script>
<script>
$('html').bind('keypress', function(e)
{
<script>
$('html').bind('keypress', function(e) {
//alert('Key Pressed');
if(e.keyCode == 13)
{
if (e.keyCode == 13) {
return false;
}
});
</script>
</script>
<style type="text/css">
.num {
text-align:right;
<style type="text/css">
.num {
text-align: right;
}
</style>
<div class="content-wrapper">
</style>
<div class="content-wrapper">
<!-- Content Header (Page header) -->
<section class="content-header">
<h1>
@ -65,7 +61,7 @@ $('html').bind('keypress', function(e)
</section>
<section class="content">
<input type="hidden" id="paydate" value="<?php echo $drop;?>"/>
<input type="hidden" id="paydate" value="<?php echo $drop;?>" />
<div class="row">
<div class="col-xs-12">
<div class="box">
@ -73,10 +69,13 @@ $('html').bind('keypress', function(e)
<!--<center><h3 class="box-title">-->
<div class="box-tools">
<!-- <form action="<?php echo base_url() ?>assetListing" method="POST" id="searchList">-->
<p><b>The <span style="background-color:#ff4d4d;">Red</span> highlighted Employee have loan to pay. Put <span style="background-color:#66ff33;">'NA'</span> for Skip Current Month Loan Due.</b></p>
<p><b>The <span style="background-color:#ff4d4d;">Red</span> highlighted Employee have loan
to pay. Put <span style="background-color:#66ff33;">'NA'</span> for Skip Current
Month Loan Due.</b></p>
<form action="<?php echo base_url() ?>monthlyListings" method="POST" id="searchList">
</form>
</div><!--</h3></center>-->
</div>
<!--</h3></center>-->
</div><!-- /.box-header -->
<?php
@ -158,8 +157,9 @@ $('html').bind('keypress', function(e)
</div>
</div>
<div style="overflow-x:scroll;">
<table id="monthlylistings" class="table table-bordered table-hover" style="background-color:#fff;font-size:12px" >
<div style="overflow-x:scroll;">
<table id="monthlylistings" class="table table-bordered table-hover"
style="background-color:#fff;font-size:12px">
<thead style="background-color: #ddd;">
<tr>
@ -227,7 +227,8 @@ $('html').bind('keypress', function(e)
?>
<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="max-width:80px"><?php echo $record->EmpID ; ?></td>
<td style="max-width:80px"><?php echo $record->FirstName; ?></td>
<td style="max-width:80px">
@ -239,19 +240,54 @@ $('html').bind('keypress', function(e)
</td>
<td style="max-width:80px"><?php echo $record->Designation; ?></td>
<td style="max-width:80px"><?php echo $record->NoofDays; ?></td>
<td id="dayWork<?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 } else{?>style="text-align:right;"<?php }?> ><?php if(!empty($record->Days_worked)){echo $record->Days_worked+$record->sunday_count;}else{echo "0.00";}?></td>
<td id="lopDay<?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 } else{?>style="text-align:right;"<?php }?> ><?php if(!empty($record->LOP_Days)){echo $record->LOP_Days;}else{echo "0.00";}?></td>
<td id="paidLeave<?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 } else{?>style="text-align:right;"<?php }?> ><?php if(!empty($record->Paid_leave)){echo number_format($record->Paid_leave,2,'.','');}else { echo number_format(0.00,2,'.','');} ?></td>
<td id="otHrsWork<?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 } else{?>style="text-align:right;"<?php }?> ><?php if(!empty($record->OT_Hrs_Worked)){echo $record->OT_Hrs_Worked;}else { echo number_format(0.00,2,'.','');} ?></td>
<td id="dayWork<?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 } else{?>style="text-align:right;" <?php }?>>
<?php if(!empty($record->Days_worked)){echo $record->Days_worked+$record->sunday_count;}else{echo "0.00";}?>
</td>
<td id="lopDay<?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 } else{?>style="text-align:right;" <?php }?>>
<?php if(!empty($record->LOP_Days)){echo $record->LOP_Days;}else{echo "0.00";}?>
</td>
<td id="paidLeave<?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 } else{?>style="text-align:right;" <?php }?>>
<?php if(!empty($record->Paid_leave)){echo number_format($record->Paid_leave,2,'.','');}else { echo number_format(0.00,2,'.','');} ?>
</td>
<td id="otHrsWork<?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 } else{?>style="text-align:right;" <?php }?>>
<?php if(!empty($record->OT_Hrs_Worked)){echo $record->OT_Hrs_Worked;}else { echo number_format(0.00,2,'.','');} ?>
</td>
<td style="max-width:80px"><?php echo $record->TotalSalary; ?></td>
<td style="max-width:80px"><?php $perDaySalary = $record->TotalSalary / $record->NoofDays; echo number_format($perDaySalary, 2); ?></td>
<td style="max-width:80px"><?php $workedSalary = $perDaySalary * ($record->Days_worked+$record->sunday_count); echo number_format($workedSalary, 2); ?></td>
<td style="max-width:80px"><?php $perHrSalary = $perDaySalary / 8; echo number_format($perHrSalary, 2); ?></td>
<td style="max-width:80px">
<?php $perDaySalary = $record->TotalSalary / $record->NoofDays; echo number_format($perDaySalary, 2); ?>
</td>
<td style="max-width:80px">
<?php $workedSalary = $perDaySalary * ($record->Days_worked+$record->sunday_count); echo number_format($workedSalary, 2); ?>
</td>
<td style="max-width:80px">
<?php $perHrSalary = $perDaySalary / 8; echo number_format($perHrSalary, 2); ?>
</td>
<td style="max-width:80px"><?php echo number_format($workedSalary, 2); ?></td>
<td style="max-width:80px"><?php $basicWorked = $workedSalary * 70 / 100; echo number_format($basicWorked, 2); ?></td>
<td style="max-width:80px"><?php $hraWorked = $workedSalary * 30 / 100; echo number_format($hraWorked, 2); ?></td>
<td style="max-width:80px"><?php echo number_format($basicWorked+$hraWorked, 2); ?></td>
<td style="max-width:80px">
<?php $basicWorked = $workedSalary * 70 / 100; echo number_format($basicWorked, 2); ?>
</td>
<td style="max-width:80px">
<?php $hraWorked = $workedSalary * 30 / 100; echo number_format($hraWorked, 2); ?>
</td>
<td style="max-width:80px">
<?php echo number_format($basicWorked+$hraWorked, 2); ?></td>
<td style="max-width:80px"> <?php echo $esi[$i]; ?> </td>
<td style="max-width:80px"> <?php echo $pf[$i]; ?> </td>
<td style="max-width:80px"> <?php echo $over_time[$i]; ?> </td>
@ -260,25 +296,38 @@ $('html').bind('keypress', function(e)
<td id="monthDue<?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 } else{?>style="text-align:right;"<?php }?> ><?php if(!empty($record->Monthly_Due)){echo $record->Monthly_Due; $totalmonthloan []=$record->Monthly_Due;}else { echo number_format(0.00,2,'.','');} ?></td>
<td id="monthDue<?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 } else{?>style="text-align:right;" <?php }?>>
<?php if(!empty($record->Monthly_Due)){echo $record->Monthly_Due; $totalmonthloan []=$record->Monthly_Due;}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 }?> >
<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,'.',''); $totalmanualoan[] = $record->Loan_Recovered;}else {echo $record->Loan_Recovered; $totalmanualoan[] = $record->Loan_Recovered;}}else{echo number_format(0.00,2,'.',''); $totalmanualoan[] = 0;} ?>
{ if(is_numeric($record->Loan_Recovered)){echo number_format($record->Loan_Recovered,2,'.',''); $totalmanualoan[] = $record->Loan_Recovered;}else {echo $record->Loan_Recovered; $totalmanualoan[] = $record->Loan_Recovered;}}else{echo number_format(0.00,2,'.',''); $totalmanualoan[] = 0;} ?>
</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 }?> >
<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; $totalinst [] = $record->MonthlyIncentives;}else {echo $record->MasterIncentives; $totalinst [] = $record->MasterIncentives;}
@ -291,14 +340,31 @@ $('html').bind('keypress', function(e)
<?php ?>
<!-- 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;$totalotherDet [] = $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>
<?php $totalotherDet [] = isset($Other_Deductions) ? $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>
<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 [] = isset($Festival_Bonus) ? $Festival_Bonus : [];?>
<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 }?>>
<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 {
@ -316,20 +382,30 @@ $('html').bind('keypress', function(e)
<!--<input type="hidden" id = "eid" value="<?php echo $record->EmpID?>">
<input type="hidden" id = "inv" value="<?php echo $record->Incentives?>">
<input type="hidden" id = "pdi" value="<?php echo $record->Pay_Data_ID?>"> -->
<input type="hidden" id = "bPay<?php echo $index?>" value="<?php echo $record->Basic_Pay?>">
<input type="hidden" id = "hraRate<?php echo $index?>" value="<?php echo $record->HRA_Rate?>">
<input type="hidden" id = "allow<?php echo $index?>" value="<?php echo $record->Allowances?>">
<input type="hidden" id = "fAllow<?php echo $index?>" value="<?php echo $record->Food_Allowances?>">
<input type="hidden" id = "pfRate<?php echo $index?>" value="<?php echo $record->PF_Rate?>">
<input type="hidden" id = "eslRate<?php echo $index?>" value="<?php echo $record->ESI_Rate?>">
<input type="hidden" id = "hraAmt<?php echo $index?>" value="<?php echo $record->HRA_Amount?>">
<input type="hidden" id="bPay<?php echo $index?>"
value="<?php echo $record->Basic_Pay?>">
<input type="hidden" id="hraRate<?php echo $index?>"
value="<?php echo $record->HRA_Rate?>">
<input type="hidden" id="allow<?php echo $index?>"
value="<?php echo $record->Allowances?>">
<input type="hidden" id="fAllow<?php echo $index?>"
value="<?php echo $record->Food_Allowances?>">
<input type="hidden" id="pfRate<?php echo $index?>"
value="<?php echo $record->PF_Rate?>">
<input type="hidden" id="eslRate<?php echo $index?>"
value="<?php echo $record->ESI_Rate?>">
<input type="hidden" id="hraAmt<?php echo $index?>"
value="<?php echo $record->HRA_Amount?>">
<input type="hidden" id = "loanamt<?php echo $index?>" value="<?php echo isset($record->Loan_amount) ? $record->Loan_amount : 0?>">
<input type="hidden" id = "paidamt<?php echo $index?>" value="<?php echo $record->Paid_Amount?>">
<input type="hidden" id="loanamt<?php echo $index?>"
value="<?php echo isset($record->Loan_amount) ? $record->Loan_amount : 0?>">
<input type="hidden" id="paidamt<?php echo $index?>"
value="<?php echo $record->Paid_Amount?>">
<input type="hidden" id = "duedate<?php echo $index?>" value="<?php echo $record->DueDate?>">
<input type="hidden" id="duedate<?php echo $index?>"
value="<?php echo $record->DueDate?>">
<!-- <input type="hidden" id = "eid" value="<?php echo $record->TotalSalary?>">
<!--<input type="hidden" id = "eid" value="<?php echo $record->TotalSalary?>">
<input type="hidden" id = "eid" value="<?php echo $record->LOP_Days?>">
<input type="hidden" id = "eid" value="<?php echo $record->Paid_leave?>">
<input type="hidden" id = "eid" value="<?php echo $record->OT_Hrs_Worked?>">
@ -350,16 +426,22 @@ $('html').bind('keypress', function(e)
?>
</tbody>
<tfoot><tr>
<tfoot>
<tr>
<th colspan="5"></th>
<th>Total</th>
<th id="manualoan"><?php echo isset($totalmonthloan) ? array_sum($totalmonthloan) : '';?></th>
<th id="monthloan"><?php echo isset($totalmonthloan) ? array_sum($totalmanualoan) : '' ;?></th>
<th id="manualoan">
<?php echo isset($totalmonthloan) ? array_sum($totalmonthloan) : '';?></th>
<th id="monthloan">
<?php echo isset($totalmonthloan) ? array_sum($totalmanualoan) : '' ;?>
</th>
<th id="inst"><?php echo isset($totalins) ? array_sum($totalinst) : '' ;?></th>
<th id="other"><?php echo isset($totalotherDet) ? array_sum($totalotherDet): '' ;?></th>
<th id="fest"><?php echo isset($totalfestival) ? array_sum($totalfestival): '' ;?></th>
<th id="other">
<?php echo isset($totalotherDet) ? array_sum($totalotherDet): '' ;?></th>
<th id="fest">
<?php echo isset($totalfestival) ? array_sum($totalfestival): '' ;?></th>
<th id="estsal"><?php echo isset($estTotal) ? array_sum($estTotal): '' ;?></th>
</tr>
@ -369,7 +451,8 @@ $('html').bind('keypress', function(e)
<p>&nbsp;</p>
<div class="row">
<div class="col-md-3" id="savebutton">
<input type="button" id="submit" value = "Save" class="btn btn-success" onclick="getAllData();">
<input type="button" id="submit" value="Save" class="btn btn-success"
onclick="getAllData();">
</div>
</div>
</div><!-- /.box-body -->
@ -380,52 +463,52 @@ $('html').bind('keypress', function(e)
</div>
</div>
</section>
</div>
<script type="text/javascript" src="<?php echo base_url(); ?>public/assets/js/common.js" charset="utf-8"></script>
<script type="text/javascript">
var estTotal = [];
var totalinst = [];
var totalotherDet =[];
var totalmonthloan =[];
var totalmanualoan =[];
</div>
<script type="text/javascript" src="<?php echo base_url(); ?>public/assets/js/common.js" charset="utf-8"></script>
<script type="text/javascript">
var estTotal = [];
var totalinst = [];
var totalotherDet = [];
var totalmonthloan = [];
var totalmanualoan = [];
$(function () {
$(function() {
var i = 0;
$('tr.lastvalue').each(function(){
i = i+1;
estTotal [i]=$(this).find('td').eq(11).text();
$('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();
$('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();
$('tr.lastvalue').each(function() {
i = i + 1;
totalotherDet[i] = $(this).find('td').eq(9).text();
});
var i = 0;
$('tr.lastvalue').each(function(){
i = i+1;
totalmanualoan [i]=$(this).find('td').eq(6).text();
$('tr.lastvalue').each(function() {
i = i + 1;
totalmanualoan[i] = $(this).find('td').eq(6).text();
});
//console.log(totalmanualoan);
//console.log(totalmanualoan);
var i = 0;
$('tr.lastvalue').each(function(){
i = i+1;
totalmonthloan[i]=$(this).find('td').eq(7).text();
$('tr.lastvalue').each(function() {
i = i + 1;
totalmonthloan[i] = $(this).find('td').eq(7).text();
});
//console.log(totalmonthloan);
//console.log(totalmonthloan);
/* $('#monthlylisting').DataTable({
"paging": true,
"lengthChange": true,
@ -448,12 +531,12 @@ $('html').bind('keypress', function(e)
// show_hide_column(11,key);
var t = $('#monthlylistings').DataTable( {
"columnDefs": [ {
var t = $('#monthlylistings').DataTable({
"columnDefs": [{
"searchable": false,
"orderable": false,
"targets": 0
} ],
}],
"searching": true,
"lengthChange": true,
"info": true,
@ -461,59 +544,67 @@ $('html').bind('keypress', function(e)
"autoWidth": true,
// "scrollX": true,
"order": [[ 1, 'asc' ]],
} );
"order": [
[1, 'asc']
],
});
t.on( 'order.dt search.dt', function () {
t.column(0, {search:'applied', order:'applied'}).nodes().each( function (cell, i) {
cell.innerHTML = i+1;
} );
} ).draw();
t.on('order.dt search.dt', function() {
t.column(0, {
search: 'applied',
order: 'applied'
}).nodes().each(function(cell, i) {
cell.innerHTML = i + 1;
});
}).draw();
var s = "<?php echo $drop; ?>";
$('#monthyear').val(s);
savebuttonvalidation();
});
});
function isNumber(evt) {
function isNumber(evt) {
//alert("hi");
var iKeyCode = (evt.which) ? evt.which : evt.keyCode
if (iKeyCode != 46 && iKeyCode > 31 && (iKeyCode < 48 || iKeyCode > 57))
{ return false;}
return true;
if (iKeyCode != 46 && iKeyCode > 31 && (iKeyCode < 48 || iKeyCode > 57)) {
return false;
}
function isCheckKeyCode(event){
return true;
}
function isCheckKeyCode(event) {
var iKeyCode = (event.which) ? event.which : event.keyCode
if (iKeyCode != 46 && iKeyCode > 31 && (iKeyCode < 48 || iKeyCode > 57 ) && (iKeyCode ==78 && iKeyCode == 65))
{ return false;}
if (iKeyCode != 46 && iKeyCode > 31 && (iKeyCode < 48 || iKeyCode > 57) && (iKeyCode == 78 && iKeyCode == 65)) {
return false;
}
return true;
}
function getAllData()
{
function getAllData() {
var alldata = $("#monthlylistings").tableToJSON();
//alert(JSON.stringify(alldata));
alldata=JSON.stringify(alldata)
alldata = JSON.stringify(alldata)
var month = $('#monthyear').val();
$('.content').loader('show');
$.ajax({
data:{param1:alldata,param2:month},
data: {
param1: alldata,
param2: month
},
//dataType:"json",
type:"POST",
url:"<?php echo base_url() ?>payslip/saveMonthlyData",
success:function(data) {
if(data)
{
type: "POST",
url: "<?php echo base_url() ?>payslip/saveMonthlyData",
success: function(data) {
if (data) {
$('.content').loader('hide');
alert(data);
//console.log(data);
@ -523,10 +614,10 @@ function isCheckKeyCode(event){
}
});
}
}
$("#monthyear").change(function(){
$("#monthyear").change(function() {
$s = $('#monthyear').val();
//echo $dropdownvalue;
@ -540,9 +631,9 @@ function isCheckKeyCode(event){
$('#formid').submit();
});
function savebuttonvalidation()
{
});
function savebuttonvalidation() {
var curselection = $("#monthyear").val();
//alert('current selection'+curselection);
var currentdate = new Date();
@ -555,123 +646,100 @@ function isCheckKeyCode(event){
var selyear = res[1];
//alert('current selec month '+ selmonth + 'current selec year '+ selyear);
var savebuttonstatus = currentmonth - selmonth;
var year = currentyear - selyear ;
var year = currentyear - selyear;
//alert(selyear + currentyear);
if(savebuttonstatus >= 2)
{
if(year == 1)
{
if (savebuttonstatus >= 2) {
if (year == 1) {
$("#savebutton").hide();
// $("#savebutton").show();
}
else
{
} else {
$("#savebutton").hide();
//$("#savebutton").show();
}
}
else if(savebuttonstatus < 0 )
{
} else if (savebuttonstatus < 0) {
if(year == 1)
{
if (year == 1) {
$("#savebutton").show();
}
else if(year == 0)
{
} else if (year == 0) {
$("#savebutton").hide();
// $("#savebutton").show();
} else {
$("#savebutton").hide();
// $("#savebutton").show();
}
else
{
} else if (savebuttonstatus == 0 && year == 0) {
$("#savebutton").hide();
// $("#savebutton").show();
}
}
else if(savebuttonstatus == 0 && year == 0)
{
$("#savebutton").hide();
// $("#savebutton").show();
}
else if(savebuttonstatus == 1)
{
if(year == 0 || year == 1)
{
} else if (savebuttonstatus == 1) {
if (year == 0 || year == 1) {
$("#savebutton").show();
}
else
{
} else {
$("#savebutton").show();
}
}
}
}
var totalfestival =[];
var totalempSal=[];
var grandtotal = [];
function changeInput(event,k)
{
var totalfestival = [];
var totalempSal = [];
var grandtotal = [];
function changeInput(event, k) {
var str=event.target.id;
var str = event.target.id;
var sno = str.substr(8);
var dayWorks=parseFloat(document.getElementById('dayWork'+sno).textContent);
var lopDay=parseFloat(document.getElementById('lopDay'+sno).textContent);
var paidLeave =parseFloat(document.getElementById('paidLeave'+sno).textContent);
var otHrsWork =parseFloat(document.getElementById('otHrsWork'+sno).textContent);
var monthDue =parseFloat(document.getElementById('monthDue'+sno).textContent);
var duedate = document.getElementById('duedate'+sno).value;
var dayWorks = parseFloat(document.getElementById('dayWork' + sno).textContent);
var lopDay = parseFloat(document.getElementById('lopDay' + sno).textContent);
var paidLeave = parseFloat(document.getElementById('paidLeave' + sno).textContent);
var otHrsWork = parseFloat(document.getElementById('otHrsWork' + sno).textContent);
var monthDue = parseFloat(document.getElementById('monthDue' + sno).textContent);
var duedate = document.getElementById('duedate' + sno).value;
duedate = new Date(duedate);
var paydate = document.getElementById('paydate').value;
if(paydate.length == 6)
{
paydate = '0'+paydate;
if (paydate.length == 6) {
paydate = '0' + paydate;
}
var pmonthonly = paydate.substring(0,2);
var pmonthonly = paydate.substring(0, 2);
var pyearonly = paydate.substring(3);
var pday = new Date(pyearonly, pmonthonly, 0).getDate();
var finalpaydate = pyearonly+'-'+pmonthonly+'-'+pday;
var finalpaydate = pyearonly + '-' + pmonthonly + '-' + pday;
finalpaydate = new Date(finalpaydate);
var loanRecd=document.getElementById('loanRecd'+sno).textContent;
var loanRecd = document.getElementById('loanRecd' + sno).textContent;
console.log(loanRecd);
totalmanualoan[sno] = loanRecd;
console.log(totalmanualoan);
var incentie = parseFloat(document.getElementById('incentie' + sno).textContent);
//totalmanualoan[sno]=loanRecd;
var incentie=parseFloat(document.getElementById('incentie'+sno).textContent);
var otherDet = parseFloat(document.getElementById('otherDet' + sno).textContent);
totalotherDet[sno] = otherDet;
var Festival = parseFloat(document.getElementById('Festival' + sno).textContent);
totalfestival[sno] = Festival;
var empsal = parseFloat(document.getElementById('empsal' + sno).textContent);
var bpay = parseFloat(document.getElementById('bPay' + sno).value);
var otherDet =parseFloat(document.getElementById('otherDet'+sno).textContent);
//totalotherDet[sno] = otherDet;
var Festival =parseFloat(document.getElementById('Festival'+sno).textContent);
totalfestival[sno]= Festival ;
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 pfRate =parseFloat(document.getElementById('pfRate'+sno).value);
var eslRate =parseFloat(document.getElementById('eslRate'+sno).value);
var hraAmt =parseFloat(document.getElementById('hraAmt'+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 pfRate = parseFloat(document.getElementById('pfRate' + sno).value);
var eslRate = parseFloat(document.getElementById('eslRate' + sno).value);
var hraAmt = parseFloat(document.getElementById('hraAmt' + sno).value);
// var Balance_Amount =parseFloat(document.getElementById('Balance'+sno).value);
var loanamt =parseFloat(document.getElementById('loanamt'+sno).value);
var paidamt =parseFloat(document.getElementById('paidamt'+sno).value);
var loanamt = parseFloat(document.getElementById('loanamt' + sno).value);
var paidamt = parseFloat(document.getElementById('paidamt' + sno).value);
@ -680,9 +748,9 @@ totalfestival[sno]= Festival ;
var dayWorkPaid=dayWorks+paidLeave;
var dayWorkPaid = dayWorks + paidLeave;
// console.log("day"+dayWorkPaid);
var NoofDays=dayWorks+paidLeave +lopDay;
var NoofDays = dayWorks + paidLeave + lopDay;
// console.log("monthday"+NoofDays);
var Food_Allowances = fAllow * dayWorks;
// console.log("workedFA"+Food_Allowances);
@ -693,14 +761,11 @@ totalfestival[sno]= Festival ;
// console.log("1dayHRA"+dayHra);
var onehoursSalary = (daySalary + dayHra) / 8;
//console.log("onehours "+onehoursSalary);
var totSalayOT =0;
var totSalayOT = 0;
if (otHrsWork!= 0)
{
if (otHrsWork != 0) {
totSalayOT = otHrsWork * onehoursSalary;
}
else
{
} else {
totSalayOT = 0;
}
//console.log(totSalayOT);
@ -713,36 +778,28 @@ totalfestival[sno]= Festival ;
var current_loan_amt = 0;
var autoLoan =parseFloat(monthDue);
var autoLoan = parseFloat(monthDue);
console.log(monthDue);
var manualLoan =parseFloat(loanRecd);
var manualLoan = parseFloat(loanRecd);
// var manualLoan = Math.min.apply(null, arrayOfNumbers.filter(function(loanRecd) { return !isNaN(loanRecd); }))
//alert(manualLoan);
if(manualLoan == 0.00){
if(duedate <= finalpaydate)
{
if (manualLoan == 0.00) {
if (duedate <= finalpaydate) {
current_loan_amt = autoLoan;
}
//alert('}0.00');
}
else if(isNaN(manualLoan))
{
} else if (isNaN(manualLoan)) {
//alert('N');
current_loan_amt = 0.00;
}
else if(manualLoan == 'NA')
{
} else if (manualLoan == 'NA') {
//alert('NA');
current_loan_amt = 0.00;
}
else if(manualLoan >= 0.00)
{
if(duedate <= finalpaydate)
{
} else if (manualLoan >= 0.00) {
if (duedate <= finalpaydate) {
current_loan_amt = manualLoan;
}
//alert('manual');
@ -752,10 +809,9 @@ totalfestival[sno]= Festival ;
var Balance_Amount = loanamt - paidamt;
if(autoLoan > Balance_Amount) {
if (autoLoan > Balance_Amount) {
if(duedate <= finalpaydate)
{
if (duedate <= finalpaydate) {
current_loan_amt = Balance_Amount;
}
@ -766,22 +822,22 @@ totalfestival[sno]= Festival ;
// console.log(current_loan_amt);
if(parseFloat(incentie) == parseFloat(incentie)){
if (parseFloat(incentie) == parseFloat(incentie)) {
var incent =parseFloat(incentie);
var incent = parseFloat(incentie);
//console.log("Incentives"+incent);
}
if(parseFloat(Festival) == parseFloat(Festival)){
if (parseFloat(Festival) == parseFloat(Festival)) {
var Festivals =parseFloat(Festival);
var Festivals = parseFloat(Festival);
//console.log("Festivals"+Festivals);
}
if(parseFloat( otherDet) == parseFloat( otherDet)){
if (parseFloat(otherDet) == parseFloat(otherDet)) {
var otherDets =parseFloat( otherDet);
var otherDets = parseFloat(otherDet);
//console.log("otherDets"+ otherDets);
}
@ -790,25 +846,22 @@ totalfestival[sno]= Festival ;
// console.log("pf "+currentDatePF);
// var totalsalary= empsal + hraAmt;
var totalsalary =currentDaySalary+currentDayHra;
var totalsalary = currentDaySalary + currentDayHra;
// console.log("total"+totalsalary);
var esiAmount=0;
var esiAmount = 0;
if (totalsalary <= 20000)
{
if (totalsalary <= 20000) {
esiAmount = currentDatePF * eslRate / 100;
/** esiamount not elgiable for 20000 **/
}
else
{
} else {
esiAmount = 0;
}
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 empSalarySub = current_loan_amt + esiAmount + pfAmount + otherDets;
@ -820,13 +873,13 @@ totalfestival[sno]= Festival ;
//console.log( employeeSalary);
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){
$.each(estTotal, function(i, value) {
if (sno == i) {
estTotal[i] = cals;
@ -834,8 +887,8 @@ totalfestival[sno]= Festival ;
});
//console.log(estTotal);
$.each(totalinst,function(i,value){
if(sno==i){
$.each(totalinst, function(i, value) {
if (sno == i) {
totalinst[i] = incentie;
@ -843,16 +896,16 @@ totalfestival[sno]= Festival ;
});
$.each(totalotherDet,function(i,value){
if(sno==i){
$.each(totalotherDet, function(i, value) {
if (sno == i) {
totalotherDet[i] = otherDet;
}
});
$.each(totalmonthloan,function(i,value){
if(sno==i){
$.each(totalmonthloan, function(i, value) {
if (sno == i) {
totalmonthloan[i] = loanRecd;
@ -860,17 +913,17 @@ totalfestival[sno]= Festival ;
});
$.each(totalmanualoan,function(i,value){
if(sno==i){
$.each(totalmanualoan, function(i, value) {
if (sno == i) {
totalmanualoan[i] = monthDue;
console.log( totalmanualoan[i]);
}
});
//console.log(totalinst);
calculategrandtotal();
@ -878,12 +931,12 @@ totalfestival[sno]= Festival ;
}
var tempTotal = [];
function calculategrandtotal(){
$.each(totalinst, function( index, value )
{
function calculategrandtotal() {
$.each(totalinst, function(index, value) {
//var res2 = value.split('-');
tempTotal[index]=parseFloat(value);
tempTotal[index] = parseFloat(value);
});
var sum = 0;
@ -894,10 +947,9 @@ function calculategrandtotal(){
$('#inst').text(parseFloat(sum).toFixed(2));
$.each(totalotherDet, function( index, value )
{
$.each(totalotherDet, function(index, value) {
//var res2 = value.split('-');
tempTotal[index]=parseFloat(value);
tempTotal[index] = parseFloat(value);
});
var sum = 0;
@ -907,10 +959,9 @@ function calculategrandtotal(){
}
$('#other').text(parseFloat(sum).toFixed(2));
$.each(totalfestival, function( index, value )
{
$.each(totalfestival, function(index, value) {
//var res2 = value.split('-');
tempTotal[index]=parseFloat(value);
tempTotal[index] = parseFloat(value);
});
var sum = 0;
@ -922,10 +973,9 @@ function calculategrandtotal(){
$.each(estTotal, function( index, value )
{
$.each(estTotal, function(index, value) {
//var res2 = value.split('-');
tempTotal[index]=parseFloat(value);
tempTotal[index] = parseFloat(value);
});
var sum = 0;
@ -938,10 +988,8 @@ function calculategrandtotal(){
$.each(totalmonthloan, function( index, value )
{
//var res2 = value.split('-');
tempTotal[index]=parseFloat(value);
$.each(totalmonthloan, function(index, value) {
tempTotal[index] = parseFloat(value);
});
var sum = 0;
@ -951,11 +999,10 @@ function calculategrandtotal(){
}
$('#monthloan').text(parseFloat(sum).toFixed(2));
console.log(totalmanualoan);
$.each(totalmanualoan, function( index, value )
{
$.each(totalmanualoan, function(index, value) {
//var res2 = value.split('-');
tempTotal[index]=parseFloat(value);
tempTotal[index] = parseFloat(value);
});
var sum = 0;
@ -967,7 +1014,7 @@ function calculategrandtotal(){
}
function show_hide_column(col_no, do_show) {
function show_hide_column(col_no, do_show) {
var rows = document.getElementById('monthlylistings').rows;
for (var row = 0; row < rows.length; row++) {
@ -977,5 +1024,4 @@ function calculategrandtotal(){
}
}
}
</script>
</script>