PAYROLL CHANGES

This commit is contained in:
velz2020 2017-10-06 12:35:59 +05:30
parent bc22319baf
commit 41d197cd6f
3 changed files with 110 additions and 53 deletions

View File

@ -192,17 +192,32 @@ function phpAlert($msg) {
$month = $this->input->post('param2');
$jsondata =$this->input->post('param1');
$json = json_decode($jsondata,true);
$mon='';
$year='';
$mon = substr($month,0,1);
$year = substr($month,2);
if($mon <10)
if(strlen($month) == 7)
{
$mon = '0'.$mon;
//echo "SEVEN";
$mon = substr($month,0,2);
$year = substr($month,3);
}
else
{
//echo "NOT SEVEN";
$mon = substr($month,0,1);
$year = substr($month,2);
if((int)$mon < 10)
{
$mon = '0'.$mon;
}
}
$month = $mon ."-". $year;
//echo $month;
//echo $month;die();
$total = 0;
$ErrorEmpId = '';
$TotalErrorFlag = 0;
@ -231,6 +246,8 @@ function phpAlert($msg) {
}
$OT_Hrs_Worked_first = explode(".",$OT_Hrs_Worked);
if(!is_numeric($OT_Hrs_Worked) || (strlen((string)$OT_Hrs_Worked))>6 || (strlen((string)$OT_Hrs_Worked_first[0])) >= 4)// || (strlen((string)$OT_Hrs_Worked_first[1]))> 3 )
{
@ -238,12 +255,26 @@ function phpAlert($msg) {
$ErrorFlag++;
}
if(is_numeric($Loan_Recovered)){
$Loan_Recovered_first = explode(".",$Loan_Recovered);
if(!is_numeric($Loan_Recovered) || (strlen((string)$Loan_Recovered))>8 || (strlen((string)$Loan_Recovered_first[0]))> 5)
if((strlen((string)$Loan_Recovered))>8 || (strlen((string)$Loan_Recovered_first[0]))> 5)
{
//echo $EmpID . "-Loan Recoverd Invalid Data!";
$ErrorFlag++;
}
}
else if(is_string($Loan_Recovered))
{
//echo "STRING";
if(strcasecmp($Loan_Recovered,'NA'))
{
//echo "NOT NA";
$ErrorFlag++;
}
}
$Incentives_first = explode(".",$Incentives);
if(!is_numeric($Incentives) || (strlen((string)$Incentives))>8 || (strlen((string)$Incentives_first[0]))> 5)
@ -252,6 +283,7 @@ function phpAlert($msg) {
$ErrorFlag++;
}
$Other_Deductions_first = explode(".",$Other_Deductions);
if(!is_numeric($Other_Deductions) || (strlen((string)$Other_Deductions))>8 || (strlen((string)$Other_Deductions_first[0]))> 5)
{
@ -287,6 +319,10 @@ function phpAlert($msg) {
$Paid_leave = $j['Paid Leave'];
$OT_Hrs_Worked = $j['OT Hours Worked in Hrs'];
$Loan_Recovered = $j['Loan Recovered in ₹'];
if(is_string($Loan_Recovered))
{
$Loan_Recovered = strtoupper($Loan_Recovered);
}
$Incentives = $j['Incentives in ₹'];
$Other_Deductions = $j['Other Deductions in ₹'];
$Created_By = $this->session->userdata ( 'userId' );
@ -657,11 +693,15 @@ function getEmployee()
$EmpId = $sheet->getCell('A'.$x)->getValue();
$EmpId=strtoupper($EmpId);
$LOPDays = $sheet->getCell('C'.$x)->getValue();
$OTHoursWorked =$sheet->getCell('D'.$x)->getValue();
$loanRecovered=$sheet->getCell('E'.$x)->getValue();
//$loanBalance=$sheet->getCell('E'.$x)->getValue();
$Incentive =$sheet->getCell('F'.$x)->getValue();
$Other_Deductions =$sheet->getCell('G'.$x)->getValue();
$Paid_leave =$sheet->getCell('D'.$x)->getValue();
$OTHoursWorked =$sheet->getCell('E'.$x)->getValue();
$loanRecovered=$sheet->getCell('F'.$x)->getValue();
if(is_string($loanRecovered))
{
$loanRecovered = strtoupper($loanRecovered);
}
$Incentive =$sheet->getCell('G'.$x)->getValue();
$Other_Deductions =$sheet->getCell('H'.$x)->getValue();
if( $EmpId != '')
{
@ -671,7 +711,7 @@ function getEmployee()
if($flag!=0 && $flag2!=0){
$FileData = array('Month_Year'=>$PayOn,'EmpID'=>$EmpId,'LOP_Days'=>$LOPDays,'OT_Hrs_Worked'=>$OTHoursWorked,'Loan_Recovered'=>$loanRecovered,'Incentives'=>$Incentive,'Other_Deductions'=>$Other_Deductions,'Created_By'=>$createdby,'Created_Time'=>date("Y-m-d h:i:sa"));
$FileData = array('Month_Year'=>$PayOn,'EmpID'=>$EmpId,'LOP_Days'=>$LOPDays,'Paid_leave'=>$Paid_leave,'OT_Hrs_Worked'=>$OTHoursWorked,'Loan_Recovered'=>$loanRecovered,'Incentives'=>$Incentive,'Other_Deductions'=>$Other_Deductions,'Created_By'=>$createdby,'Created_Time'=>date("Y-m-d h:i:sa"));
$result = $this->payroll_model->UploadFileData2($FileData);
$success++;
}

View File

@ -53,7 +53,7 @@ if (loan == paid)
$Empname="";
$Basic_Pay='';
$HRA_Rate='';
$OT_Rate='';
$Allowances='';
$PF_Rate='';
$ESI_Rate='';
@ -90,7 +90,7 @@ if(!empty($emppay))
$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;
@ -159,17 +159,7 @@ if(!empty($emppay))
</div>
<div class="row">
<!-- <div class="col-md-4">
<div class="form-group">
<div class="form-group">
<span for="Pay_Data_ID">Pay Data ID</span>
<input type="text" class="form-control" readonly id="Pay_Data_ID" name="Pay_Data_ID" value="<?php echo $Pay_Data_ID; ?>">
</div>
</div>
</div> -->
<input type="hidden" readonly id="Pay_Data_ID" name="Pay_Data_ID" value="<?php echo $Pay_Data_ID; ?>">
@ -227,14 +217,7 @@ if(!empty($emppay))
</div>
</div>
</div>
<div class="col-md-3">
<div class="form-group">
<div class="form-group">
<span for="OT_Rate">OT_Rate(Per Hour)</span><font color="Red">*</font>
<input type="text" class="form-control required num" id="OT_Rate" name="OT_Rate" value="<?php echo $OT_Rate; ?>" 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">
@ -244,6 +227,14 @@ if(!empty($emppay))
</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>
@ -256,14 +247,7 @@ if(!empty($emppay))
<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 class="col-md-3">
<div class="form-group">
<div class="form-group">
@ -406,6 +390,7 @@ if(!empty($emppay))
<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>
@ -433,7 +418,7 @@ if(!empty($emppay))
{
?>
<div class="alert alert-danger alert-dismissable">
<button type="button" class="close" data-dismiss="alert" aria-hidden="true"><EFBFBD></button>
<button type="button" class="close" data-dismiss="alert" aria-hidden="true">×</button>
<?php echo $this->session->flashdata('error'); ?>
</div>
<?php } ?>
@ -443,14 +428,14 @@ if(!empty($emppay))
{
?>
<div class="alert alert-success alert-dismissable">
<button type="button" class="close" data-dismiss="alert" aria-hidden="true"><EFBFBD></button>
<button type="button" class="close" data-dismiss="alert" aria-hidden="true">×</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"><EFBFBD></button></div>'); ?>
<?php echo validation_errors('<div class="alert alert-danger alert-dismissable">', ' <button type="button" class="close" data-dismiss="alert" aria-hidden="true">×</button></div>'); ?>
</div>
</div>
</div>
@ -490,12 +475,7 @@ function duecalculation()
var totaldue=0;
var loan=document.getElementById('Loan_Amount').value;
var due=document.getElementById('monthly_due').value;
//alert(loan+'-'+due);
// if(loan == ""){
// $('#Loan_Amount').val(0.00);
// $('#monthly_due').val(0.00);
// }
if(loan != 0)
{
if(due == 0)
@ -505,7 +485,7 @@ function duecalculation()
}
else
{
//due=document.getElementById('monthly_due').value;
totaldue=loan/due;
if(totaldue < 1)
@ -564,6 +544,35 @@ function finalCheck()
}
}
}
$("#deleteemp").click(function(){
var empid = "<?php echo $EmpID;?>";
var i = confirm("Do You want to delete "+empid+" from Pay Master?");
//alert(i);
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>

View File

@ -253,12 +253,16 @@
$("#monthyear").change(function(){
var curselection = $("#monthyear").val();
// alert('current selection'+curselection);
var currentdate = new Date();
var currentmonth = currentdate.getMonth();
currentmonth++;
//alert('currentmonth'+currentmonth);
var res = curselection.split("-");
var selmonth = res[0];
//alert('current selec month '+ selmonth);
var savebuttonstatus = currentmonth - selmonth;
//alert('status'+savebuttonstatus);
if(savebuttonstatus >= 2)
{
$("#savebutton").hide();
@ -272,6 +276,10 @@
{
$("#savebutton").show();
}
else if(savebuttonstatus == 1)
{
$("#savebutton").show();
}
$("#monthlyListings tbody tr").remove();