Created
October 11, 2023 19:46
-
-
Save felixivance/a96a4eb516b916a3a38b8405b38f6e32 to your computer and use it in GitHub Desktop.
KENYA PAYE CALCULATOR FORMULA IN PHP
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public function calculatePayee($salaryAmount, $nssfAmount){ | |
$tax = 0; | |
$remaining = $salaryAmount - $nssfAmount; | |
if($remaining > 24000){ | |
$tax += 24000 * (10/100); | |
$remaining -= 24000; | |
if($remaining > 0){ | |
$amountToTax = ($remaining < 8333) ? $remaining : 8333 ; | |
$tax += $amountToTax * (25/100); | |
$remaining -= $amountToTax; | |
} | |
if($remaining > 0){ | |
$amountToTax = ($remaining < 467667) ? $remaining : 467667 ; | |
$tax += $amountToTax * (30/100); | |
$remaining -= $amountToTax; | |
} | |
if($remaining > 0){ | |
$amountToTax = ($remaining < 300000) ? $remaining : 300000 ; | |
$tax += $amountToTax * (32.5/100); | |
$remaining -= $amountToTax; | |
} | |
if($remaining > 0){ | |
$tax += $remaining * (35/100); | |
$remaining = 0; | |
} | |
} | |
return $tax; | |
} |
Javascript Code
function calculatePayee(salaryAmount, nssfAmount) {
let tax = 0;
let remaining = salaryAmount - nssfAmount;
if (remaining > 24000) {
tax += 24000 * (10 / 100);
remaining -= 24000;
if (remaining > 0) {
let amountToTax = (remaining < 8333) ? remaining : 8333;
tax += amountToTax * (25 / 100);
remaining -= amountToTax;
}
if (remaining > 0) {
let amountToTax = (remaining < 467667) ? remaining : 467667;
tax += amountToTax * (30 / 100);
remaining -= amountToTax;
}
if (remaining > 0) {
let amountToTax = (remaining < 300000) ? remaining : 300000;
tax += amountToTax * (32.5 / 100);
remaining -= amountToTax;
}
if (remaining > 0) {
tax += remaining * (35 / 100);
remaining = 0;
}
}
return tax;
}
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
PAYE rates in effect from 1 July 2023:[1]
PAYE rates in effect from 1 July 2023:[1]
Monthly Taxable Pay (Ksh) Annual Taxable Pay (Ksh) Rate of Tax (%)
Up to 24,000 Up to 288,000 10.0
24,001 - 32,333 288,001 - 388,000 25.0
32,334 - 500,000 388,001 - 6,000,000 30.0
500,001 - 800,000 6,000,001 - 9,600,000 32.5
Above 800,000 Above 9,600,000 35.0