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))