siddharth_application/application/views/editPayslip.php
2018-01-19 13:04:01 +05:30

880 lines
36 KiB
PHP
Executable File

<?php
$Key = '';
$PayOn='';
$EmpID='';
$Empname="";
$Basic_Pay='';
$HRA_Rate='';
$TotalCalDays = '';
$NoofDaysWorked = '';
$LOP = '';
$Paid_Leave = '';
$ActualSalary ='';
$PerDaySalary = '';
$WorkedSalary = '';
$HRA = '';
$OTperHours = '';
$OTSalary = '';
$ESIGrossSalary = '';
$EmployeeESI = '';
$PF = '';
$CompanyESI = '';
$CompanyPF = '';
$TotalCompCon = '';
$OtherDeductions = '';
$TotalDeduction = '';
$SalaryAsPerPF = '';
$FoodAllowance='';
$Incentive = '';
$FestBonus = '';
$Advance = '';
$BalanceAdvance = '';
$LessAdvance = '';
$Other_allowances = '';
$Remarks = '';
$BankAccountNumber = '';
$PFNumber = '';
$ESINumber = '';
$UANNO = '';
$Dob = '';
$Pan = '';
$BankName = '';
$AadharNo = '';
$IFSCCode = '';
$DOJ = '';
$Designation = '';
$DeptName = '';
$totalearnings ='';
$totaldeductions = '';
$monthsoptions = array("01" => "Jan", "02" => "Feb","03" => "Mar","04" => "Apr","05" => "May","06" => "June","07"=> "July","08"=> "Aug","09" => "Sep","10"=> "Oct","11" => "Nov","12"=>"Dec");
if(!empty($PayInfo))
{
foreach ($PayInfo as $ep)
{
$Key = $ep->Key;
$PayOn1=$ep->PayOn;
$month = substr($PayOn1,0,2);
$year = substr($PayOn1,3);
$PayOn = $monthsoptions[$month]."-".$year;
$EmpID=$ep->EmpID;
$Empname=$ep->FName ." ". $ep->Lname ;
$EmpDetails = $EmpID ."-".$Empname;
$TotalCalDays = $ep->TotalCalDays;
$NoofDaysWorked = $ep->NoofDaysWorked;
$LOP = $ep->LOP;
$Paid_Leave = $ep->Paid_Leave;
$ActualSalary = $ep->ActualSalary;
$PerDaySalary = $ep->PerDaySalary;
$WorkedSalary = $ep->WorkedSalary;
$HRA = $ep->HRA;
$OTperHours = $ep->OTperHours;
$OTSalary = $ep->OTSalary;
$ESIGrossSalary = $ep->ESIGrossSalary;
$EmployeeESI = $ep->EmployeeESI;
$PF = $ep->PF;
$CompanyESI = $ep->CompanyESI;
$CompanyPF = $ep->CompanyPF;
$TotalCompCon = $ep->TotalCompCon;
$OtherDeductions = $ep->OtherDeductions;
$TotalDeduction = $ep->TotalDeduction;
$SalaryAsPerPF = $ep->SalaryAsPerPF;
$FoodAllowance=$ep->FoodAllowance;
$Incentive = $ep->Incentive;
$FestBonus = $ep->Festival_Bonus;
$Advance = $ep->Advance;
$BalanceAdvance = $ep->BalanceAdvance;
$LessAdvance = $ep->LessAdvance;
$Other_allowances = $ep->Other_allowances;
$Remarks = $ep->Remarks;
$BankAccountNumber = $ep->BankAccountNumber;
$PFNumber = $ep->PFNumber;
$ESINumber = $ep->ESINumber;
$UANNO = $ep->UANNO;
$Dob = date_create($ep->Dob);
$Dob = date_format($Dob,"Y-m-d");
$Pan = $ep->Pan;
$BankName = $ep->BankName;
$AadharNo = $ep->AadharNo;
$IFSCCode = $ep->IFSCCode;
$DOJ = date_create($ep->DOJ);
$DOJ = date_format($DOJ,"Y-m-d");
$Designation = $ep->Designation;
$DeptName = $ep->DeptName;
$totalearnings = $WorkedSalary + $HRA + $FoodAllowance + $Other_allowances + $Incentive + $FestBonus + $OTSalary;
$totaldeductions = $PF + $EmployeeESI + $Advance + $OtherDeductions;
}
}
?>
<style type="text/css">
.num {
text-align:right;
}
</style>
<div class="content-wrapper">
<!-- Content Header (Page header) -->
<section class="content-header">
<h1>
<!--title-->
<center>Edit Payslip Details - <?php echo $PayOn ."-".$EmpID . "-" .$Empname; ?> </center>
</h1>
</section>
<section class="content">
<div style="text-align:right;">
<a href="<?php echo base_url() ?>PaysilpListing" class="btn btn-primary" value="Back">Back</a>
</div>
<br/>
<div class="row">
<!-- left column -->
<div class="col-md-12">
<!-- general form elements -->
<div class="box box-primary">
<!-- form start-->
<form role="form" id="editpayslip" action="<?php echo base_url() ?>payslip/updatePayslip" method="post">
<div class="box-body">
<div class="col-md-12">
<legend>Pay Details</legend>
</div>
<div class="row">
<input type="hidden" readonly id="Key" name="Key" value="<?php echo $Key; ?>">
<div class="col-md-2">
<div class="form-group">
<div class="form-group">
<span for="EmpID">PayOn</span>
<input type="hidden" name="PayOn" value="<?php echo $PayOn1; ?>">
<input type="hidden" name="EmpID" value="<?php echo $EmpID; ?>">
<input type="text" class="form-control" readonly id="PayOn" name="PayOn1" value="<?php echo $PayOn; ?>">
</div>
</div>
</div>
<div class="col-md-2">
<div class="form-group">
<div class="form-group">
<span for="EmpID">Employee ID</span>
<input type="text" class="form-control" readonly id="Emp" name="Emp" value="<?php echo $EmpDetails; ?>">
</div>
</div>
</div>
<div class="col-md-2">
<div class="form-group">
<div class="form-group">
<span for="Basic_Pay">Designation & Dept</span>
<input type="text" class="form-control requried num" id="Designation" name="Designation" value="<?php echo $Designation ." - ". $DeptName ; ?>" readonly>
</div>
</div>
</div>
<div class="col-md-2">
<div class="form-group">
<div class="form-group">
<span for="PF_Rate">Total Calendar Days</span>
<input type="text" class="form-control required num" id="totoaldays" name="totoaldays" value="<?php echo $TotalCalDays;?>" readonly> <!-- pattern="([0-9]{1,2}([.][0-9]{1,2})?)" title="Minimum 1 digit,Maximum 2 Digit">-->
</div>
</div>
</div>
<div class="col-md-2">
<div class="form-group">
<div class="form-group">
<span for="PF_Rate">Loss Of Pay</span>
<input type="text" class="form-control required num" id="LOP" name="LOP" value="<?php echo $LOP;?>" readonly> <!-- pattern="([0-9]{1,2}([.][0-9]{1,2})?)" title="Minimum 1 digit,Maximum 2 Digit">-->
</div>
</div>
</div>
<div class="col-md-2">
<div class="form-group">
<div class="form-group">
<span for="PF_Rate">Paid Days</span>
<input type="text" class="form-control required num" id="Paiddays" name="Paiddays" value="<?php echo $NoofDaysWorked;?>" readonly> <!-- pattern="([0-9]{1,2}([.][0-9]{1,2})?)" title="Minimum 1 digit,Maximum 2 Digit"> -->
</div>
</div>
</div>
</div>
<div class="row">
<div class="col-md-2">
<div class="form-group">
<div class="form-group">
<span for="PF_Rate">Paid Leave</span>
<input type="text" class="form-control required num" id="paidleave" name="paidleave" value="<?php echo $Paid_Leave;?>" readonly><!-- pattern="([0-9]{1,2}([.][0-9]{1,2})?)" title="Minimum 1 digit,Maximum 2 Digit"> -->
</div>
</div>
</div>
<div class="col-md-2">
<div class="form-group">
<div class="form-group">
<span for="PF_Rate">Loan Balance</span>
<input type="text" class="form-control required num" id="loanbal" name="loanbal" value="<?php echo $BalanceAdvance;?>" readonly> <!-- pattern="([0-9]{1,2}([.][0-9]{1,2})?)" title="Minimum 1 digit,Maximum 2 Digit"> -->
</div>
</div>
</div>
<div class="col-md-2">
<div class="form-group">
<div class="form-group">
<span for="ESI_Rate">OT Hrs Worked</span>
<input type="text" class="form-control required num" id="othrs" name="othrs" value="<?php echo $OTperHours; ?>" readonly> <!-- pattern="([0-9]{1,2}([.][0-9]{1,2})?)" title="Minimum 1 digit,Maximum 2 Digit"> -->
</div>
</div>
</div>
<div class="col-md-2">
<div class="form-group">
<div class="form-group">
<span for="ESI_Rate">Bank Name</span>
<input type="text" class="form-control required num" id="bankname" name="bankname" value="<?php echo $BankName; ?>" readonly> <!-- pattern="([0-9]{1,2}([.][0-9]{1,2})?)" title="Minimum 1 digit,Maximum 2 Digit">-->
</div>
</div>
</div>
<div class="col-md-2">
<div class="form-group">
<div class="form-group">
<span for="ESI_Rate">Account No</span>
<input type="text" class="form-control required num" id="acno" name="acno" value="<?php echo $BankAccountNumber; ?>" readonly><!--pattern="([0-9]{1,2}([.][0-9]{1,2})?)" title="Minimum 1 digit,Maximum 2 Digit">-->
</div>
</div>
</div>
<div class="col-md-2">
<div class="form-group">
<div class="form-group">
<span for="ESI_Rate">IFSC Code</span>
<input type="text" class="form-control required num" id="ifsc" name="ifsc" value="<?php echo $IFSCCode; ?>" readonly><!--pattern="([0-9]{1,2}([.][0-9]{1,2})?)" title="Minimum 1 digit,Maximum 2 Digit">-->
</div>
</div>
</div>
</div>
<div class="row">
<div class="col-md-2">
<div class="form-group">
<div class="form-group">
<span for="ESI_Rate">PAN</span>
<input type="text" class="form-control required num" id="pan" name="pan" value="<?php $Pan; ?>" readonly><!-- pattern="([0-9]{1,2}([.][0-9]{1,2})?)" title="Minimum 1 digit,Maximum 2 Digit">-->
</div>
</div>
</div>
<div class="col-md-2">
<div class="form-group">
<div class="form-group">
<span for ="Food_Allowances">PF Number</span>
<input type="text" class="form-control required num" id="pf" name="pf" value="<?php echo $PFNumber; ?>" readonly><!--pattern="([0-9]{1,3}([.][0-9]{1,2})?)" title="Minimum 1 digit,Maximum 3 Digit"> -->
</div>
</div>
</div>
<div class="col-md-2">
<div class="form-group">
<div class="form-group">
<span for ="Food_Allowances">ESI Number</span>
<input type="text" class="form-control required num" id="esi" name="esi" value="<?php echo $ESINumber; ?>" readonly><!-- pattern="([0-9]{1,3}([.][0-9]{1,2})?)" title="Minimum 1 digit,Maximum 3 Digit"> -->
</div>
</div>
</div>
<div class="col-md-2">
<div class="form-group">
<div class="form-group">
<span for ="Food_Allowances">Aadhar No</span>
<input type="text" class="form-control required num" id="aadhar" name="aadhar" value="<?php echo $AadharNo; ?>"readonly><!-- pattern="([0-9]{1,3}([.][0-9]{1,2})?)" title="Minimum 1 digit,Maximum 3 Digit"> -->
</div>
</div>
</div>
</div>
<div class="col-md-12">
<legend>Total Earnings&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Total Deductions</legend>
</div>
<div class="row">
<div class="col-md-3">
<div class="form-group">
<div class="form-group">
<center><label style="display:block;text-align:right;"><h4>Basic Plus DA</h4></label></center>
</div>
</div>
</div>
<div class="col-md-3">
<div class="form-group">
<div class="form-group">
<input type="text" class="form-control num" id="txtbasicda" name="txtbasicda" value="<?php echo $WorkedSalary;?>" onchange="calculateSalary();" readonly>
</div>
</div>
</div>
<div class="col-md-3">
<div class="form-group">
<div class="form-group">
<center><label style="display:block;text-align:right;"><h4>Provident Fund</h4></label></center>
</div>
</div>
</div>
<div class="col-md-3">
<div class="form-group">
<div class="form-group">
<input type="text" class="form-control requried num" id="txtpf" name="txtpf" value="<?php echo $PF;?>" onchange="calculateSalary();" readonly>
</div>
</div>
</div>
</div>
<div class="row">
<div class="col-md-3">
<div class="form-group">
<div class="form-group">
<center><label style="display:block;text-align:right;"><h4>House Rent Allowance</h4></label></center>
</div>
</div>
</div>
<div class="col-md-3">
<div class="form-group">
<div class="form-group">
<input type="text" class="form-control num" id="txthra" name="txthra" value="<?php echo $HRA;?>" onchange="calculateSalary();" readonly>
</div>
</div>
</div>
<div class="col-md-3">
<div class="form-group">
<div class="form-group">
<center><label style="display:block;text-align:right;"><h4>Employee State Insurance</h4></label></center>
</div>
</div>
</div>
<div class="col-md-3">
<div class="form-group">
<div class="form-group">
<input type="text" class="form-control requried num" id="txtesi" name="txtesi" value="<?php echo $EmployeeESI; ?>" onchange="calculateSalary();" readonly>
</div>
</div>
</div>
</div>
<div class="row">
<div class="col-md-3">
<div class="form-group">
<div class="form-group">
<center><label style="display:block;text-align:right;"><h4>Food Allowance</h4></label></center>
</div>
</div>
</div>
<div class="col-md-3">
<div class="form-group">
<div class="form-group">
<input type="text" class="form-control num" id="txtfood" name="txtfood" value="<?php echo $FoodAllowance?>" onchange="calculateSalary();" readonly>
</div>
</div>
</div>
<div class="col-md-3">
<div class="form-group">
<div class="form-group">
<center><label style="display:block;text-align:right;"><h4>Loan Recovery</h4></label></center>
</div>
</div>
</div>
<div class="col-md-3">
<div class="form-group">
<div class="form-group">
<input type="text" class="form-control requried num" id="txtloandue" name="txtloandue" value="<?php echo $Advance;?>" onchange="calculateSalary();" readonly>
</div>
</div>
</div>
</div>
<div class="row">
<div class="col-md-3">
<div class="form-group">
<div class="form-group">
<center><label style="display:block;text-align:right;"><h4>Other Allowance</h4></label></center>
</div>
</div>
</div>
<div class="col-md-3">
<div class="form-group">
<div class="form-group">
<input type="text" class="form-control num" id="otherallowence" name="otherallowence" value="<?php echo $Other_allowances;?>" onchange="calculateSalary();" readonly>
</div>
</div>
</div>
<div class="col-md-3">
<div class="form-group">
<div class="form-group">
<center><label style="display:block;text-align:right;"><h4>Other Deductions</h4></label></center>
</div>
</div>
</div>
<div class="col-md-3">
<div class="form-group">
<div class="form-group">
<input type="text" class="form-control requried num" id="otherdeductions" name="otherdeductions" value="<?php echo $OtherDeductions; ?>" onchange="calculateSalary();" >
</div>
</div>
</div>
</div>
<div class="row">
<div class="col-md-3">
<div class="form-group">
<div class="form-group">
<center><label style="display:block;text-align:right;"><h4>Incentive</h4></label></center>
</div>
</div>
</div>
<div class="col-md-3">
<div class="form-group">
<div class="form-group">
<input type="text" class="form-control num" id="incentive" name="incentive" value="<?php echo $Incentive;?>" onchange="calculateSalary();" >
</div>
</div>
</div>
<div class="col-md-3">
</div>
</div>
<div class="col-md-3">
</div>
</div>
<div class="row">
<div class="col-md-3">
<div class="form-group">
<div class="form-group">
<center><label style="display:block;text-align:right;"><h4>Festival Bonus</h4></label></center>
</div>
</div>
</div>
<div class="col-md-3">
<div class="form-group">
<div class="form-group">
<input type="text" class="form-control num" id="festival" name="festival" value="<?php echo $FestBonus;?>" onchange="calculateSalary();" readonly>
</div>
</div>
</div>
<div class="col-md-3">
</div>
<div class="col-md-3">
</div>
</div>
<div class="row">
<div class="col-md-3">
<div class="form-group">
<div class="form-group">
<center><label style="display:block;text-align:right;"><h4>OT Salary</h4></label></center>
</div>
</div>
</div>
<div class="col-md-3">
<div class="form-group">
<div class="form-group">
<input type="text" class="form-control num" id="otsalary" name="otsalary" value="<?php echo $OTSalary;?>" onchange="calculateSalary();" readonly>
</div>
</div>
</div>
<div class="col-md-3">
</div>
<div class="col-md-3">
</div>
</div>
<legend></legend>
<div class="row">
<div class="col-md-3">
<div class="form-group">
<div class="form-group">
<center><label style="display:block;text-align:right;"><h4>Total Earnings</h4></label></center>
</div>
</div>
</div>
<div class="col-md-3">
<div class="form-group">
<div class="form-group">
<input type="text" class="form-control num" id="totalearnings" name="totalearnings" value="<?php echo number_format(round($totalearnings),2,'.','');?>" readonly>
</div>
</div>
</div>
<div class="col-md-3">
<div class="form-group">
<div class="form-group">
<center><label style="display:block;text-align:right;"><h4>Total Deductions</h4></label></center>
</div>
</div>
</div>
<div class="col-md-3">
<div class="form-group">
<div class="form-group">
<input type="text" class="form-control requried num" id="totaldeductions" name="totaldeductions" value="<?php echo number_format(round($totaldeductions),2,'.','');?>" readonly>
</div>
</div>
</div>
</div>
<legend></legend>
<div class="row">
<div class="col-md-3">
</div>
<div class="col-md-3">
</div>
<div class="col-md-3">
<div class="form-group">
<div class="form-group">
<center><label><h4>Net Pay(Rounded)</h4></label></center>
</div>
</div>
</div>
<div class="col-md-3">
<div class="form-group">
<div class="form-group">
<input type="text" class="form-control requried num" id="netpay" name="netpay" value="<?php echo number_format(round($LessAdvance),2,'.',''); ?>" readonly>
</div>
</div>
</div>
</div>
<div class="row">
<div class="col-md-3">
</div>
<div class="col-md-3">
</div>
<div class="col-md-3">
<div class="form-group">
<div class="form-group">
<center><label><h4>Company Contribution</h4></label></center>
</div>
</div>
</div>
<div class="col-md-3">
<div class="form-group">
<div class="form-group">
<input type="text" class="form-control requried num" id="companycon" name="companycon" value="<?php echo number_format(round($TotalCompCon),2,'.','');?>" readonly>
</div>
</div>
</div>
</div>
<legend></legend>
<div id="content">
<div class="box-footer" style="text-align:right">
<input type="button" id ="save" class="btn btn-primary" value="Submit" />
<input type="reset" class="btn btn-primary" value="Reset" />
</div>
</div>
</div>
</div>
</div>
</div>
</form>
<script>
function calculateSalary()
{
var otherallowence = 0.00;
var otherdeductions = 0.00;
var incentive = 0.00;
var festival =0.00;
var txtbasicda = 0.00;
var txtpf = 0.00;
var txthra = 0.00;
var txtesi = 0.00;
var txtfood = 0.00;
var txtloandue =0.00;
var otherallowence = 0.00;
var otherdeductions = 0.00;
var incentive =0.00;
var otsalary = 0.00;
var totalearnings = 0.00;
var totaldeductions = 0.00;
var netpay = 0.00;
var res = isNaN($('#otherallowence').val());
var res1 = isNaN($('#otherdeductions').val());
var res2 = isNaN($('#incentive').val());
if(res || res1 || res2)
{
alert("Enter a Number");
return false;
}else
{
otherallowence = parseFloat($('#otherallowence').val());
otherdeductions = parseFloat($('#otherdeductions').val());
incentive = parseFloat($('#incentive').val());
festival = parseFloat($('#festival').val());
txtbasicda = parseFloat($('#txtbasicda').val());
txtpf = parseFloat($('#txtpf').val());
txthra = parseFloat($('#txthra').val());
txtesi = parseFloat($('#txtesi').val());
txtfood = parseFloat($('#txtfood').val());
txtloandue = parseFloat($('#txtloandue').val());
otherallowence = parseFloat($('#otherallowence').val());
otherdeductions = parseFloat($('#otherdeductions').val());
incentive = parseFloat($('#incentive').val());
otsalary = parseFloat($('#otsalary').val());
totalearnings = parseFloat($('#totalearnings').val());
totaldeductions = parseFloat($('#totaldeductions').val());
netpay = parseFloat($('#netpay').val());
totalearnings = parseFloat(txtbasicda + txthra + txtfood + otherallowence + incentive + festival + otsalary,2);
totaldeductions = parseFloat(otherdeductions + txtpf + txtesi + txtloandue,2);
netpay = totalearnings - totaldeductions;
$('#totalearnings').val((Math.round(totalearnings)).toFixed(2));
$('#totaldeductions').val((Math.round(totaldeductions)).toFixed(2));
$('#netpay').val((Math.round(netpay)).toFixed(2));
return true;
}
}
$("#save").click(function(){
if(calculateSalary())
{
$.ajax({
data:$("#editpayslip").serialize(),
type:"POST",
url:"<?php echo base_url();?>payslip/updatePayslip",
success:function(result) {
if(result)
{
var i =result;
if(i == "1")
{
alert("sucessfully Updated..!");
}
else
{
alert("Something went wrong. Try later..!");
}
window.location.href = "<?php echo base_url();?>PaysilpListing";
}
}
});
}
});
</script>