NAME
Algorithm::NIN - Interface to UK National Insurance Number.
VERSION
Version 1.03
DESCRIPTION
This modules lets you validate UK National Insurance number. This also has functionalities to format and calculate the NI.
METHODS
validate()
This method accepts National Insurance number and validate it against the UK format. For more information please visit http://en.wikipedia.org/wiki/National_Insurance_UK
use strict; use warnings;
use Algorithm::NIN;
my ($ni, $status);
$ni = 'AA123456C';
$status = Algorithm::NIN::validate($ni);
# or
$ni = 'AA 12 34 56 C';
$status = Algorithm::NIN::validate($ni);
format()
This method accepts National Insurance number and returns back in the pair format. For example 'AA1234546C' would become 'AA 12 34 56 C' as it appears on NI card.
use strict; use warnings;
use Algorithm::NIN;
my ($ni);
$ni = 'AA123456C';
$ni = Algorithm::NIN::format($ni);
calculateNI()
Returns NI contributions (approx) according to HMRC website http://www.hmrc.gov.uk/rates/nic.htm It only covers fiscal year 2009-10, 2010-11 & 2011-12.I don't claim the number you get back is exactly what you see in your pay slip. This is simply my attempt to understand the internal of mathematics behind the NI contributions. Suggestion to improve the functionality is highly appreciated. This method accepts the following parameter as hashref.
+----------------+-------------------------------------+
| Key | Values |
+----------------+-------------------------------------+
| fiscal_year | '2009-10' or '2010-11' or '2011-12' |
| gross_per_week | 60000, when no class is provided |
| annual_profit | 5000, only when class is 4 |
| self_employed | 1 or 0 |
| married | 1 or 0 |
| sex | 'm' or 'f' |
| class | 1 - for employed |
| | 2 - for self employed |
| | 3 - for voluntary contributions |
| | 4 - for self employed |
+----------------+-------------------------------------+
use strict; use warnings;
use Algorithm::NIN;
my ($ni);
$ni = Algorithm::NIN::calculateNI({
fiscal_year => '2010-11',
gross_per_week => 65000,
self_employed => 1,
class => 2 });
# or
$ni = Algorithm::NIN::calculateNI({
fiscal_year => '2010-11',
class => 3 });
# or
$ni = Algorithm::NIN::calculateNI({
fiscal_year => '2010-11',
annual_profit => 10000,
self_employed => 1,
class => 4 });
# or
$ni = Algorithm::NIN::calculateNI({
fiscal_year => '2010-11',
gross_per_week => 450,
self_employed => 0,
married => 0,
sex => 'f' });
# or
$ni = Algorithm::NIN::calculateNI({
fiscal_year => '2010-11',
gross_per_week => 450,
self_employed => 0,
married => 1,
sex => 'f' });
AUTHOR
Mohammad S Anwar, <mohammad.anwar at yahoo.com>
BUGS
Please report any bugs or feature requests to bug-algorithm-nin at rt.cpan.org
, or through the web interface at http://rt.cpan.org/NoAuth/ReportBug.html?Queue=Algorithm-NIN.I will be notified, and then you'll automatically be notified of progress on your bug as I make changes.
SUPPORT
You can find documentation for this module with the perldoc command.
perldoc Algorithm::NIN
You can also look for information at:
RT: CPAN's request tracker
AnnoCPAN: Annotated CPAN documentation
CPAN Ratings
Search CPAN
TODO
Following NI contributions scenarios are NOT yet covered.
Employer's contracted-out rebate, money-purchase schemes
Employer's contracted-out rebate, salary-related schemes
Employee's contracted-out rebate
Special Class 2 rate for share fishermen
Additional primary Class 1 percentage rate on deferred employments
Additional Class 4 percentage rate where deferment has been granted
LICENSE AND COPYRIGHT
Copyright 2011 Mohammad S Anwar.
This program is free software; you can redistribute it and/or modify it under the terms of either: the GNU General Public License as published by the Free Software Foundation; or the Artistic License.
See http://dev.perl.org/licenses/ for more information.
DISCLAIMER
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.