@ -449,6 +449,8 @@ class PayrollController extends BaseController
public function employeePayrollTransactions($paytransid)
public function employeePayrollTransactions($paytransid)
{
{
$incomeDeductionModel = new IncomeDeductionModel();
$data['paygroupid'] = $this->request->getGet('grpid');
$data['paygroupid'] = $this->request->getGet('grpid');
$data['showInitBtn'] = false;
$data['showInitBtn'] = false;
@ -457,6 +459,8 @@ class PayrollController extends BaseController
$data['initURL'] = $paytransid.'/'.$data['paygroupid'].'/'.$payTrans->paytype_id;
$data['initURL'] = $paytransid.'/'.$data['paygroupid'].'/'.$payTrans->paytype_id;
$data['paygroups'] = (new PayrollGroupModel())->findAll();
$data['paygroups'] = (new PayrollGroupModel())->findAll();
$data['incomeList'] = $incomeDeductionModel->where("is_income", 1)->findAll();
$data['deductionList'] = $incomeDeductionModel->where("is_income", 0)->findAll();
$empPayTrans = (new EmployeePayTransactionModel())->getEmpPayTransByPayGroupId($data['paygroupid']);
$empPayTrans = (new EmployeePayTransactionModel())->getEmpPayTransByPayGroupId($data['paygroupid']);
@ -482,41 +486,6 @@ class PayrollController extends BaseController
{
{
$empPayTransHTMLTable->setHeading('ID', 'Name', 'Branch', 'Basic Salary', 'Days Work', 'Gross', 'Deduction', 'Net', 'Action');
$empPayTransHTMLTable->setHeading('ID', 'Name', 'Branch', 'Basic Salary', 'Days Work', 'Gross', 'Deduction', 'Net', 'Action');
/* `emppaytrans_id`, `paytrans_id`, `company_id`, `branch_code`, `dept_id`, `job_title_id`,
`pay_group_id`, `emp_status_id`, `employee_id`, `company_issued_id`, `last_name`, `first_name`,
`middle_name`, `suffix`, `email_address`, `is_ATM`, `savings_account`, `basic_monthly_pay`, `basic_daily_pay`,
`basic_hourly_pay`, `has_cola`, `has_philhealth`, `has_hdmf`, `has_sss`, `has_gsis`, `actual_work_days`, `basic_pay`,
`gross_income`, `taxable_income`, `nontaxable_income`, `income_tax`, `total_deduction`, `taxable_deduction`, `nontaxable_deduction`,
`net_pay`, `created_at`, `created_by`, `updated_at`, `updated_by`, `deleted_at`, `paytrans_id`, `paytype_id`, `payschedule_id`, `payroll_from`,
`payroll_to`, `no_of_days`, `total_emp`, `total_gross`, `remarks`, `is_open`, `created_at`, `created_by`, `updated_at`,
`updated_by`, `deleted_at`, `branch_code`, `company_id`, `branch_name`, `address`, `contact_number`, `email_address`,
`created_at`, `created_by`, `updated_at`, `updated_by`, `deleted_at`, `dept_id`, `company_id`, `parent_dept_id`,
`department_code`, `department_name`, `created_at`, `created_by`, `updated_at`, `updated_by`, `deleted_at`, `job_title_id`,
`job_title_name`, `created_at`, `created_by`, `updated_at`, `updated_by`, `deleted_at`, `pay_group_id`, `pay_group_code`,
`pay_group_name`, `created_at`, `created_by`, `updated_at`, `updated_by`, `deleted_at`, `emp_status_id`, `status_name`,
`created_at`, `created_by`, `updated_at`, `updated_by`, `deleted_at`, `employee_id`, `company_id`, `branch_code`, `dept_id`,
`job_title_id`, `emp_status_id`, `pay_group_id`, `company_issued_id`, `last_name`, `first_name`, `middle_name`, `suffix`, `email_address`,
`contact_number`, `created_at`, `created_by`, `updated_at`, `updated_by`, `deleted_at`
[emppaytrans_id] => 30 [paytrans_id] => 1 [company_id] => 1 [branch_code] => KWSMB [dept_id] => 1 [job_title_id] => 1 [pay_group_id] => 1
[emp_status_id] => 1 [employee_id] => 1 [company_issued_id] => 1900 [last_name] => bel [first_name] => paul [middle_name] => b [suffix] =>
[email_address] => user1@yahoo.com [is_ATM] => 1 [savings_account] => 0000 [basic_monthly_pay] => 20000.0000 [basic_daily_pay] => 766.7732
[basic_hourly_pay] => 95.8466 [has_cola] => 0 [has_philhealth] => 1 [has_hdmf] => 1 [has_sss] => 1 [has_gsis] => 0 [actual_work_days] => 8.0000
[basic_pay] => 6134.1856 [gross_income] => 12268.3712 [taxable_income] => 12268.3712 [nontaxable_income] => 0.0000 [income_tax] => 370.2742
[total_deduction] => 400.0000 [taxable_deduction] => 0.0000 [nontaxable_deduction] => 400.0000 [net_pay] => 0.0000
[created_at] => 2024-09-06 06:36:22 [created_by] => 11-E128-70 [updated_at] => 2024-10-05 04:21:57 [updated_by] => 11-E128-70 [deleted_at] =>
[paytype_id] => 1 [payschedule_id] => 1 [payroll_from] => 2024-10-03 [payroll_to] => 2024-10-10 [no_of_days] => 8 [total_emp] => 0 [total_gross] => 0.0000
[remarks] => [is_open] => 1 [branch_name] => Karat World SM City Bacolod [address] => Bacolod City [contact_number] => 000 [parent_dept_id] => 0
[department_code] => HR [department_name] => Human Resources [job_title_name] => HR Personnel [pay_group_code] => VIS [pay_group_name] => Visayas Group
[status_name] => AWOL
[emppaytransinded_id] => 16 [emppaytrans_id] => 30 [inded_id] => 1 [payslip_display] => SSS Contribution [inded_name] => SSS
[coa_code] => [is_income] => 0 [is_taxable] => 0 [include_in_gross] => 0 [is_fixed_amt] => 1 [is_percent_amt] => 0
[amount] => 300.0000 [base_amount] => 300.0000 [is_override] => 0 [created_at] => 2024-09-13 09:34:54 [created_by] => 11-E128-70
[updated_at] => [updated_by] => [deleted_at] => */
foreach($empPayTrans as $trans)
foreach($empPayTrans as $trans)
{
{
//$iconView = '< a href = "#" class = "ml-3" data-toggle = "tooltip" title = "View Information" onclick = "showEmpPayTransDetails('.$trans->emppaytrans_id.')" > < i class = "fas fa-eye " > < / i > < / a > ';
//$iconView = '< a href = "#" class = "ml-3" data-toggle = "tooltip" title = "View Information" onclick = "showEmpPayTransDetails('.$trans->emppaytrans_id.')" > < i class = "fas fa-eye " > < / i > < / a > ';
@ -656,4 +625,68 @@ class PayrollController extends BaseController
return redirect()->back()->withInput()->with('message', 'Days worked updated.');
return redirect()->back()->withInput()->with('message', 'Days worked updated.');
}
}
public function addEmpPayTransIncomeDeduction()
{
$empPayTransInDed = new EmpPayTransIncomeDeduction();
$empPayTransInDedModel = new EmpPayTransIncomeDeductionModel();
$empPayTransactionModel = new EmployeePayTransactionModel();
$incomeDeductionModel = new IncomeDeductionModel();
$rawData = $this->request->getPost();
// Initialize all payroll type fields to 0
$rawData['is_fixed_amt'] = 0;
$rawData['is_percent_amt'] = 0;
// Handle radio button input
if (isset($rawData['amount_type'])) {
switch ($rawData['amount_type']) {
case 'fixed':
$rawData['is_fixed_amt'] = 1;
break;
case 'perc':
$rawData['is_percent_amt'] = 1;
break;
}
}
$rawData['is_override'] = isset($rawData['is_override']) ? 1 : 0;
$empPayTrans = $empPayTransactionModel->find($rawData['emppaytrans_id']);
$incomeDeduction = $incomeDeductionModel->find($rawData['inded_id']);
$amount = $rawData['is_fixed_amt'] ? $rawData['amount'] : ($rawData['amount'] / 100) * $empPayTrans->basic_pay;
$empPayTransInDed->fill(
['emppaytrans_id' => $rawData['emppaytrans_id'],
'inded_id' => $rawData['inded_id'],
'payslip_display' => $incomeDeduction->payslip_display,
'inded_name' => $incomeDeduction->inded_name,
'coa_code' => $incomeDeduction->coa_code,
'is_income' => $incomeDeduction->is_income,
'is_taxable' => $incomeDeduction->is_taxable,
'include_in_gross' => $incomeDeduction->include_in_gross,
'is_fixed_amt' => $rawData['is_fixed_amt'],
'is_percent_amt' => $rawData['is_percent_amt'],
'amount' => $amount,
'base_amount' => $rawData['amount'],
'is_override' => $rawData['is_override']]
);
if($empPayTransInDedModel->save($empPayTransInDed))
return redirect()->back()->with('message', 'Income or Deduction Added');
else
return redirect()->back()->withInput()->with('error', 'Failed to add income or deduction');
}
public function deleteEmpPayTransIncomeDeduction($emppaytransindedid)
{
$empPayTransInDedModel = new EmpPayTransIncomeDeductionModel();
if($empPayTransInDedModel->delete($emppaytransindedid))
return redirect()->back()->with('message', 'Income or Deduction Deleted');
else
return redirect()->back()->with('error', 'Failed to delete income or deduction');
}
}
}