You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
kwpayroll/app/ClassLib/PayrollComputation.php

66 lines
2.0 KiB
PHTML

<?php
namespace App\ClassLib;
class PayrollComputation
{
public array $workdays_type = [
'261.0000' => 'No work and not paid on Sat and Sun or RD',
'313.0000' => 'No work and not paid on Sun or RD',
'365.0000' => 'No work but paid on RD, Reg. &amp; Special Holidays',
'392.5000' => 'Has work including RD, Reg. &amp; Special Holidays',
];
public array $basic_salary_computations = [
'DAILY' => 'Rate Based on Daily Hrs Worked',
'SEMIMONTHLY' => 'Apply Semi-Monthly Rate',
'MONTHLY' => 'Apply Monthly Rate'
];
public function __construct()
{
}
public function computeIncomeTax($grossTaxableIncome)
{
$tax = 0;
if($grossTaxableIncome <= 10417)
{
$tax = 0;
}
else if($grossTaxableIncome <= 16666)
{
$tax = ($grossTaxableIncome - 10417) * 0.15;
}
else if($grossTaxableIncome <= 33332)
{
$tax = (($grossTaxableIncome - 16667) * 0.20) + 937.50;
}
else if($grossTaxableIncome <= 83332)
{
$tax = (($grossTaxableIncome - 33333) * 0.25) + 4270.70;
}
else if($grossTaxableIncome <= 333332)
{
$tax = (($grossTaxableIncome - 83333) * 0.30) + 16770.70;
}
else
{
$tax = (($grossTaxableIncome - 333333) * 0.35) + 91770.70;
}
return $tax;
}
// rawData should contain is_fixed_amt, is_percent_amt, worked_days_based and amount
// $empPayTrans is from EmployeePayTransactionModel();
public function computeIncomeDeductionByComputationType($rawData, $empPayTrans)
{
$amount = 0;
if($rawData['is_fixed_amt']) $amount = $rawData['amount'];
else if($rawData['is_percent_amt']) $amount = ($rawData['amount'] / 100) * $empPayTrans->basic_pay;
else if($rawData['worked_days_based']) $amount = $rawData['amount'] * $empPayTrans->actual_work_days;
return $amount;
}
}