610 lines
24 KiB
PHP
Executable File
610 lines
24 KiB
PHP
Executable File
<script>
|
||
$(document).ready(function(){
|
||
|
||
|
||
$("#loan_issued_date").datepicker({
|
||
minDate : 'now',
|
||
// maxDate : 'now',
|
||
dateFormat: 'dd-mm-yy',changeMonth: true, changeYear: true,yearRange: '-100:+0'
|
||
});
|
||
|
||
$("#due_started").datepicker({
|
||
minDate :'now',
|
||
//maxDate : 'now',
|
||
dateFormat: 'dd-mm-yy',changeMonth: true, changeYear: true,yearRange: '-100:+1'
|
||
});
|
||
});
|
||
|
||
|
||
|
||
// window.onload = function(){
|
||
// loanReset();
|
||
// function loanReset(){
|
||
// //alert("hi");
|
||
// var loan=$("#Loan_Amount").val();//document.getElementById('Loan_Amount').value;
|
||
// var paid=$("#Paid_Amount").val();//document.getElementById('Paid_Amount').value;
|
||
// if(loan !=0){
|
||
// if (loan == paid)
|
||
// {
|
||
// //alert("loan reset");
|
||
// $("#Loan_Amount").val(0.00);
|
||
// $("#Paid_Amount").val(0.00);
|
||
// $("#monthly_due").val(0.00);
|
||
// $("#no_of_due").val(0);
|
||
// $("#remaining_due").val(0);
|
||
// $("#paid_due").val(0);
|
||
// $("#loan_issued_date").val("");
|
||
// $("#due_started").val("");
|
||
|
||
// }else
|
||
// {
|
||
// //alert("loan pending");
|
||
// }
|
||
// }
|
||
// }
|
||
// };
|
||
</script>
|
||
|
||
<?php
|
||
|
||
|
||
$Pay_Data_ID='';
|
||
$EmpID='';
|
||
$Empname="";
|
||
$Basic_Pay='';
|
||
$HRA_Rate='';
|
||
|
||
$Allowances='';
|
||
$PF_Rate='';
|
||
$ESI_Rate='';
|
||
$is_Active='';
|
||
$Food_Allowances='';
|
||
$Incentives='';
|
||
$Created_By='';
|
||
$Created_Time='';
|
||
$Last_Mod_By='';
|
||
$Last_Mod_Time='';
|
||
$HRA_Amount=0.0;
|
||
$TotalSalary=0.0;
|
||
$Loan_Amount='';
|
||
$Loan_issued_date='';
|
||
$Monthly_due='';
|
||
$Due_start_date='';
|
||
$No_of_dues='';
|
||
$Remaining_Due='';
|
||
$Paid_Due='';
|
||
$Paid_Amount=0;
|
||
$loanid='';
|
||
|
||
|
||
if(!empty($emppay))
|
||
{
|
||
// print_r($emppay);
|
||
// die();
|
||
foreach ($emppay as $ep)
|
||
{
|
||
|
||
|
||
|
||
$Pay_Data_ID=$ep->Pay_Data_ID;
|
||
$EmpID=$ep->PAYEMPID;
|
||
$Empname=$ep->FirstName ." ". $ep->LastName ;
|
||
$TotalSalary=$ep->TotalSalary;
|
||
$Basic_Pay=$ep->Basic_Pay;
|
||
$HRA_Rate=$ep->HRA_Rate;
|
||
$HRA_Amount=$ep->HRA_Amount;
|
||
|
||
$Allowances=$ep->Allowances;
|
||
$PF_Rate=$ep->PF_Rate;
|
||
$ESI_Rate=$ep->ESI_Rate;
|
||
$is_Active=$ep->is_Active;
|
||
$Food_Allowances=$ep->Food_Allowances;
|
||
$Incentives=$ep->Incentives;
|
||
$Loan_Amount=$ep->Loan_Amount;
|
||
if(empty($Loan_Amount)){$Loan_Amount = 0.00;}
|
||
if( !empty($ep->Loan_Issued_Date) ){
|
||
$Loan_issued_date=new DateTime( $ep->Loan_Issued_Date, new DateTimeZone('Asia/Kolkata'));
|
||
$Loan_issued_date=$Loan_issued_date->format('d-m-Y');}
|
||
else{$Loan_issued_date=null;}
|
||
|
||
$Monthly_due=$ep->Monthly_Due;
|
||
if(empty($Monthly_due)){$Monthly_due = 0.00;}
|
||
if(!empty($ep->Due_Start_Date)){
|
||
$Due_start_date=new DateTime( $ep->Due_Start_Date, new DateTimeZone('Asia/Kolkata'));
|
||
$Due_start_date=$Due_start_date->format('d-m-Y');}
|
||
else{$Due_start_date=null;}
|
||
$No_of_dues=$ep->No_of_Dues;
|
||
if(empty($No_of_dues)){$No_of_dues = 0.00;}
|
||
$Paid_Due=$ep->Paid_Due;
|
||
if(empty($Paid_Due)){$Paid_Due = 0.00;}
|
||
$Remaining_Due=$ep->Remaining_Due;
|
||
if(empty($Remaining_Due)){$Remaining_Due = 0.00;}
|
||
$Paid_Amount=$ep->Paid_Amount;
|
||
if(empty($Paid_Amount)){$Paid_Amount = 0.00;}
|
||
$Created_By=$ep->Created_By;
|
||
$Created_Time=$ep->Created_Time;
|
||
$Last_Mod_By=$ep->Last_Mod_By;
|
||
$Last_Mod_Time=$ep->Last_Mod_Time;
|
||
$loanid = $ep->Loan_ID;
|
||
|
||
|
||
}
|
||
}
|
||
|
||
|
||
?>
|
||
|
||
<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 Salary Payment Details</center>
|
||
|
||
</h1>
|
||
</section>
|
||
|
||
<section class="content">
|
||
<div style="text-align:right;">
|
||
<a href="<?php echo base_url() ?>emppayListings" 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="edit" action="<?php echo base_url() ?>emppaydate/editemppay" method="post">
|
||
<div class="box-body">
|
||
<div class="col-md-12">
|
||
<legend>Pay Details</legend>
|
||
</div>
|
||
<div class="row">
|
||
|
||
|
||
|
||
|
||
<input type="hidden" readonly id="Pay_Data_ID" name="Pay_Data_ID" value="<?php echo $Pay_Data_ID; ?>">
|
||
<div class="col-md-3">
|
||
<div class="form-group">
|
||
<div class="form-group">
|
||
<span for="EmpID">Employee ID</span>
|
||
<input type="text" class="form-control" readonly id="EmployeeID" name="EmpID" value="<?php echo $EmpID; ?>">
|
||
</div>
|
||
</div>
|
||
</div>
|
||
|
||
<div class="col-md-3">
|
||
<div class="form-group">
|
||
<div class="form-group">
|
||
<span for ="Employee">Employee Name</span>
|
||
<input type="text" class="form-control" id="Empname" name="Empname" value="<?php echo $Empname; ?>" readonly>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
|
||
<div class="col-md-3">
|
||
<div class="form-group">
|
||
<div class="form-group">
|
||
<span for="Basic_Pay">Total Salary</span><font color="Red">*</font>
|
||
<input type="text" class="form-control requried num" id="Total_Salary" name="Total_Salary" value="<?php echo number_format($TotalSalary,0,'',''); ?>" pattern="([0-9]{1,8}([.][0-9]{1,2})?)" title="Minimum 4 digit,Maximum 6 Digit" onchange="calculateBasic();">
|
||
</div>
|
||
</div>
|
||
</div>
|
||
<div class="col-md-3">
|
||
<div class="form-group">
|
||
<div class="form-group">
|
||
<span for="Basic_Pay">Basic Pay</span><font color="Red">*</font>
|
||
<input type="text" class="form-control requried num" id="Basic_Pay" name="Basic_Pay" value="<?php echo $Basic_Pay; ?>" readonly>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
|
||
|
||
<div class="row">
|
||
<div class="col-md-3">
|
||
<div class="form-group">
|
||
<div class="form-group">
|
||
<span for="HRA_Rate">HRA_Rate(%)</span><font color="Red">*</font>
|
||
<input type="text" class="form-control required num" id="HRA_Rate" name="HRA_Rate" value="<?php echo $HRA_Rate; ?>" pattern="([0-9]{1,2}([.][0-9]{1,2})?)" title="Minimum 1 digit,Maximum 2 Digit" onchange="calculateBasic();">
|
||
</div>
|
||
</div>
|
||
</div>
|
||
<div class="col-md-3">
|
||
<div class="form-group">
|
||
<div class="form-group">
|
||
<span for="HRA_Rate">HRA_Amount</span><font color="Red">*</font>
|
||
<input type="text" class="form-control required num" id="HRA_Amount" name="HRA_Amount" value="<?php echo number_format($HRA_Amount,0,'',''); ?>" readonly>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
|
||
|
||
<div class="col-md-3">
|
||
<div class="form-group">
|
||
<div class="form-group">
|
||
<span for="Allowances">Allowances</span><font color="Red">*</font>
|
||
<input type="text" class="form-control required num" id="Allowances" name="Allowances" value="<?php echo $Allowances; ?>" pattern="([0-9]{1,5}([.][0-9]{1,2})?)" title="Minimum 1 digit,Maximum 4 Digit">
|
||
</div>
|
||
</div>
|
||
</div>
|
||
<div class="col-md-3">
|
||
<div class="form-group">
|
||
<div class="form-group">
|
||
<span for="PF_Rate">PF_Rate(%)</span><font color="Red">*</font>
|
||
<input type="text" class="form-control required num" id="PF_Rate" name="PF_Rate" value="<?php echo $PF_Rate; ?>" 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-3">
|
||
<div class="form-group">
|
||
<div class="form-group">
|
||
<span for="ESI_Rate">ESI_Rate(%)</span><font color="Red">*</font>
|
||
<input type="text" class="form-control required num" id="ESI_Rate" name="ESI_Rate" value="<?php echo $ESI_Rate; ?>" pattern="([0-9]{1,2}([.][0-9]{1,2})?)" title="Minimum 1 digit,Maximum 2 Digit">
|
||
</div>
|
||
</div>
|
||
</div>
|
||
|
||
<div class="col-md-3">
|
||
<div class="form-group">
|
||
<div class="form-group">
|
||
<span for ="Food_Allowances">Food Allowances(Per Day)</span><font color="Red">*</font>
|
||
<input type="text" class="form-control required num" id="Food_Allowances" name="Food_Allowances" value="<?php echo $Food_Allowances; ?>" pattern="([0-9]{1,3}([.][0-9]{1,2})?)" title="Minimum 1 digit,Maximum 3 Digit">
|
||
</div>
|
||
</div>
|
||
</div>
|
||
|
||
|
||
<div class="col-md-3">
|
||
<div class="form-group">
|
||
<div class="form-group">
|
||
<span for="Incentives">Incentives</span><font color="Red">*</font>
|
||
<input type="text" class="form-control required num" id="Incentives" name="Incentives" value="<?php echo ($Incentives) ?>" pattern="([0-9]{1,5}([.][0-9]{1,2})?)" title="Minimum 1 digit,Maximum 5 Digit">
|
||
</div>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
|
||
<div class="col-md-12">
|
||
<legend>Loan Details</legend>
|
||
</div>
|
||
|
||
<div class="row">
|
||
|
||
<div class="col-md-3">
|
||
<div class="form-group">
|
||
<div class="form-group">
|
||
|
||
<input type="hidden" name="loanid" value="<?php echo $loanid;?>">
|
||
<span for="Pay_Data_ID">Loan Amount</span>
|
||
<input type="text" class="form-control num" id="Loan_Amount" name="Loan_Amount" value="<?php echo $Loan_Amount; ?>" pattern="([0-9]{1,7}([.][0-9]{1,2})?)" title="Minimum 4 digit,Maximum 6 Digit" onchange="duecalculation();">
|
||
</div>
|
||
</div>
|
||
</div>
|
||
|
||
|
||
|
||
|
||
<div class="col-md-3">
|
||
<div class="form-group">
|
||
<div class="form-group">
|
||
<span for="EmpID">Loan Issue(d) Date</span>
|
||
<input type="text" class="form-control num" id="loan_issued_date" name="loan_issued_date" value="<?php echo $Loan_issued_date;?>" onchange="dateCalulation();">
|
||
</div>
|
||
</div>
|
||
</div>
|
||
|
||
|
||
<div class="col-md-3">
|
||
<div class="form-group">
|
||
<div class="form-group">
|
||
<span for="Basic_Pay">Monthly Due</span>
|
||
<input type="text" class="form-control requried num" id="monthly_due" name="monthly_due" value="<?php echo $Monthly_due; ?>" pattern="([0-9]{1,7}([.][0-9]{1,2})?)" title="Minimum 4 digit,Maximum 6 Digit" onchange="duecalculation();">
|
||
</div>
|
||
</div>
|
||
</div>
|
||
<div class="col-md-3">
|
||
<div class="form-group">
|
||
<div class="form-group">
|
||
<span for="Basic_Pay">Due Started</span>
|
||
<input type="text" class="form-control requried num" id="due_started" name="due_started" value="<?php echo $Due_start_date; ?>" onchange="dateCalulation();">
|
||
</div>
|
||
</div>
|
||
</div>
|
||
<div class="col-md-3">
|
||
<div class="form-group">
|
||
<div class="form-group">
|
||
<span for="Basic_Pay">No Of Due(s)</span>
|
||
<input type="text" class="form-control requried num" id="no_of_due" name="no_of_due" value="<?php echo $No_of_dues; ?>" pattern="[0-9]{1,2}" title="Minimum 1 digit,Maximum 2 Digit" readonly>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
|
||
<div class="col-md-3">
|
||
<div class="form-group">
|
||
<div class="form-group">
|
||
<span for="Basic_Pay">Paid Amount</span>
|
||
<input type="text" class="form-control requried num" id="Paid_Amount" name="Paid_Amount" value="<?php echo $Paid_Amount; ?>" pattern="([0-9]{1,7}([.][0-9]{1,2})?)" title="Minimum 1 digit,Maximum 2 Digit" readonly>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
<input type="hidden" id="remaining_due" name="remaining_due" value="<?php echo $Remaining_Due;?>">
|
||
<input type="hidden" id="paid_due" name="paid_due" value="<?php echo $Paid_Due;?>">
|
||
</div>
|
||
|
||
|
||
|
||
|
||
|
||
<div class="row">
|
||
<div class="col-md-6">
|
||
<div class="form-group">
|
||
<div class="form-group">
|
||
<!--<span for ="CreatedBy">Created By:</span>-->
|
||
<input type="hidden" class="form-control required" id="CreatedBy" name="CreatedBy" value="<?php echo $Created_By; ?>">
|
||
</div>
|
||
</div>
|
||
</div>
|
||
|
||
|
||
<div class="col-md-6">
|
||
<div class="form-group">
|
||
<div class="form-group">
|
||
<!--<span for ="Created_Time">Created Time:</span>-->
|
||
<input type="hidden" class="form-control required" id="Created_Time" name="Created_Time" value="<?php echo $Created_Time; ?>">
|
||
</div>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
|
||
|
||
<div class="row">
|
||
<div class="col-md-6">
|
||
<div class="form-group">
|
||
<div class="form-group">
|
||
<!--<span for ="Last_Mod_By">Last Modified By:</span>-->
|
||
<input type="hidden" class="form-control required" id="LastModifiedBy" name="LastModifiedBy" value="<?php echo $name; ?>">
|
||
</div>
|
||
</div>
|
||
</div>
|
||
|
||
|
||
<div class="col-md-6">
|
||
<div class="form-group">
|
||
<div class="form-group">
|
||
<!--<span for ="Last_Mod_Time">Last Modified Time:</span>-->
|
||
<input type="hidden" class="form-control required" id="Last_Modified_Time" name="Last_Modified_Time" value="<?php echo $Last_Mod_Time; ?>">
|
||
</div>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
|
||
|
||
|
||
|
||
|
||
</div><!--row completed div-->
|
||
|
||
<div id="content">
|
||
<div class="box-footer" style="text-align:right">
|
||
<input type="submit" class="btn btn-primary" value="Submit" onmouseover="finalCheck();"/>
|
||
<input type="button" class="btn btn-primary" value="Delete" id="deleteemp"/>
|
||
<input type="reset" class="btn btn-primary" value="Reset" />
|
||
</div>
|
||
|
||
</div>
|
||
|
||
|
||
|
||
</div>
|
||
</div>
|
||
</div>
|
||
|
||
|
||
|
||
|
||
|
||
</div>
|
||
|
||
</form>
|
||
|
||
<div class="col-md-4">
|
||
<?php
|
||
$this->load->helper('form');
|
||
$error = $this->session->flashdata('error');
|
||
if($error)
|
||
{
|
||
?>
|
||
<div class="alert alert-danger alert-dismissable">
|
||
<button type="button" class="close" data-dismiss="alert" aria-hidden="true"><3E></button>
|
||
<?php echo $this->session->flashdata('error'); ?>
|
||
</div>
|
||
<?php } ?>
|
||
<?php
|
||
$success = $this->session->flashdata('success');
|
||
if($success)
|
||
{
|
||
?>
|
||
<div class="alert alert-success alert-dismissable">
|
||
<button type="button" class="close" data-dismiss="alert" aria-hidden="true"><3E></button>
|
||
<?php echo $this->session->flashdata('success'); ?>
|
||
</div>
|
||
<?php } ?>
|
||
|
||
<div class="row">
|
||
<div class="col-md-12">
|
||
<?php echo validation_errors('<div class="alert alert-danger alert-dismissable">', ' <button type="button" class="close" data-dismiss="alert" aria-hidden="true"><3E></button></div>'); ?>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
|
||
</section>
|
||
</div>
|
||
|
||
|
||
<script>
|
||
function calculateBasic()
|
||
|
||
{
|
||
var Totalsalary = document.getElementById('Total_Salary').value;;
|
||
var HRA=document.getElementById('HRA_Rate').value;
|
||
if(HRA==''){
|
||
alert("Please Enter HRA RATE..");
|
||
document.getElementById('HRA_Rate').focus();
|
||
}else if(Totalsalary==''){
|
||
alert("Please Enter Total Salary..");
|
||
document.getElementById('Total_Salary').focus();
|
||
}
|
||
else{
|
||
var temp=(Totalsalary*(HRA/100));
|
||
var basic=Totalsalary-temp;
|
||
document.getElementById('Basic_Pay').value=basic;
|
||
document.getElementById('HRA_Amount').value=temp;
|
||
}
|
||
//alert(basic);
|
||
|
||
|
||
}
|
||
|
||
|
||
|
||
function duecalculation()
|
||
{
|
||
var totaldue=0;
|
||
var loan=document.getElementById('Loan_Amount').value;
|
||
var due=document.getElementById('monthly_due').value;
|
||
|
||
if(loan != 0)
|
||
{
|
||
if(due == 0)
|
||
{
|
||
alert("Enter Monthly Due Amount....!");
|
||
$('#monthly_due').focus();
|
||
}
|
||
else
|
||
{
|
||
|
||
totaldue=loan/due;
|
||
|
||
if(totaldue < 1)
|
||
{
|
||
alert("Please Enter Correct Due Amount..!");
|
||
$('#monthly_due').focus();
|
||
}
|
||
else{
|
||
document.getElementById('no_of_due').value=Math.ceil(totaldue);
|
||
var noofdues=document.getElementById('no_of_due').value;
|
||
$('#remaining_due').val(noofdues);
|
||
$('#Paid_Amount').val("0.00");
|
||
$('#paid_due').val(0);
|
||
}
|
||
|
||
}
|
||
}//else if(loan == "" || loan == 0)
|
||
//alert(totaldue);
|
||
|
||
dateCalulation();
|
||
|
||
|
||
}
|
||
|
||
function dateCalulation()
|
||
{
|
||
//alert('j');
|
||
var loanamount=document.getElementById('Loan_Amount').value;
|
||
if(loanamount == 0.00 || loanamount == "")
|
||
{
|
||
$('#loan_issued_date').val("");
|
||
$('#due_started').val("");
|
||
$('#monthly_due').val("0.00");
|
||
$('#remaining_due').val(0);
|
||
$('#no_of_due').val(0);
|
||
$('#Loan_Amount').val("0.00");
|
||
$('#paid_due').val(0);
|
||
$('#Paid_Amount').val("0.00");
|
||
|
||
|
||
}
|
||
|
||
}
|
||
|
||
function finalCheck()
|
||
{
|
||
//alert("final check");
|
||
|
||
|
||
|
||
var loanamount=document.getElementById('Loan_Amount').value;
|
||
if(loanamount != "" && loanamount != 0.00)
|
||
{
|
||
var idate=document.getElementById('loan_issued_date').value;
|
||
var due=document.getElementById('monthly_due').value;
|
||
var dsdate=document.getElementById('due_started').value;
|
||
if(idate == "" || due == "" || due == 0.00 || dsdate == ""){
|
||
alert("Enter All Loan Information Correctly...!");
|
||
return false;
|
||
}
|
||
}
|
||
|
||
if($('#Total_Salary').val() == '' || $('#HRA_Rate').val() == '' || $('#Allowances').val() == '' ||$('#PF_Rate').val() == '' ||$('#ESI_Rate').val() == '' || $('#Food_Allowances').val() == ''|| $('#Incentives').val()=='')
|
||
{
|
||
|
||
alert("Please Enter All Information Correctly..!");
|
||
return false;
|
||
}
|
||
}
|
||
|
||
$("#deleteemp").click(function(){
|
||
var empid = "<?php echo $EmpID;?>";
|
||
var i = confirm("Do You want to delete "+empid+" from Pay Master?");
|
||
//alert(i);s
|
||
if(i)
|
||
{
|
||
$('#content').loader('show');
|
||
|
||
$.ajax({
|
||
data:{id:empid},
|
||
|
||
type:"POST",
|
||
url:"<?php echo base_url();?>emppaydate/deleteEmpPay",
|
||
success:function(result) {
|
||
if(result)
|
||
{
|
||
|
||
alert(result);
|
||
$('#content').loader('hide');
|
||
window.location.href = "<?php echo base_url();?>emppayListings";
|
||
|
||
}
|
||
|
||
}
|
||
});
|
||
}
|
||
|
||
});
|
||
</script>
|
||
<script>
|
||
</script>
|