diff --git a/application/controllers/payslip.php b/application/controllers/payslip.php index 672775f4..a1bffc22 100755 --- a/application/controllers/payslip.php +++ b/application/controllers/payslip.php @@ -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++; } diff --git a/application/views/editOldemppay.php b/application/views/editOldemppay.php index 41303453..8af075ed 100755 --- a/application/views/editOldemppay.php +++ b/application/views/editOldemppay.php @@ -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))
- - + @@ -227,14 +217,7 @@ if(!empty($emppay))
-
-
-
- OT_Rate(Per Hour)* - -
-
-
+
@@ -244,6 +227,14 @@ if(!empty($emppay))
+
+
+
+ PF_Rate(%)* + +
+
+
@@ -256,14 +247,7 @@ if(!empty($emppay)) -
-
-
- PF_Rate(%)* - -
-
-
+
@@ -406,6 +390,7 @@ if(!empty($emppay))
@@ -433,7 +418,7 @@ if(!empty($emppay)) { ?>
- + session->flashdata('error'); ?>
@@ -443,14 +428,14 @@ if(!empty($emppay)) { ?>
- + session->flashdata('success'); ?>
- ', '
'); ?> + ', '
'); ?>
@@ -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 = ""; + 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:"emppaydate/deleteEmpPay", + success:function(result) { + if(result) + { + + alert(result); + $('#content').loader('hide'); + window.location.href = "emppayListings"; + + } + + } + }); + } + +}); \ No newline at end of file diff --git a/application/views/monthlypayinputs.php b/application/views/monthlypayinputs.php index 4d721f74..75c79bf9 100644 --- a/application/views/monthlypayinputs.php +++ b/application/views/monthlypayinputs.php @@ -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();