#!/usr/bin/perl
use CGI;
my $q = new CGI();
print $q->header();
print `cat header.html`;
my $years = 3;
my $salary = 25000;
my $increase = 0.03;
if ($q->param("years")) {
$years = $q->param("years");
$salary = $q->param("salary");
$increase = scalar($q->param("increase"))/100;
}
print < Pre 1998, I've assumed the student borrows £2,000 (approximately
half the living costs of the student) with the other half having been
provided by a grant. They then pay this back in exactly five years once
their salary exceeds £26,000. This is an inflation adjusted
version of the scheme that was in place at the time. The scheme did
change thresholds yearly with inflation so this is a fairly true
reflection. 1998 - 2005, I've assumed that the student borrows £4,000 for
living costs and £1,000 for fees and pays back at 9% of their
salary above £15,000. Inflation adjusting doesn't work properly in
this case because the threshold doesn't change with inflation, the
living costs do and the fees obey different rules entirely. This figure
is definitely wrong, but the amount wrong depends on exactly which year
the student studied. 2005 - 2010, This is the same as the case for 1998 - 2005 but with
fees of £3,000. The same criticism applies. 2011 onwards, I've assumed the student borrows £4,000 for
living costs and £6,000 for fees. They repay at 9% of their salary
over £21,000, but when their salary is in excess of £21,000
the loan incurs an interest rate of 3%. These calculations account for inflation because a simple model of
inflation should treat salary and loan as rising at the same rate. I've calculated Tax and NI using figures from the inland revenues
site,
";
print "
";
print < ";
#Each of the schemes,
#Pre 1998
#Borrowed 2000/year for maintenance
#Repayments in 5 years
#Threshold 26k
my $loan1998 = 2000 * $years;
#1998-2005
#Borrowed 4000/year for mainance + 1000 for fees
#9% of salary above 15k
my $loan2005 = 5175 * $years;
#2006-2010
#Borrowed 4000/year for maintanence + 3000/year for fees
#9% of salary above 15k
my $loan2010 = 7000 * $years;
#2011+
#Borrowed 4000/year for mainteancen + 6000/year for fees
#9% of salary above 21k
#interest 3% above inflation when salary is over 21k
my $loan2011 = 10000 * $years;
my $repaid1998 = 0;
my $repaid2005 = 0;
my $repaid2010 = 0;
my $repaid2011 = 0;
for (my $age = (18 + $years + 1); $age <= 50; $age++) {
if ($age % 2 == 0) {
print "Age Gross Salary
Employers NI NI Tax Net pay
Loan repaid
(pre
1998)Loan repaid
(1998-2005)Loan
repaid
(2006-2010)Loan repaid
(2011+)"
}
else {
print " ";
}
print " \n";
#Payrise
$salary += ($salary * $increase);
}
print "$age ";
print "" . int($salary) . " ";
#Approximate tax NI
#allowance 6475
# 20% of the next 37400
# 40% of the next 56125
# 60% of the next 12950
# 40% of the next 37050
# 50% thereafter
# NI
# LEL 5044
# 11% to 40040
# 1% over
# Employers NI
# LEL 5044
# 12.5% over this
my $net = 0;
my $tax = 0;
my $ni = 0;
my $eni = 0;
#Tax
if ($salary > 6475) {
if ($salary > (37400 + 6475)) {
if ($salary > (37400 + 6475 + 56125)) {
if ($salary > (37400 + 6475 + 56125 + 12950)) {
if ($salary > (37400 + 6475 + 56125 + 12950 + 37050)) {
$tax += ($salary - 37400 - 6475 - 56125 - 12950 - 37050) * 0.5;
$tax += 37050 * 0.4;
}
else {
$tax += ($salary - 37400 - 6475 - 56125 - 12950) * 0.4;
}
$tax += 12950 * 0.6;
}
else {
$tax += ($salary - 56125 - 37400 - 6475) * 0.6;
}
$tax += 56125 * 0.4
}
else {
$tax += ($salary - 37400 - 6475) * 0.4;
}
$tax += (37400 * 0.2);
}
else {
$tax += ($salary - 6475) * 0.2;
}
}
#NI
if ($salary > 5720) {
$eni += ($salary - 5720) * .125;
if ($salary > 38168 + 5720) {
$ni += 38168 * .11;
$ni += ($salary - 38168 - 5720) * 0.01;
}
else {
$ni += ($salary - 5720) * 0.11;
}
}
print "" . int($eni) . " ";
print "" . int($ni) . " ";
print "" . int($tax) . " ";
print "" . int($salary - $ni - $tax) . " ";
#Work out the repayments
#pre 1998
if (($salary > 26000) && (($loan1998-1) >= $repaid1998)) {
$repaid1998 += $loan1998/5;
}
print "$repaid1998 \n";
#1998-2005
if (($salary > 15000) && (($loan2005) >= $repaid2005)) {
my $repayment = ($salary - 15000) * 0.09;
if ($repayment > (($loan2005-$repaid2005))) {
$repaid2005 = $loan2005;
}
else {
$repaid2005 += $repayment;
}
}
print "" . int($repaid2005) . " ";
#2005-2010
if (($salary > 15000) && (($loan2010) >= $repaid2010)) {
my $repayment = ($salary - 15000) * 0.09;
if ($repayment > (($loan2010-$repaid2010))) {
$repaid2010 = $loan2010;
}
else {
$repaid2010 += $repayment;
}
}
print "" . int($repaid2010) . " ";
#2011
if (($salary > 21000) && (($loan2011) >= $repaid2011)) {
#Interest
$loan2011 += (($loan2011-$repaid2011) * 0.03);
my $repayment = ($salary - 21000) * 0.09;
if ($repayment > (($loan2011-$repaid2011))) {
$repaid2011 = $loan2011;
}
else {
$repaid2011 += $repayment;
}
}
print "" . int($repaid2011) . " ";
print "
#Approximate tax & NI
#allowance 6475
# 20% of the next 37400
# 40% of the next 56125
# 60% of the next 12950
# 40% of the next 37050
# 50% thereafter
# NI
# LEL 5720
# 11% to 38168
# 1% over
# Employers NI
# LEL 5720
# 12.5% over this
These figures disagree slightly with Listen To Taxman who's
almost certainly got the calculation right, but I'm not quite sure why.
Requests for source code, comments, whinges, flames etc. pete\@ex-parrot.com.
EOF ; print `cat footer.html`;