+ +
diff --git a/app/Controllers/Employeedetails.php b/app/Controllers/Employeedetails.php
index 77791d58..33c68cc4 100644
--- a/app/Controllers/Employeedetails.php
+++ b/app/Controllers/Employeedetails.php
@@ -203,36 +203,7 @@ class Employeedetails extends BaseController
function AddNewEmployee()
{
- $validation = \Config\Services::validation();
-
-
-
-
-
- // $this->validator->setRules([
- // 'ContactNumber'=> 'trim|required|min_length[10]|max_length[10]',
- // 'emailid'=> 'trim|required|valid_email',
- // 'gender'=> 'callback_Gender_validate',
- // 'MartialStatus'=> 'callback_Martial_validate',
- // 'bloodgroup'=>'callback_Blood_validate',
- // 'emergencycontactnumber'=> 'trim|required|min_length[10]|max_length[10]',
- // 'desigination'=> 'callback_Des_validate',
- // 'departmentname'=> 'callback_Dep_validate',
- // 'eduqualifaction'=> 'callback_select_validate',
- // 'referrercontno'=> 'trim|min_length[10]|max_length[10]',
- // 'aadharno'=> 'trim|min_length[14]|max_length[14]',
- // 'panno'=> 'trim|min_length[10]|max_length[10]',
- // 'passportno'=> 'trim|min_length[9]|max_length[9]',
- // 'accountno'=> 'trim|min_length[10]|max_length[20]',
- // 'pfno'=> 'trim|min_length[22]|max_length[22]',
- // 'esino'=> 'trim|min_length[10]|max_length[10]']);
-
- // if ($this->validator->run() == FALSE) {
- // $this->addemployee();
- // //echo 'Validate method called';
- // } else {
- //echo 'Validate not method called';
$photo = $this->request->getFile('photo');
$Picture = "";
if ($photo->isValid() && !$photo->hasMoved()) {
@@ -371,15 +342,11 @@ class Employeedetails extends BaseController
$Basic_Pay = $this->request->getPost('Basic_Pay');
$HRA_Rate = $this->request->getPost('HRA_Rate');
$HRA_Amount = $this->request->getPost('HRA_Amount');
-
- $Allowances = $this->request->getPost('Allowances');
$PF_Rate = $this->request->getPost('PF_Rate');
$ESI_Rate = $this->request->getPost('ESI_Rate');
- $Food_Allowances = $this->request->getPost('Food_Allowances');
- $Incentives = $this->request->getPost('Incentives');
$CreateBy = $this->session->get('userId');
- $emppay = array('EmpID' => $EmpID, 'TotalSalary' => $Total_Salary, 'Basic_Pay' => $Basic_Pay, 'HRA_Rate' => $HRA_Rate, 'HRA_Amount' => $HRA_Amount, 'Allowances' => $Allowances, 'PF_Rate' => $PF_Rate, 'ESI_Rate' => $ESI_Rate, 'Food_Allowances' => $Food_Allowances, 'Incentives' => $Incentives, 'Created_By' => $CreateBy);
+ $emppay = array('EmpID' => $EmpID, 'TotalSalary' => $Total_Salary, 'Basic_Pay' => $Basic_Pay, 'HRA_Rate' => $HRA_Rate, 'HRA_Amount' => $HRA_Amount, 'PF_Rate' => $PF_Rate, 'ESI_Rate' => $ESI_Rate, 'Created_By' => $CreateBy);
$this->emppaydate_model->addNewemppay($emppay);
@@ -803,34 +770,21 @@ class Employeedetails extends BaseController
$Basic_Pay = $this->request->getPost('Basic_Pay');
$HRA_Rate = $this->request->getPost('HRA_Rate');
$HRA_Amount = $this->request->getPost('HRA_Amount');
- $Allowances = $this->request->getPost('Allowances');
$PF_Rate = $this->request->getPost('PF_Rate');
$ESI_Rate = $this->request->getPost('ESI_Rate');
- $Food_Allowances = $this->request->getPost('Food_Allowances');
- $Incentives = $this->request->getPost('Incentives');
$CreateBy = $this->session->get('userId');
- $emppay = array('EmpID' => $EmpId, 'TotalSalary' => $Total_Salary, 'Basic_Pay' => $Basic_Pay, 'HRA_Rate' => $HRA_Rate, 'HRA_Amount' => $HRA_Amount, 'Allowances' => $Allowances, 'PF_Rate' => $PF_Rate, 'ESI_Rate' => $ESI_Rate, 'Food_Allowances' => $Food_Allowances, 'Incentives' => $Incentives, 'Created_By' => $CreateBy);
+ $emppay = array('EmpID' => $EmpId, 'TotalSalary' => $Total_Salary, 'Basic_Pay' => $Basic_Pay, 'HRA_Rate' => $HRA_Rate, 'HRA_Amount' => $HRA_Amount, 'PF_Rate' => $PF_Rate, 'ESI_Rate' => $ESI_Rate, 'Created_By' => $CreateBy);
$empPayUpdate = $this->emppaydate_model->editemppay($emppay);
if ($result + $empPayUpdate > 0) {
-
-
- // $this->session->set_flashdata('Success', $EmpId.'Employee Updated successfully!');
$this->session->setFlashdata('success', 'You Have Successfully updated the Employee Record!');
- // echo "";
-
} else {
-
- // $this->session->set_flashdata('Error', $EmpId . 'Employee details not saved');
$this->session->setFlashdata('error', 'Record Not Updated!');
- // echo "";
-
}
return redirect()->route('employeeListing');
- // redirect('employeeListing');
- // }
+
}
function exportemployee()
diff --git a/app/Controllers/Emppaydate.php b/app/Controllers/Emppaydate.php
index f07b98f9..98423449 100644
--- a/app/Controllers/Emppaydate.php
+++ b/app/Controllers/Emppaydate.php
@@ -56,13 +56,9 @@ class Emppaydate extends BaseController
*/
function emppayListing()
{
-
-
-
$data['userRecords'] = $this->emppaydate_model->emppayListing();
-
- $this->global['pageTitle'] = 'Employee Pay List';
-
+
+ $this->global['pageTitle'] = 'Employee Loan List';
$this->loadViews("emppayListing", $this->global, $data, NULL);
}
@@ -71,12 +67,8 @@ class Emppaydate extends BaseController
*/
function addemppaydate()
{
- $q = "addemppaydate";
-
-
- $result['empdetails'] = $this->payroll_model->getEmpID($q);
-
-
+
+ $result['empdetails'] = $this->payroll_model->getEmpID();
$this->global['pageTitle'] = 'Add Employee Pay';
@@ -88,71 +80,29 @@ class Emppaydate extends BaseController
{
- helper('form'); //$this->load->library('form_validation');
- $EmpID = $this->request->getPost('EmpID');
- // $this->validator->setRules([
- // 'ContactNumber'=> 'trim|required|min_length[10]|max_length[10]',
- // 'EmpID'=> 'trim|required',
- // 'HRA_Rate'=> 'trim|required',
- // 'HRA_Amount'=> 'trim|required',
- // 'Basic_Pay'=> 'trim|required',
- // 'Total_salary'=> 'trim|required',
- // 'Allowances'=> 'trim|required',
- // 'PF_Rate'=> 'trim|required',
- // 'ESI_Rate'=> 'trim|required',
- // 'Food_Allowances'=> 'trim|required',
- // 'Incentives'=> 'trim|required']);
-
-
-
- // if ($this->validator->run() == FALSE || $EmpID == -1) {
- // $this->addemppaydate();
- // } else {
+
+
+
$EmpID = $this->request->getPost('EmpID');
- $Total_Salary = $this->request->getPost('Total_salary');
- $Basic_Pay = $this->request->getPost('Basic_Pay');
- $HRA_Rate = $this->request->getPost('HRA_Rate');
- $HRA_Amount = $this->request->getPost('HRA_Amount');
-
- $Allowances = $this->request->getPost('Allowances');
- $PF_Rate = $this->request->getPost('PF_Rate');
- $ESI_Rate = $this->request->getPost('ESI_Rate');
- $Food_Allowances = $this->request->getPost('Food_Allowances');
- $Incentives = $this->request->getPost('Incentives');
-
$Loan_Amount = $this->request->getPost('Loan_Amount');
$Load_Issued_date = $this->request->getPost('loan_issued_date');
- if (!empty($Load_Issued_date)) {
- $Load_Issued_date = $Load_Issued_date = format_date($Load_Issued_date);
- } else {
- $Load_Issued_date = null;
- }
+ if (!empty($Load_Issued_date)) { $Load_Issued_date = format_date($Load_Issued_date); } else { $Load_Issued_date = null; }
$Due_Amount = $this->request->getPost('monthly_due');
$Due_Started = $this->request->getPost('due_started');
- if (!empty($Due_Started)) {
- $Due_Started = $Due_Started = format_date($Due_Started);
- } else {
- $Due_Started = null;
- }
-
-
+ if (!empty($Due_Started)) {$Due_Started = format_date($Due_Started);} else { $Due_Started = null; }
$No_Of_Dues = $this->request->getPost('no_of_due');
$Paid_due = $this->request->getPost('paid_due');
$Remaining_Due = $this->request->getPost('remaining_due');
$Paid_Amount = $this->request->getPost('Paid_Amount');
-
-
-
$CreateBy = $this->session->get('userId');
- $chked = $this->request->getPost('is_Active');
- $IsActive = '1';
+
- $emppay = array('EmpID' => $EmpID, 'TotalSalary' => $Total_Salary, 'Basic_Pay' => $Basic_Pay, 'HRA_Rate' => $HRA_Rate, 'HRA_Amount' => $HRA_Amount, 'Allowances' => $Allowances, 'PF_Rate' => $PF_Rate, 'ESI_Rate' => $ESI_Rate, 'Food_Allowances' => $Food_Allowances, 'Incentives' => $Incentives, 'Created_By' => $CreateBy);
+
$loandetails = array('EmpID' => $EmpID, 'Loan_Amount' => $Loan_Amount, 'Loan_Issued_Date' => $Load_Issued_date, 'Monthly_Due' => $Due_Amount, 'Due_Start_Date' => $Due_Started, 'No_of_Dues' => $No_Of_Dues, 'Paid_Due' => $Paid_due, 'Remaining_Due' => $Remaining_Due, 'Paid_Amount' => $Paid_Amount, 'is_Active' => 1, 'Created_By' => $CreateBy);
- $result = $this->emppaydate_model->addNewemppay($emppay);
+
if ($Loan_Amount != 0) {
$result2 = $this->emppaydate_model->addLoanInfo($loandetails, 'add');
if ($result2 > 0) {
@@ -161,17 +111,8 @@ class Emppaydate extends BaseController
echo "";
}
}
- if ($result > 0) {
- echo "";
- } else {
- echo "";
-
- }
+
- //}
- // }
}
/**
@@ -197,72 +138,26 @@ class Emppaydate extends BaseController
{
- helper('form'); //$this->load->library('form_validation');
-
- $Pay_Data_ID = $this->request->getPost('Pay_Data_ID');
-
- //'Pay_Data_ID'=>'trim|required';
- // $this->validator->setRules([
- // 'EmpID'=> 'trim|required',
- // 'Total_Salary'=> 'trim|required',
- // 'Basic_Pay'=> 'trim|required',
- // 'HRA_Rate'=> 'trim|required',
- // 'Allowances'=> 'trim|required',
- // 'PF_Rate'=> 'trim|required',
- // 'ESI_Rate'=> 'trim|required',
- // 'Food_Allowances'=> 'trim|required',
- // 'Incentives'=> 'trim|required']);
-
- // if ($this->validator->run() == FALSE) {
-
- // $this->editOldemppay($Pay_Data_ID);
- // } else {
-
- $Pay_Data_ID = $this->request->getPost('Pay_Data_ID');
$EmpID = $this->request->getPost('EmpID');
- $TotalSalary = $this->request->getPost('Total_Salary');
- $Basic_Pay = $this->request->getPost('Basic_Pay');
- $HRA_Rate = $this->request->getPost('HRA_Rate');
- $HRA_Amount = $this->request->getPost('HRA_Amount');
-
- $Allowances = $this->request->getPost('Allowances');
- $PF_Rate = $this->request->getPost('PF_Rate');
- $ESI_Rate = $this->request->getPost('ESI_Rate');
$loan_ID = $this->request->getPost('loanid');
$Loan_Amount = $this->request->getPost('Loan_Amount');
$Load_Issued_date = $this->request->getPost('loan_issued_date');
- if (!empty($Load_Issued_date)) {
- $Load_Issued_date = format_date($Load_Issued_date);
- } else {
- $Load_Issued_date = null;
- }
-
-
+ if (!empty($Load_Issued_date)) {$Load_Issued_date = format_date($Load_Issued_date);} else { $Load_Issued_date = null; }
$Due_Amount = $this->request->getPost('monthly_due');
$Due_Started = $this->request->getPost('due_started');
- if (!empty($Due_Started)) {
- $Due_Started = format_date($Due_Started);
- } else {
- $Due_Started = null;
- }
-
-
- //echo $Load_Issued_date. "-" . $Due_Started;die();
+ if (!empty($Due_Started)) {$Due_Started = format_date($Due_Started); } else { $Due_Started = null; }
$No_Of_Dues = $this->request->getPost('no_of_due');
$Paid_due = $this->request->getPost('paid_due');
$Remaining_Due = $this->request->getPost('remaining_due');
$Paid_Amount = $this->request->getPost('Paid_Amount');
- $is_Active = $this->request->getPost('is_Active');
$Last_Mod_By = $this->session->get('userId');
- $Last_Mod_Time = date('d-m-Y h:i:sa');
- $Food_Allowances = $this->request->getPost('Food_Allowances');
- $Incentives = $this->request->getPost('Incentives');
+
- $emppay = array('Pay_Data_ID' => $Pay_Data_ID, 'EmpID' => $EmpID, 'TotalSalary' => $TotalSalary, 'Basic_Pay' => $Basic_Pay, 'HRA_Rate' => $HRA_Rate, 'HRA_Amount' => $HRA_Amount, 'Allowances' => $Allowances, 'PF_Rate' => $PF_Rate, 'ESI_Rate' => $ESI_Rate, 'Food_Allowances' => $Food_Allowances, 'Incentives' => $Incentives, 'Last_Mod_By' => $Last_Mod_By);
+
$loandetails = array('Loan_ID' => $loan_ID, 'EmpID' => $EmpID, 'Loan_Amount' => $Loan_Amount, 'Loan_Issued_Date' => $Load_Issued_date, 'Monthly_Due' => $Due_Amount, 'Due_Start_Date' => $Due_Started, 'No_of_Dues' => $No_Of_Dues, 'Paid_Due' => $Paid_due, 'Remaining_Due' => $Remaining_Due, 'Paid_Amount' => $Paid_Amount, 'is_Active' => 1, 'Last_Mod_By' => $Last_Mod_By);
@@ -284,18 +179,8 @@ class Emppaydate extends BaseController
}
- $result = $this->emppaydate_model->editemppay($emppay);
- if ($result == true) {
- echo "";
- } else {
- echo "";
-
- }
+
- // redirect('emppaydate/emppayListing');
- // }
}
diff --git a/app/Controllers/Monthlypay.php b/app/Controllers/Monthlypay.php
index 74deebd1..5379ee31 100644
--- a/app/Controllers/Monthlypay.php
+++ b/app/Controllers/Monthlypay.php
@@ -138,6 +138,7 @@ class Monthlypay extends BaseController
}
$begin->modify('+1 day');
}
+ // dd( $sundayarray);
$noofsundays = count($sundayarray);
$publicholidaysarray = $this->monthlypay_model->getPublicHoldays($current);
@@ -150,6 +151,7 @@ class Monthlypay extends BaseController
$data['datefordropdown'] = $current;
$data['attendance'] = $this->monthlypay_model->monthlyAttendance($current);
$data['emppay'] = $this->monthlypay_model->getEmpPayDetails($current, $string);
+
$this->global['pageTitle'] = 'Monthly Attendance';
$this->loadViews("attendance", $this->global, $data, NULL);
}
@@ -264,6 +266,7 @@ class Monthlypay extends BaseController
$paidleave = $data['Paid Leave'];
$daysworked = $data['Days Worked'];
$absent = $data['Absent'];
+ $sundayCount = $data['Total Sunday'];
$monthattendance = array(
'Month_Year' => $Month_Year, 'NoofDays' => $NoofDays, 'EmpID' => $EmpID, 'WH1' => $W1H, 'OT1' => $W1OT, 'WH2' => $W2H, 'OT2' => $W2OT, 'WH3' => $W3H, 'OT3' => $W3OT,
@@ -272,7 +275,7 @@ class Monthlypay extends BaseController
'WH17' => $W17H, 'OT17' => $W17OT, 'WH18' => $W18H, 'OT18' => $W18OT, 'WH19' => $W19H, 'OT19' => $W19OT, 'WH20' => $W20H, 'OT20' => $W20OT, 'WH21' => $W21H, 'OT21' => $W21OT, 'WH22' => $W22H, 'OT22' => $W22OT,
'WH23' => $W23H, 'OT23' => $W23OT, 'WH24' => $W24H, 'OT24' => $W24OT, 'WH25' => $W25H, 'OT25' => $W25OT, 'WH26' => $W26H, 'OT26' => $W26OT, 'WH27' => $W27H, 'OT27' => $W27OT, 'WH28' => $W28H, 'OT28' => $W28OT,
'WH29' => $W29H, 'OT29' => $W29OT, 'WH30' => $W30H, 'OT30' => $W30OT, 'WH31' => $W31H, 'OT31' => $W31OT, 'Total_WHrs' => $totalworkinghrs, 'Total_OTHrs' => $totalothrs, 'Paid_Leave' => $paidleave,
- 'Days_Worked' => $daysworked, 'Absent' => $absent, 'Created_by' => $CreateBy
+ 'Days_Worked' => $daysworked, 'Absent' => $absent, 'sunday_count' => $sundayCount , 'Created_by' => $CreateBy
);
diff --git a/app/Controllers/Payslip.php b/app/Controllers/Payslip.php
index 2ed1cc87..1090edb5 100644
--- a/app/Controllers/Payslip.php
+++ b/app/Controllers/Payslip.php
@@ -504,15 +504,16 @@ class Payslip extends BaseController
public function monthlyInputs()
{
$current = date("m-Y");
- // echo $current;
+
+
$data['month'] = $this->monthlypay_model->monthlyListing($current);
- // $data['fresh'] = $this-> monthlypay_model->getEmpPayDetails($current);
$data['dropdownvalue'] = $current;
$data['fresh'] = $this->monthlypay_model->getEmpPayDetailsforMonthInputs($current);
- // dd($data['fresh']);
+
$employeeSalary = [];
-
-
+ $esi = [];
+ $pf = [];
+ $ot = [];
foreach ($data['fresh'] as $value) {
@@ -520,34 +521,25 @@ class Payslip extends BaseController
$HRA_Amount = $value->HRA_Amount;
$Basic_Pay = $value->Basic_Pay;
$TotalSalary = $value->TotalSalary;
- $Food_Allowances = $value->Food_Allowances;
$Days_worked = $value->Days_worked; // working day
- $LOP_Days = $value->LOP_Days; // not working day
+ $Sunday = $value->sunday_count; // Sunday count
+ $LOP_Days = $value->NoofDays - ($Days_worked + $Sunday); // not working day
$Paid_leave = $value->Paid_leave; // leave day
$OT_Hrs_Worked = $value->OT_Hrs_Worked; //OT hours
$Monthly_Due = $value->Monthly_Due; // AUTO LOAN DUE
-
$Loan_Recovered = $value->Loan_Recovered; //MANUAL LOAN DUE
-
- $MasterIncentives = $value->MasterIncentives; //Master values get
- // echo 'master'.$MasterIncentives;
-
-
$due_start_date = $value->DueDate;
$paydate = $current; //From POST parm
+
$pmonth = substr($paydate, 0, 2);
$pyear = substr($paydate, -4);
-
$pday = cal_days_in_month(CAL_GREGORIAN, $pmonth, $pyear);
$paymonth = $pyear . '-' . $pmonth . '-' . $pday;
+
$Loan_amount = $value->Loan_Amount;
$Paid_Amount = $value->Paid_Amount;
-
-
$Balance_Amount = $Loan_amount - $Paid_Amount;
-
-
$loan = 0;
if ($Loan_Recovered == 'NA') {
$loan = 0.00;
@@ -563,89 +555,76 @@ class Payslip extends BaseController
if ($Monthly_Due > $Balance_Amount) {
-
- // current= Balance_Amount - autoLoan;
- //alert('hi');
$loan = $Balance_Amount;
}
-
-
-
-
- $Allowances = $value->Allowances;
- $HRA_Rate = $value->HRA_Rate;
+
$PF_Rate = $value->PF_Rate;
$ESI_Rate = $value->ESI_Rate;
- $MonthIncentive = $value->MonthlyIncentives; //t_monthly_pay_inputs,for change month
+
+
- $Incentive = 0;
+
- if (empty($MonthIncentive)) {
-
- $Incentive = $MasterIncentives;
- } else {
- $Incentive = $MonthIncentive;
- }
- // echo $Incentive;
-
-
-
- $daySalarys = $Days_worked + $Paid_leave;
-
- //echo "hra amount";print_r(array($HRA_Amount,$Basic_Pay,$totalsalary));
- //$Allowances = $allowances * $values;
- $dayFood_Allowance = $Food_Allowances * $Days_worked;
-
- $daySalary = $Basic_Pay / $NoofDays;
- /**per day salary working hour**/
- //echo $daySalary.'
';
+ $totalDaysWorked = ($Days_worked + $Sunday) + $Paid_leave;
+ $dayBasic = $Basic_Pay / $NoofDays;
$dayHra = $HRA_Amount / $NoofDays;
- /** per day hra amount **/
- //echo $dayHra.'
';
+ $onehoursSalary = ($dayBasic + $dayHra) / 8;
- $onehoursSalary = ($daySalary + $dayHra) / 8;
/**one hour salay ot calculation**/
if ($OT_Hrs_Worked != 0) {
$totSalayOT = $OT_Hrs_Worked * $onehoursSalary;
} else {
$totSalayOT = 0;
}
- $currentDaySalary = $daySalary * $daySalarys;
- /** current day salary working days calculation**/
-
-
- $currentDayHra = $dayHra * $daySalarys;
- /** total working days hra calculations**/
- // echo $currentDayHra.'
';
- $currentDatePF = $currentDaySalary + $currentDayHra + $totSalayOT;
- /** current date pf calculation**/
- if ($TotalSalary <= 20000) {
-
- $esiAmount = $currentDatePF * $ESI_Rate / 100;
- /** esiamount not elgiable for 20000 **/
- } else {
- $esiAmount = 0;
+
+
+ //current day basic and hra salary
+ if ($value->is_management_team == 1)
+ {
+ $currentDayBasic = $dayBasic * $NoofDays;
+ $currentDayHra = $dayHra * $NoofDays;
+ } else {
+ $currentDayBasic = $dayBasic * $totalDaysWorked;
+ $currentDayHra = $dayHra * $totalDaysWorked;
}
- $pfAmount = $currentDaySalary * $PF_Rate / 100;
+
+
+
+
+ if ($value->esi_applicable == 1) { $esiAmount = $currentDayBasic * $ESI_Rate / 100; } else { $esiAmount = 0; }
+ if ($value->pf_applicable == 1) { $pfAmount = $currentDayBasic * $PF_Rate / 100; } else { $pfAmount = 0; }
+
/** pf amount per day**/
//echo $totalothour;die;
- $empSalaryAdd = $currentDaySalary + $totSalayOT + $currentDayHra + $dayFood_Allowance + $Allowances + $Incentive;
+ $empSalaryAdd = $currentDayBasic + $currentDayHra + $totSalayOT;
+
$empSalarySub = $esiAmount + $pfAmount + $loan;
-
+
$salaryInCurrentday = $empSalaryAdd - $empSalarySub;
-
+ // echo $esiAmount .'';
+ // echo $pfAmount .'';
+ // echo $loan .'';
+ // echo $empSalarySub .'';
+ // echo $empSalaryAdd .'';
+ // echo $salaryInCurrentday .'';
+ // die;
$employeeSalary[] = round($salaryInCurrentday);
+ $esi[] = number_format($esiAmount,2);
+ $pf[] = number_format($pfAmount,2);
+ $ot[] = number_format($totSalayOT,2);
}
$data['empSalary'] = $employeeSalary;
-
-
- //echo sizeof($data['fresh'])."-".sizeof($data['empSalary']);die;
+ $data['esi'] = $esi;
+ $data['pf'] = $pf;
+ $data['over_time'] = $ot;
+
+// dd($data);
$this->global['pageTitle'] = 'Payroll Monthly Inputs';
$this->loadViews("monthlypayinputs", $this->global, $data, NULL);
}
@@ -657,30 +636,29 @@ class Payslip extends BaseController
$current = $this->request->getPost('monthyear');
$data['month'] = $this->monthlypay_model->monthlyListing($current);
- //print_r($data['month']);
$data['dropdownvalue'] = $current;
$data['fresh'] = $this->monthlypay_model->getEmpPayDetailsforMonthInputs($current);
-
- // dd($data['fresh']);
+ //dd($data['fresh']);
+
$employeeSalary = [];
-
-
+ $esi = [];
+ $pf = [];
+ $ot = [];
foreach ($data['fresh'] as $value) {
- //print_r($value);
- //die();
$NoofDays = $value->NoofDays; //Month day 30,31,28
$HRA_Amount = $value->HRA_Amount;
$Basic_Pay = $value->Basic_Pay;
$TotalSalary = $value->TotalSalary;
- $Food_Allowances = $value->Food_Allowances;
$Days_worked = $value->Days_worked; // working day
- $LOP_Days = $value->LOP_Days; // not working day
+ $Sunday = $value->sunday_count; // Sunday count
+ $LOP_Days = $value->NoofDays - ($Days_worked + $Sunday); // not working day
$Paid_leave = $value->Paid_leave; // leave day
$OT_Hrs_Worked = $value->OT_Hrs_Worked; //OT hours
$Monthly_Due = $value->Monthly_Due; // AUTO LOAN DUE
+ $Loan_Recovered = $value->Loan_Recovered; //MANUAL LOAN DUE
$due_start_date = $value->DueDate;
$paydate = $current; //From POST parm
@@ -693,18 +671,10 @@ class Payslip extends BaseController
$pday = cal_days_in_month(CAL_GREGORIAN, $pmonth, $pyear);
$paymonth = $pyear . '-' . $pmonth . '-' . $pday;
- $Loan_Recovered = $value->Loan_Recovered; //MANUAL LOAN DUE
-
- $MasterIncentives = $value->MasterIncentives; //Master values get
- // echo 'master'.$MasterIncentives;
$Loan_amount = $value->Loan_Amount;
$Paid_Amount = $value->Paid_Amount;
-
-
$Balance_Amount = $Loan_amount - $Paid_Amount;
-
-
$loan = 0;
if ($Loan_Recovered == 'NA') {
$loan = 0.00;
@@ -713,7 +683,6 @@ class Payslip extends BaseController
$loan = $Monthly_Due;
}
} else if ($Loan_Recovered >= 0.00) {
-
if (strtotime($due_start_date) <= strtotime($paymonth)) {
$loan = $Loan_Recovered;
}
@@ -721,87 +690,75 @@ class Payslip extends BaseController
if ($Monthly_Due > $Balance_Amount) {
-
- // current= Balance_Amount - autoLoan;
- //alert('hi');
$loan = $Balance_Amount;
}
-
-
-
-
- $Allowances = $value->Allowances;
- $HRA_Rate = $value->HRA_Rate;
$PF_Rate = $value->PF_Rate;
$ESI_Rate = $value->ESI_Rate;
- $MonthIncentive = $value->MonthlyIncentives; //t_monthly_pay_inputs,for change month
+
+
- $Incentive = 0;
+
- if (empty($MonthIncentive)) {
-
- $Incentive = $MasterIncentives;
- } else {
- $Incentive = $MonthIncentive;
- }
- // echo $Incentive;
-
-
-
- $daySalarys = $Days_worked + $Paid_leave;
-
- //echo "hra amount";print_r(array($HRA_Amount,$Basic_Pay,$totalsalary));
- //$Allowances = $allowances * $values;
- $dayFood_Allowance = $Food_Allowances * $Days_worked;
-
- $daySalary = $Basic_Pay / $NoofDays;
- /**per day salary working hour**/
- //echo $daySalary.'
';
+ $totalDaysWorked = ($Days_worked + $Sunday) + $Paid_leave;
+ $dayBasic = $Basic_Pay / $NoofDays;
$dayHra = $HRA_Amount / $NoofDays;
- /** per day hra amount **/
- //echo $dayHra.'
';
+ $onehoursSalary = ($dayBasic + $dayHra) / 8;
- $onehoursSalary = ($daySalary + $dayHra) / 8;
/**one hour salay ot calculation**/
if ($OT_Hrs_Worked != 0) {
$totSalayOT = $OT_Hrs_Worked * $onehoursSalary;
} else {
$totSalayOT = 0;
}
- $currentDaySalary = $daySalary * $daySalarys;
- /** current day salary working days calculation**/
-
-
- $currentDayHra = $dayHra * $daySalarys;
- /** total working days hra calculations**/
- // echo $currentDayHra.'
';
- $currentDatePF = $currentDaySalary + $currentDayHra + $totSalayOT;
- /** current date pf calculation**/
- if ($TotalSalary <= 20000) {
-
- $esiAmount = $currentDatePF * $ESI_Rate / 100;
- /** esiamount not elgiable for 20000 **/
- } else {
- $esiAmount = 0;
+
+
+ //current day basic and hra salary
+ if ($value->is_management_team == 1)
+ {
+ $currentDayBasic = $dayBasic * $NoofDays;
+ $currentDayHra = $dayHra * $NoofDays;
+ } else {
+ $currentDayBasic = $dayBasic * $totalDaysWorked;
+ $currentDayHra = $dayHra * $totalDaysWorked;
}
- $pfAmount = $currentDaySalary * $PF_Rate / 100;
+
+
+
+ //$totalSalary = $currentDayBasic + $currentDayHra + $totSalayOT;
+
+
+ if ($value->esi_applicable == 1) { $esiAmount = $currentDayBasic * $ESI_Rate / 100; } else { $esiAmount = 0;}
+ if ($value->pf_applicable == 1) { $pfAmount = $currentDayBasic * $PF_Rate / 100; } else { $pfAmount = 0;}
+
/** pf amount per day**/
//echo $totalothour;die;
- $empSalaryAdd = $currentDaySalary + $totSalayOT + $currentDayHra + $dayFood_Allowance + $Allowances + $Incentive;
+ $empSalaryAdd = $currentDayBasic + $currentDayHra + $totSalayOT;
$empSalarySub = $esiAmount + $pfAmount + $loan;
-
$salaryInCurrentday = $empSalaryAdd - $empSalarySub;
+ // echo $esiAmount .'';
+ // echo $pfAmount .'';
+ // echo $loan .'';
+ // echo $empSalarySub .'';
+ // echo $empSalaryAdd .'';
+ // echo $salaryInCurrentday .'';
+ // die;
$employeeSalary[] = round($salaryInCurrentday);
+ $esi[] = number_format($esiAmount,2);
+ $pf[] = number_format($pfAmount,2);
+ $ot[] = number_format($totSalayOT,2);
}
$data['empSalary'] = $employeeSalary;
-
+ $data['esi'] = $esi;
+ $data['pf'] = $pf;
+ $data['over_time'] = $ot;
+ // dd($data);
//echo sizeof($data['fresh'])."-".sizeof($data['empSalary']);die;
$this->global['pageTitle'] = 'Payroll Monthly Inputs';
$this->loadViews("monthlypayinputs", $this->global, $data, NULL);
@@ -847,9 +804,9 @@ class Payslip extends BaseController
$ErrorFlag = 0;
- $Emp = $j['Employee'];
+
- $EmpID = substr($Emp, 0, 4);
+ $EmpID = $j['Emp ID'];
//$Name = $j['Employee Name'];
//echo $EmpID; die;
@@ -858,10 +815,10 @@ class Payslip extends BaseController
$LOP_Days = $j['LOP Days'];
$Paid_leave = $j['Paid Leave'];
$OT_Hrs_Worked = $j['OT Hrs'];
- $Loan_Recovered = $j['Manual Loan Due ₹'];
- $Incentives = $j['Incentives in ₹'];
+ $Loan_Recovered = $j['Auto Loan Due ₹'];
+ // $Incentives = $j['Incentives in ₹'];
$Festival_Bonus = $j['Festival Bonus in ₹'];
- $Other_Deductions = $j['Other Deductions in ₹'];
+ $Other_Deductions = $j['TDS Deductions in ₹'];
$Estimate = $j['Estimate in ₹'];
$Created_By = $this->session->get('userId');
@@ -906,11 +863,11 @@ class Payslip extends BaseController
}
}
- $Incentives_first = explode(".", $Incentives);
- if (!is_numeric($Incentives) || (strlen((string)$Incentives)) > 8 || (strlen((string)$Incentives_first[0])) > 5) {
- //echo $EmpID . "-Loan Recoverd Invalid Data!";
- $ErrorFlag++;
- }
+ // $Incentives_first = explode(".", $Incentives);
+ // if (!is_numeric($Incentives) || (strlen((string)$Incentives)) > 8 || (strlen((string)$Incentives_first[0])) > 5) {
+ // //echo $EmpID . "-Loan Recoverd Invalid Data!";
+ // $ErrorFlag++;
+ // }
$Festivalbonus_first = explode(".", $Festival_Bonus);
if (!is_numeric($Festival_Bonus) || (strlen((string)$Festival_Bonus)) > 8 || (strlen((string)$Festivalbonus_first[0])) > 5) {
@@ -944,29 +901,24 @@ class Payslip extends BaseController
foreach ($json as $index => $j) {
- $Emp = $j['Employee'];
-
- // $EmpID = substr($Emp, 0, 4);
- $parts = explode("-", $Emp);
- $EmpID = $parts[0];
-
- //$Name = $j['Employee'];
-
+
+
+ $EmpID = $j['Emp ID'];
$DaysWorked = $j['Days Worked'];
- $LOP_Days = $j['LOP Days'];
- $Paid_leave = $j['Paid Leave'];
- $OT_Hrs_Worked = $j['OT Hrs'];
- $Loan_Recovered = isset($j['Manual Loan Due ₹']) ? $j['Manual Loan Due ₹'] : 0.00;
- if (is_string($Loan_Recovered)) {
- $Loan_Recovered = strtoupper($Loan_Recovered);
- }
- $Incentives = isset($j['Incentives in ₹']) ? $j['Incentives in ₹'] : 0.00 ;
+ $LOP_Days = isset($j['LOP Days']) ? $j['LOP Days'] : 0.00;
+ $Paid_leave = isset($j['Paid Leave']) ? $j['Paid Leave'] : 0.00;
+ $OT_Hrs_Worked = isset($j['OT Hrs']) ? $j['OT Hrs'] : 0.00;
+ $Loan_Recovered = isset($j['Auto Loan Due ₹']) ? $j['Auto Loan Due ₹'] : 0.00;
+ // if (is_string($Loan_Recovered)) {
+ // $Loan_Recovered = strtoupper($Loan_Recovered);
+ // }
+ // $Incentives = isset($j['Incentives in ₹']) ? $j['Incentives in ₹'] : 0.00 ;
$Festival_Bonus = isset($j['Festival Bonus in ₹']) ? $j['Festival Bonus in ₹'] : 0.00;
- $Other_Deductions = isset($j['Other Deductions in ₹']) ? $j['Other Deductions in ₹'] : 0.00;
+ $tds_Deductions = isset($j['TDS Deductions in ₹']) ? $j['TDS Deductions in ₹'] : 0.00;
$Estimate = isset($j['Estimate in ₹']) ? $j['Estimate in ₹'] : 0.00;
$Created_By = $this->session->get('userId');
- $monthlypaydata = array('Month_Year' => $month, 'EmpID' => $EmpID, 'Days_worked' => $DaysWorked, 'LOP_Days' => $LOP_Days, 'Paid_leave' => $Paid_leave, 'OT_Hrs_Worked' => $OT_Hrs_Worked, 'Loan_Recovered' => $Loan_Recovered, 'Incentives' => $Incentives, 'Festival_Bonus' => $Festival_Bonus, 'Other_Deductions' => $Other_Deductions, 'Estimate' => $Estimate, 'Created_By' => $Created_By);
+ $monthlypaydata = array('Month_Year' => $month, 'EmpID' => $EmpID, 'Days_worked' => $DaysWorked, 'LOP_Days' => $LOP_Days, 'Paid_leave' => $Paid_leave, 'OT_Hrs_Worked' => $OT_Hrs_Worked, 'Festival_Bonus' => $Festival_Bonus, 'Other_Deductions' => $tds_Deductions, 'Estimate' => $Estimate, 'Created_By' => $Created_By ,'Loan_Recovered'=>$Loan_Recovered);
// print_r($monthlypaydata); die;
$result = $this->monthlypay_model->saveMonthlyData_model($monthlypaydata);
$total = $total + $result;
@@ -1016,8 +968,6 @@ class Payslip extends BaseController
$Data['Payon'] = $this->payroll_model->getPayOn();
-
-
$this->global['pageTitle'] = 'Payroll Generater';
$this->loadViews("payslipgenerate", $this->global, $Data, NULL);
@@ -1038,6 +988,7 @@ class Payslip extends BaseController
$id = $this->request->getPost('id1');
$result = $this->payroll_model->getEmployeelist2($id);
+
$HTML = "";
if (count($result) > 0) {
diff --git a/app/Models/Emppaydate_model.php b/app/Models/Emppaydate_model.php
index 33968517..17bdf4ba 100644
--- a/app/Models/Emppaydate_model.php
+++ b/app/Models/Emppaydate_model.php
@@ -15,11 +15,12 @@ class Emppaydate_model extends Model
*/
function emppayListing()
{
- $builder = $this->db->table('t_emp_pay_data')
- ->select('t_emp_pay_data.*,t_employee_details.FirstName,t_employee_details.LastName')
- ->join('t_employee_details','t_emp_pay_data.EmpID=t_employee_details.EmpID');
+ $builder = $this->db->table('t_loan_master')
+ ->select('t_loan_master.*,t_emp_pay_data.*,t_employee_details.FirstName')
+ ->join('t_employee_details','t_loan_master.EmpID = t_employee_details.EmpID','LEFT')
+ ->join('t_emp_pay_data','t_loan_master.EmpID = t_emp_pay_data.EmpID','LEFT');
$query =$builder->get();
- $result = $query->getResult();
+ $result = $query->getResult();
return $result;
}
diff --git a/app/Models/Monthlypay_model.php b/app/Models/Monthlypay_model.php
index eb6c48b7..98c3665a 100644
--- a/app/Models/Monthlypay_model.php
+++ b/app/Models/Monthlypay_model.php
@@ -100,7 +100,7 @@ class Monthlypay_model extends Model
//echo $lastdate;
//left join t_payroll on t_employee_details.EmpID = t_payroll.EmpID and month(t_payroll.PayOn) = month(?) and year(t_payroll.PayOn) = year(?)
- $sql = "select t_emp_pay_data.EmpID, t_emp_pay_data.Incentives as MasterIncentives,t_emp_pay_data.*,t_employee_details.FirstName,t_employee_details.LastName,t_employee_details.DateofJoining,t_employee_details.Designation,t_attendance.Days_Worked as Days_worked,t_attendance.Absent as LOP_Days,t_attendance.Paid_Leave as Paid_leave,t_attendance.Total_OTHrs as OT_Hrs_Worked,t_attendance.NoofDays,t_loan_master.Loan_ID,t_loan_master.Monthly_Due,t_loan_master.Due_Start_Date as DueDate,t_loan_master.Loan_Amount,t_loan_master.Paid_Amount,t_payroll.Key,t_monthly_pay_inputs.Incentives as MonthlyIncentives,t_monthly_pay_inputs.Loan_Recovered,t_monthly_pay_inputs.Estimate,t_monthly_pay_inputs.Festival_Bonus,t_monthly_pay_inputs.Other_Deductions,t_loan_history .Balance_Amount
+ $sql = "select t_emp_pay_data.EmpID,t_emp_pay_data.*,t_employee_details.FirstName,t_employee_details.DateofJoining,t_employee_details.Designation,t_employee_details.esi_applicable,t_employee_details.pf_applicable,t_employee_details.is_management_team,t_attendance.Days_Worked as Days_worked,t_attendance.Absent as LOP_Days,t_attendance.Paid_Leave as Paid_leave,t_attendance.Total_OTHrs as OT_Hrs_Worked,t_attendance.NoofDays,t_attendance.sunday_count,t_loan_master.Loan_ID,t_loan_master.Monthly_Due,t_loan_master.Due_Start_Date as DueDate,t_loan_master.Loan_Amount,t_loan_master.Paid_Amount,t_payroll.Key,t_monthly_pay_inputs.Incentives as MonthlyIncentives,t_monthly_pay_inputs.Loan_Recovered,t_monthly_pay_inputs.Estimate,t_monthly_pay_inputs.Festival_Bonus,t_monthly_pay_inputs.Other_Deductions,t_loan_history .Balance_Amount
from t_emp_pay_data
left join t_employee_details on t_employee_details.EmpID = t_emp_pay_data.EmpID
left join t_payroll on t_employee_details.EmpID = t_payroll.EmpID and t_payroll.PayOn = ?
@@ -206,7 +206,7 @@ class Monthlypay_model extends Model
$count = $res[0]['count'];
}
-// print_r($data);die;
+
if ($count == 0) {
$builder = $this->db->table('t_monthly_pay_inputs');
diff --git a/app/Models/Payroll_model.php b/app/Models/Payroll_model.php
index 2dc9f207..84001a78 100644
--- a/app/Models/Payroll_model.php
+++ b/app/Models/Payroll_model.php
@@ -373,14 +373,12 @@ class Payroll_model extends Model
$this->db->table('t_payroll')->delete(['PayOn' => $PayOn]);
}
- function getEmpID($q = '')
+ function getEmpID()
{
$builder = $this->db->table('t_employee_details')
->select('EmpID,FirstName,LastName');
- if ($q == "addemppaydate") {
- $builder->where('EmpID NOT IN (SELECT EmpID from t_emp_pay_data)', NULL, FALSE);
- }
+
$query = $builder->get();
return $query->getResult();
}
diff --git a/app/Models/Purchaseorder_model.php b/app/Models/Purchaseorder_model.php
index b9898986..a0f828cf 100644
--- a/app/Models/Purchaseorder_model.php
+++ b/app/Models/Purchaseorder_model.php
@@ -1654,18 +1654,16 @@ QuantityRejected,ROUND(Quantity-ReceivedQuantity)as PendingQty,Per,
{
$subQuery = 'SELECT distinct LineItem.LineItemNo,LineItem.Per,LineItem.ServiceMaterialDescription,Req.ReqNo,Mat.MaterialCode,Mat.MaterialName,LineItem.ServiceMaterialDescription,LineItem.ServiceFrequency,
-Mat.UOM,Quantity,ReceivedQuantity,Rate,Req.Status,Tax.*,
- ROUND((RMCIncludingCustomersPerKG*Quantity),2)as Taxamount,LandingCharge,HighSeasSalesCharge,CustomDuty,ExciseDuty,ExciseDutyEdCess,CustomEdCess,POMast.ExchangeRate,POMast.ExchangeRateCalculatedon,POMast.TotalOrderValue as BasicValue,POMast.CapitalRange,AfterLandingCharge,AfterHighSeasSalesCharge,AfterCustomDuty,AfterExciseDuty,AfterExciseDutyEdCess,AddlExciseDuty,AfterAddlExciseDuty,Grossdutypayable,AvailableModvat,Grossexpensesduetocustomduty,purchaseratePerKG,CustomDutyExpensesPerKG,RMCIncludingCustomersPerKG,QuantityKG,BasicPriceInMTon,ProductPrice,CustomSHCess,AfterCustomSHCess,AfterExciseDutySHCess,ExciseDutySHCess,AfterCustomEdCess,ROUND((POMast.ExchangeRate*BasicPriceInMTon*Quantity),2) as BasicINRValue,Tax.TotalValue as ImportTotalValue,Tax.FreightType,Tax.NoOfTrip,Tax.FreightValue,Tax.AfterFreightValue,POMast.CurrencyType,
-
- Req.CostCenterCode,Dept.DepartmentName FROM t_purchaseorder_lineitem LineItem
- join t_purchaseorder_master POMast on POMast.PONO = LineItem.PONO
-join t_materialmaster Mat on Mat.MaterialCode = LineItem.MaterialCode
-
- join t_import_tax Tax on Tax.LineItemNo = LineItem.LineItemNo
- join t_requestion_master Req on Req.ReqNo = LineItem.ReqNo
-left join t_employee_details emp on Req.Requestedby = emp.EmpID
-
- join t_departmentdetails Dept on Req.RequestedDept = Dept.DEPCode where LineItem.PONO =?';
+ Mat.UOM,Quantity,ReceivedQuantity,Rate,Req.Status,Tax.*,
+ ROUND((RMCIncludingCustomersPerKG*Quantity),2)as Taxamount,LandingCharge,HighSeasSalesCharge,CustomDuty,ExciseDuty,ExciseDutyEdCess,CustomEdCess,POMast.ExchangeRate,POMast.ExchangeRateCalculatedon,POMast.TotalOrderValue as BasicValue,POMast.CapitalRange,AfterLandingCharge,AfterHighSeasSalesCharge,AfterCustomDuty,AfterExciseDuty,AfterExciseDutyEdCess,AddlExciseDuty,AfterAddlExciseDuty,Grossdutypayable,AvailableModvat,Grossexpensesduetocustomduty,purchaseratePerKG,CustomDutyExpensesPerKG,RMCIncludingCustomersPerKG,QuantityKG,BasicPriceInMTon,ProductPrice,CustomSHCess,AfterCustomSHCess,AfterExciseDutySHCess,ExciseDutySHCess,AfterCustomEdCess,ROUND((POMast.ExchangeRate*BasicPriceInMTon*Quantity),2) as BasicINRValue,Tax.TotalValue as ImportTotalValue,Tax.FreightType,Tax.NoOfTrip,Tax.FreightValue,Tax.AfterFreightValue,POMast.CurrencyType,
+
+ Req.CostCenterCode,Dept.DepartmentName FROM t_purchaseorder_lineitem LineItem
+ join t_purchaseorder_master POMast on POMast.PONO = LineItem.PONO
+ join t_materialmaster Mat on Mat.MaterialCode = LineItem.MaterialCode
+ left join t_import_tax Tax on Tax.LineItemNo = LineItem.LineItemNo
+ join t_requestion_master Req on Req.ReqNo = LineItem.ReqNo
+ left join t_employee_details emp on Req.Requestedby = emp.EmpID
+ left join t_departmentdetails Dept on Req.RequestedDept = Dept.DEPCode where LineItem.PONO =?';
//print_r($subQuery);
$query = $this->db->query($subQuery, array($PONO));
@@ -1720,7 +1718,7 @@ left join t_employee_details emp on Req.Requestedby = emp.EmpID
Req.CostCenterCode,Dept.DepartmentName FROM t_purchaseorder_lineitem LineItem
join t_purchaseorder_master POMast on POMast.PONO = LineItem.PONO
join t_materialmaster Mat on Mat.MaterialCode = LineItem.MaterialCode
- join t_service_tax ServiceTax on ServiceTax.LineItemNo = LineItem.LineItemNo
+ left join t_service_tax ServiceTax on ServiceTax.LineItemNo = LineItem.LineItemNo
join t_requestion_master Req on Req.ReqNo = LineItem.ReqNo
join t_employee_details emp on Req.Requestedby = emp.EmpID
diff --git a/app/Views/addEmployee.php b/app/Views/addEmployee.php
index 936c609f..bfd19d4a 100644
--- a/app/Views/addEmployee.php
+++ b/app/Views/addEmployee.php
@@ -394,7 +394,7 @@ function onlyAlphabets(evt) {
function validatePF() {
- var regpf = /^([a-zA-Z]){5}([0-9]){17}$/;
+ var regpf = /^\d{12}$/;
var PF = $('#pfno').val();
@@ -906,44 +906,7 @@ legend {
-
| Paid Leave | Days Worked | Absent | +Total Sunday | Paid_Leave)){echo number_format($a->Paid_Leave,2,'.','.');}else{echo "0.00";}?> | Days_Worked)){echo $a->Days_Worked;}else{echo "0.00";}?> | Absent)){echo $a->Absent;}else{echo "0.00";}?> | +@@ -428,29 +430,28 @@ $currentday = date('d'); //alert(s); if(s == 0){ - resetFinalValues(); + + resetFinalValues(); var Totalnoofdays = ; var alldata = $("#attendance").tableToJSON(); - // alert(JSON.stringify(alldata)); alldata=JSON.stringify(alldata); - // alert(alldata); var month = $('#month').val(); var currentmonth = month.substr(0,3); var currentyear = month.substr(4,4); - // alert(currentyear); + var montharray = ["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"]; - var currentmonth = jQuery.inArray(currentmonth,montharray);//!== -1 - currentmonth++; + var currentmonth = jQuery.inArray(currentmonth,montharray);//!== -1 + currentmonth++; - //alert(currentmonth); - var currentdate = '01-'+currentmonth+'-'+currentyear; + + var currentdate = '01-'+currentmonth+'-'+currentyear; var totaldata = 0; $('.content').loader('show'); $.ajax({ - data:{param1:alldata,param2:currentdate,param3:Totalnoofdays}, + data:{param1:alldata,param2:currentdate,param3:Totalnoofdays}, //dataType:"json", type:"POST", url:"monthlypay/saveAttendance", @@ -643,11 +644,13 @@ function myFunction(p,i,v) var totalworkingHrs=0; + var sundayWorkingHr=0; var totalOTHrs = 0; var paidleave = 0; var totalDaysWorked=0; var absent = 0; var sundays = ; + var sundaysArray = ; var publicholidays = ; var totaldays = ; @@ -681,12 +684,30 @@ function myFunction(p,i,v) var str1 = str.substr(-1); var str2 = str.substr(-2); var str3 = str.substr(-3); + + + if(str1 == 'W') { - var current = value.textContent == '' ? 0:parseFloat(value.textContent); - totalworkingHrs += current; + sundayValidation = false; + let dateInt = +str3.replace(/\D/g, ''); + sundaysArray.forEach(element => { + if(+element == dateInt){ + sundayValidation = true; + var current = value.textContent == '' ? 0:parseFloat(value.textContent); + sundayWorkingHr += current; + + } + }); + + if(sundayValidation == false){ + var current = value.textContent == '' ? 0:parseFloat(value.textContent); + totalworkingHrs += current; + } + if(current == 0){absent++;} + } else { @@ -702,28 +723,29 @@ function myFunction(p,i,v) // break; }); - + // if(paidleave == 1 ) // { // absent = 0; // alert('if'); // } - // if(paidleave == 0) - // { - // absent = 0; - // alert('else if'); - // } - // else - // { - // // absent = paidleave-0; - // // paidleave = 0; - // absent = paidleave; - // paidleave = 0; - // alert('else'); - // } + // if(paidleave == 0) + // { + // absent = 0; + // alert('else if'); + // } + // else + // { + // // absent = paidleave-0; + // // paidleave = 0; + // absent = paidleave; + // paidleave = 0; + // alert('else'); + // } + TotalOT = totalOTHrs + sundayWorkingHr; document.getElementById(totalhrsid).textContent = parseFloat(totalworkingHrs).toFixed(2);// == ''?0:parseFloat(totalworkingHrs)); - document.getElementById(totalothrsid).textContent = parseFloat(totalOTHrs).toFixed(2);// == ''?0:parseFloat(totalOTHrs)); + document.getElementById(totalothrsid).textContent = parseFloat(TotalOT).toFixed(2);// == ''?0:parseFloat(totalOTHrs)); document.getElementById(paidleaveid).textContent = parseFloat(paidleave).toFixed(2); document.getElementById(daysworkedid).textContent = parseFloat((totalworkingHrs/8)).toFixed(2); document.getElementById(absentid).textContent = parseFloat(absent).toFixed(2); diff --git a/app/Views/editEmployee.php b/app/Views/editEmployee.php index 85145b28..4826c3d1 100644 --- a/app/Views/editEmployee.php +++ b/app/Views/editEmployee.php @@ -494,7 +494,7 @@ function validateESI() { } function validatePF() { - var regpf = /^([a-zA-Z]){5}([0-9]){17}?$/; + var regpf = /^\d{12}$/; var PF = $('#pfno').val(); @@ -1198,47 +1198,6 @@ legend { - |
|---|