From 7f4461ae98a68d36954a69f488c21bd2b6898040 Mon Sep 17 00:00:00 2001 From: bitbucket Date: Tue, 20 Aug 2024 16:41:38 +0530 Subject: [PATCH] GWM : merge loan module --- app/Controllers/Emppaydate.php | 145 +-------- app/Controllers/Payslip.php | 4 +- app/Models/Emppaydate_model.php | 7 +- app/Models/Payroll_model.php | 6 +- app/Views/addemppaydate.php | 543 ++++++++++++-------------------- app/Views/editOldemppay.php | 127 +------- app/Views/emppayListing.php | 45 ++- app/Views/monthlypayinputs.php | 2 +- 8 files changed, 247 insertions(+), 632 deletions(-) diff --git a/app/Controllers/Emppaydate.php b/app/Controllers/Emppaydate.php index f07b98f9..8484b079 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(); - + // dd($data['userRecords']); $this->global['pageTitle'] = 'Employee Pay 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'; @@ -90,69 +82,27 @@ 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/Payslip.php b/app/Controllers/Payslip.php index 6b5f903d..7e4d2d32 100644 --- a/app/Controllers/Payslip.php +++ b/app/Controllers/Payslip.php @@ -601,7 +601,6 @@ class Payslip extends BaseController } - //$totalSalary = $currentDayBasic + $currentDayHra + $totSalayOT; if ($value->esi_applicable == 1) { $esiAmount = $currentDayBasic * $ESI_Rate / 100; } else { $esiAmount = 0; } @@ -633,8 +632,7 @@ class Payslip extends BaseController $data['pf'] = $pf; $data['over_time'] = $ot; - - //echo sizeof($data['fresh'])."-".sizeof($data['empSalary']);die; +// dd($data); $this->global['pageTitle'] = 'Payroll Monthly Inputs'; $this->loadViews("monthlypayinputs", $this->global, $data, NULL); } diff --git a/app/Models/Emppaydate_model.php b/app/Models/Emppaydate_model.php index 33968517..cd81431f 100644 --- a/app/Models/Emppaydate_model.php +++ b/app/Models/Emppaydate_model.php @@ -15,9 +15,10 @@ 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') + ->join('t_emp_pay_data','t_loan_master.EmpID = t_emp_pay_data.EmpID'); $query =$builder->get(); $result = $query->getResult(); return $result; 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/Views/addemppaydate.php b/app/Views/addemppaydate.php index 09e0fcf3..835df076 100644 --- a/app/Views/addemppaydate.php +++ b/app/Views/addemppaydate.php @@ -1,25 +1,30 @@ @@ -27,293 +32,151 @@ $("#due_started").datepicker({
-

Add Employee Pay

+
+

Add Employee Pay

+
- +
-
- Back -
-
+
+ Back +
+
- - + +
- + - -
- + + +
-
- Pay Details -
-
- - - - - + + + + + +
+ Loan Details +
+ +
+
- Employee ID* + Employee ID + *
- - 'Select Employee'); if(!empty($empdetails)){ - foreach($empdetails as $emp){ $EmpID=$emp->EmpID; - $Employee+= array($EmpID => $emp->EmpID . "-" . $emp->FirstName . "-" . $emp->LastName); - // $Employee = array_merge($Employee,$Employee1); + $Employee+= array($EmpID => $emp->EmpID . "-" . $emp->FirstName); + } } - //$data=array('name'=>'EmpID','value'=>$Employee,'id'=>'EmpID','class' => 'form-control'); + $js = array('id'=> 'emp'); - echo form_dropdown('EmpID', $Employee,set_value('EmpID'),'class="form-control"',$js); - //echo form_dropdown($data); - - ?> -
+ echo form_dropdown('EmpID', $Employee,set_value('EmpID'),'class="form-control"',$js); + + ?> +
-
-
- Total Salary* -
- 'Total_salary','id' => 'Total_salary','value' => set_value('Total_salary'),'pattern' => '([0-9]{1,8}([.][0-9]{1,2})?)', 'class' => 'form-control num', 'style'=>'text-transform:uppercase;','title' => 'Enter Valid Total salary Amount,Minimum Four Digit Positive Number','onchange'=>'calculalteHRA();'); - echo form_input($data); - ?> -
-
-
-
-
- Basic Pay* -
- 'Basic_Pay','id' => 'Basic_Pay','value' => set_value('Basic_Pay'),'pattern' => '[0-9]{4,6}', 'class' => 'form-control num', 'style'=>'text-transform:uppercase;','title' => 'Enter Valid Basic Pay Amount,Minimum Four Digit Positive Number','readonly'=>'readonly'); - echo form_input($data); - ?> -
-
-
-
-
- HRA Rate(%)* - -
- 'HRA_Rate','id'=>'HRA_Rate','value' => set_value('HRA_Rate'), 'class' => 'form-control num','style'=>'text-transform:uppercase;','pattern'=>'([0-9]{1,2}([.][0-9]{1,2})?)', 'title'=>'Enter the Valid HRA Rate,Minimum 1 digit,Maximum 2 digit','onfocusout'=>'validateHRA();','onchange'=>'calculalteHRA();'); - echo form_input($data); - ?> -
-
-
- - -
- -
- - -
-
- HRA Amount* - -
- 'HRA_Amount','id'=>'HRA_Amount','value' => set_value('HRA_Amount'), 'class' => 'form-control num','style'=>'text-transform:uppercase;','readonly'=>'readonly'); - echo form_input($data); - ?> -
-
-
- - -
-
- Allowances* -
- 'Allowances','value' => set_value('Allowances'), 'class' => 'form-control num' ,'style'=>'text-transform:uppercase;','pattern'=>'([0-9]{1,5}([.][0-9]{1,2})?)','title'=>'Enter the Valid Allowances,Minimum 1 digit , Maximum 5 digit '); - echo form_input($data); - ?> -
-
-
- -
-
- PF Rate(%)* - -
- 'PF_Rate','value' => set_value('PF_Rate'),'class' => 'form-control num' ,'style'=>'text-transform:uppercase;','pattern'=>'([0-9]{1,2}([.][0-9]{1,2})?)', 'title'=>'Enter the valid PF Rate,Minimum 1 digit,Maximum 2 digit'); - echo form_input($data); - ?> -
-
-
- -
-
- ESI Rate(%)* -
- 'ESI_Rate','value' => set_value('ESI_Rate'), 'class' => 'form-control num' ,'style'=>'text-transform:uppercase;','pattern'=>'([0-9]{1,2}([.][0-9]{1,2})?)','title'=>'Enter the Valid ESI Rate,Minimum 1 digit,Maximum 2 digit'); - echo form_input($data); - ?> -
-
-
- -
- -
- - - - -
-
- Food Allowances(Per Day)* -
- 'Food_Allowances','value' => set_value('Food_Allowances'), 'class' => 'form-control num','pattern'=>'([0-9]{1,3}([.][0-9]{1,2})?)','onfocusout'=>'validateFood();', 'title'=>'Enter the Valid Food Allowances,Minimun 1 Digit,Maximum 3 Digit'); - echo form_input($data); - ?> -
-
-
- -
-
- Incentives* -
- 'Incentives','value' => set_value('Incentives'), 'class' => 'form-control num' ,'style'=>'text-transform:uppercase;','pattern'=>'([0-9]{1,5}([.][0-9]{1,2})?)','title'=>'Enter the Valid Allowances,Minimum 1 digit , Maximum 5 digit '); - echo form_input($data); - ?> -
-
-
-
- - - - - - - - - - -
- Loan Details -
- -
- Loan Amount - -
+ Loan Amount + +
- - - -
-
-
- Loan Issue(d) Date - -
-
-
- + +
- Monthly Due - -
+ Loan Issue(d) Date + +
-
+ + +
- Due Started - -
+ Monthly Due + +
-
+
- No Of Due(s) - -
+ Due Started + +
-
+
- Paid Amount - -
+ No Of Due(s) + +
- - +
+
+
+ Paid Amount + +
+
- - - + + +
+ + +
- - + + - +
@@ -325,7 +188,7 @@ $("#due_started").datepicker({ ?>
- getFlashdata('error'); ?> + getFlashdata('error'); ?>
getFlashdata('success'); ?>
- +
- listErrors('
', '
'); ?>
+ listErrors('
', '
'); ?> +
- + - - - + + + + - - - - + \ No newline at end of file diff --git a/app/Views/editOldemppay.php b/app/Views/editOldemppay.php index ca07d088..c6f39ee9 100644 --- a/app/Views/editOldemppay.php +++ b/app/Views/editOldemppay.php @@ -145,7 +145,7 @@ if(!empty($emppay))

-
Edit Salary Payment Details
+
Edit Loan Details

@@ -165,15 +165,15 @@ if(!empty($emppay))
-
- Pay Details + + +
+ Loan Details
-
+ +
- - - - +
@@ -182,117 +182,6 @@ if(!empty($emppay))
- -
-
-
- Employee Name - -
-
-
- -
-
-
- Total Salary* - -
-
-
-
-
-
- Basic Pay* - -
-
-
-
- - -
-
-
-
- HRA_Rate(%)* - -
-
-
-
-
-
- HRA_Amount* - -
-
-
- - -
-
-
- Allowances* - -
-
-
-
-
-
- PF_Rate(%)* - -
-
-
- - -
- - - - -
- - - - - -
-
-
- ESI_Rate(%)* - -
-
-
- -
-
-
- Food Allowances(Per Day)* - -
-
-
- - -
-
-
- Incentives* - -
-
-
-
- -
- Loan Details -
- -
diff --git a/app/Views/emppayListing.php b/app/Views/emppayListing.php index f0e61a7e..855274d6 100644 --- a/app/Views/emppayListing.php +++ b/app/Views/emppayListing.php @@ -4,14 +4,14 @@

-
Employee Salary Details
+
Employee Loan Details

@@ -25,17 +25,15 @@ - - - - - - - - - - - + + + + + + + + + @@ -49,18 +47,17 @@ { ?> - - + - - - - - - - - - + + + + + + + + diff --git a/app/Views/monthlypayinputs.php b/app/Views/monthlypayinputs.php index 7b90550a..df8f1a5f 100644 --- a/app/Views/monthlypayinputs.php +++ b/app/Views/monthlypayinputs.php @@ -270,7 +270,7 @@ $('html').bind('keypress', function(e)
Emp IDEmp Name Total Sal in ₹Basic Pay in ₹HRA Rate in %HRA Amt in ₹Allowances in ₹PF Ratein %ESI Rate in %Food Allow in ₹Employee Total Sal in ₹ Loan Amt in ₹ Loan Issued Date Monthly Due Amt in ₹ No Of Dues Paid Dues Remaining Dues Paid Amt in ₹ Action
EmpID ?>FirstName ." ". $record->LastName?>EmpID ?>-FirstName;?> TotalSalary; ?>Basic_Pay ?>HRA_Rate ?>HRA_Amount; ?>Allowances ?>PF_Rate ?>ESI_Rate ?>Food_Allowances ?> + Loan_Amount; ?>Loan_Issued_Date; ?>Monthly_Due; ?>No_of_Dues; ?>Paid_Due; ?>Remaining_Due; ?>Paid_Amount; ?> EDIT
Key) && !empty($record->Loan_ID)){ echo "contenteditable='true'; style='background-color:#ffcccc;text-align:right' title='Loan Pending'"; } ?> Key)){?> title="Payslip Calculated" style="text-align:right;color:blue;"style="text-align:right;" > Loan_Recovered)) - {if(is_numeric($record->Loan_Recovered)){echo number_format($record->Loan_Recovered,2,'.',''); $totalmanualoan[] = $record->Loan_Recovered;}else {echo $record->Loan_Recovered; $totalmanualoan[] = $record->Loan_Recovered;}}else{echo number_format(0.00,2,'.','');} ?> + {if(is_numeric($record->Loan_Recovered)){echo number_format($record->Loan_Recovered,2,'.',''); $totalmanualoan[] = $record->Loan_Recovered;}else {echo $record->Loan_Recovered; $totalmanualoan[] = $record->Loan_Recovered;}}else{echo number_format(0.00,2,'.',''); $totalmanualoan[] = 0;} ?>