Tax Calculator


[insert_php]
global $yeardata;

$yeardata = array(
array(“2017/2018”,11500,33500,0.2,33500,0,0.4,8164,45000,0.09,0.02),
array(“2016/2017”,11000,32000,0.2,107000,0.4,0.45,8060,43000,0.09,0.02),
array(“2015/2016”,10600,31785,0.2,107525,0.4,0.45,8060,42385,0.09,0.02),
array(“2014/2015”,10000,31865,0.2,31865,0,0.4,7956,41865,0.09,0.02),
array(“2013/2014”,9440,32010,0.2,32010,0,0.4,7755,41450,0.09,0.02),
array(“2012/2013”,8105,34370,0.2,34370,0,0.4,7605,42475,0.09,0.02),
);

function RenderForm($taxyear, $grosspay, $expenses, $taxpaid, $payeincome, $payetaxpaid)
{

echo “

“;

echo “

“;
echo “

“;
echo “

“;
echo “

“;
echo “

“;

echo “

“;
echo “

“;
echo “

“;

echo “

“;
echo “

“;
echo “

“;

echo “

“;
echo “

“;
echo “

“;

echo “

“;
echo “

“;
echo “

“;
echo “

“;
echo “

“;

echo “

“;
echo “

“;
echo “

“;
echo “

“;
echo “

“;

echo “

“;
echo “

“;
echo “

“;

echo “

“;
echo “

“;
echo “

“;
echo “

“;
echo “

“;
echo “

“;

echo “

“;
echo “

“;
echo “

“;

echo “

“;
echo “

“;
echo “

“;

echo “

“;
echo “

“;
echo “

“;

echo “

“;
echo “

“;
echo “

“;
echo “

“;
echo “

“;

echo “

“;
echo “

“;
echo “

“;
echo “

“;
echo “

“;

echo “

“;
echo “

“;
echo “

“;

echo “

“;
echo “

“;
echo “

“;
echo “

“;
echo “

“;

echo “

“;
echo “Tax Year”;
echo “
“;
echo ““;
echo “
“;
echo ““;
echo “
“;
echo ““;
echo “
“;
echo “Self Employment/CIS”;
echo “
“;
echo ““;
echo “
“;
echo “Gross Income”;
echo “
“;
echo ““;
echo “
“;
echo “Expenses”;
echo “
“;
echo ““;
echo “
“;
echo ““;
echo “
“;
echo ““;
echo “
“;
echo ““;
echo “
“;
echo “Tax Paid”;
echo “
“;
echo ““;
echo “
“;
echo ““;
echo “
“;
echo “PAYE/Other”;
echo “
“;
echo ““;
echo “
“;
echo “Gross Pay”;
echo “
“;
echo ““;
echo “
“;
echo “Tax Paid”;
echo “
“;
echo ““;
echo “
“;
echo ““;
echo “
“;
echo ““;
echo “
“;
echo ““;
echo “
“;
echo ““;
echo “
“;
echo ““;
echo “
“;
echo ““;
echo “

“;

}

$error=””;

if (!isset($_POST[‘Clear’]))
{
$taxyear = isset($_POST[‘taxyear’]) ? trim($_POST[‘taxyear’]) : ”;
$grosspay = isset($_POST[‘grosspay’]) ? trim($_POST[‘grosspay’]) : ”;
$expenses = isset($_POST[‘expenses’]) ? trim($_POST[‘expenses’]) : ”;
$taxpaid = isset($_POST[‘taxpaid’]) ? trim($_POST[‘taxpaid’]) : ”;
$payeincome = isset($_POST[‘payeincome’]) ? trim($_POST[‘payeincome’]) : ”;
$payetaxpaid = isset($_POST[‘payetaxpaid’]) ? trim($_POST[‘payetaxpaid’]) : ”;
}

if (isset($_POST[‘Calculate’]))
{

foreach($yeardata as $yearitem)
{
if ($yearitem[0] == $taxyear)
{
$allowance = $yearitem[1];
$firstTaxableAmount = $yearitem[2];
$firstTaxRate = $yearitem[3];
$secondTaxableAmount = $yearitem[4];
$secondTaxRate = $yearitem[5];
$remainingTaxRate = $yearitem[6];
$niLowerAnnualLimit = $yearitem[7];
$niUpperAnnualLimit = $yearitem[8];
$niMainRate = $yearitem[9];
$niAdditionalRate = $yearitem[10];
break;
}
}

$floatgrosspay = floatval($grosspay);
$floattaxpaid = floatval($taxpaid);
$floatgrosspayeincome = floatval($payeincome);
$floatpayetaxpaid = floatval($payetaxpaid);

$taxable = ($grosspay + $payeincome) – $expenses – $allowance;

$taxable1 = ($grosspay + $payeincome) – $expenses – $allowance;
$nitaxable = $grosspay- $expenses;

$tax2Pay = 0;
if ($taxable > 0)
{
if ($taxable >= $firstTaxableAmount)
{
$tax2Pay = $firstTaxableAmount * $firstTaxRate;
$taxable = $taxable – $firstTaxableAmount;
}
else
{
$tax2Pay = $taxable * $firstTaxRate;
$taxable = 0;
}

if ($taxable >= $secondTaxableAmount)
{
$tax2Pay += (($secondTaxableAmount + $allowance) * $secondTaxRate);
$taxable = $taxable – $secondTaxableAmount;
}
else
{
$tax2Pay += $taxable * $secondTaxRate;
$taxable = 0;
}

if ($taxable>0)
{
$tax2Pay += ($taxable * $remainingTaxRate);
}
}

$ni2Pay = 0;
if ($nitaxable > $niLowerAnnualLimit)
{
if ($nitaxable < $niUpperAnnualLimit) $ni2Pay = ($nitaxable - $niLowerAnnualLimit) * $niMainRate; else { $ni2Pay = ($niUpperAnnualLimit - $niLowerAnnualLimit) * $niMainRate; $ni2Pay += ($nitaxable - $niUpperAnnualLimit) * $niAdditionalRate; } } $difference = ($floattaxpaid + $floatpayetaxpaid) - $tax2Pay; $difference -= $ni2Pay; if ($difference < 0) { $error = "
You’ve underpaid tax. Additional tax to pay:    £”.floatval($difference * -1).”“;
}
else
{
$error = “
Tax Refund amount   £”.floatval($difference);
}
}

[/insert_php]

Tax Return Calculator

[insert_php]

RenderForm($taxyear, $grosspay, $expenses, $taxpaid, $payeincome, $payetaxpaid);
echo “taxyear: “.$taxyear.”
“;
echo “allowance: “.$allowance.”
“;
echo “firstTaxableAmount: “.$firstTaxableAmount.”
“;
echo “firstTaxRate: “.$firstTaxRate.”
“;
echo “secondTaxableAmount: “.$secondTaxableAmount.”
“;
echo “secondTaxRate: “.$secondTaxRate.”
“;
echo “remainingTaxRate: “.$remainingTaxRate.”
“;
echo “niLowerAnnualLimit: “.$niLowerAnnualLimit.”
“;
echo “niUpperAnnualLimit: “.$niUpperAnnualLimit.”
“;
echo “niMainRate: “.$niMainRate.”
“;
echo “niAdditionalRate: “.$niAdditionalRate.”
“;
echo “payeincome: “.$payeincome.”
“;
echo “grosspay: “.$grosspay.”
“;
echo “taxpaid: “.$taxpaid.”
“;
echo “payeincome: “.$payeincome.”
“;
echo “payetaxpaid: “.$payetaxpaid.”
“;
echo “taxable: “.$taxable.”
“;
echo “taxable1: “.$taxable1.”
“;
echo $taxable.”= (grosspay:”.$grosspay.” + payeincome:”.$payeincome.”) – expenses:”.$expenses.” – allowance:”.$allowance.”
“;
echo $error;

[/insert_php]

This Calculator is for Self-employed and PAYE employee. If you are just PAYE and have more than 1 job use this calculator HERE