-
-
Save pomeo/80fd13226e3a215c3997 to your computer and use it in GitHub Desktop.
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
# To check if this is up-to-date with the tax rates go to | |
# http://www.expatax.nl/tax-rates-2014.php and see if there's anything | |
# newer there. | |
use strict; | |
use warnings; | |
use Text::TabularDisplay; | |
use List::Util qw(sum); | |
my $start = 30_000 || $ARGV[0]; | |
my $end = 100_000 || $ARGV[1]; | |
my $step = 1_000 || $ARGV[2]; | |
my @data; | |
for ( my $salary = $start ; $salary <= $end ; $salary += $step ) { | |
push @data => [ | |
# Your Gross income | |
eurofy($salary), | |
# Without 30% ruling | |
eurofy( $salary - taxes_for($salary) ), | |
percentify( taxes_for($salary), $salary ), | |
# With 30% ruling | |
eurofy( $salary - taxes_for( $salary * .7 ) ), | |
percentify( taxes_for( $salary * .7 ), $salary ), | |
]; | |
} | |
my $table = Text::TabularDisplay->new( | |
"Gross income\n(before taxes)", | |
"Net income\n(after taxes)", | |
"Tax rate", | |
"Net income\n(after taxes,\nwith 30% ruling)", | |
"Tax rate", | |
); | |
$table->add(@$_) for @data; | |
print $table->render, "\n"; | |
exit; | |
sub taxes_for { | |
my $income = shift; | |
my @tax_brackets = ( | |
# difference tax rate | |
[ 19_645 => .3625 ], | |
[ 33_363 - 19_645 => .42 ], | |
[ 56_531 - 33_363 => .42 ], | |
[ 0 => .52 ], | |
); | |
my $money_left = $income; | |
my $taxes = 0; | |
foreach my $bracket (@tax_brackets) { | |
my ( $progressive_amount, $taxes_for ) = @$bracket; | |
my $taxable_amount = $money_left; | |
if ( $taxable_amount > $progressive_amount ) { | |
$taxable_amount = $progressive_amount if $progressive_amount; | |
} | |
$money_left -= $taxable_amount; | |
$taxes += $taxable_amount * $taxes_for; | |
last unless $money_left; | |
} | |
return $taxes; | |
} | |
# From perlfaq5 | |
sub commify { | |
local $_ = shift; | |
1 while s/^([-+]?\d+)(\d{3})/$1,$2/; | |
return $_; | |
} | |
sub percentify { | |
my ( $amount, $total ) = @_; | |
return sprintf "%.1f%%" => ( ( 100 * $amount ) / $total ); | |
} | |
sub eurofy { | |
my ($number) = @_; | |
# Round it | |
$number = int $number; | |
return sprintf( "%s EUR", commify($number) ); | |
} | |
__DATA__ | |
$ perl 30-income-calculon.pl | |
+----------------+---------------+----------+------------------+----------+ | |
| Gross income | Net income | Tax rate | Net income | Tax rate | | |
| (before taxes) | (after taxes) | | (after taxes, | | | |
| | | | with 30% ruling) | | | |
+----------------+---------------+----------+------------------+----------+ | |
| 30,000 EUR | 18,529 EUR | 38.2% | 22,309 EUR | 25.6% | | |
| 31,000 EUR | 19,109 EUR | 38.4% | 23,015 EUR | 25.8% | | |
| 32,000 EUR | 19,689 EUR | 38.5% | 23,721 EUR | 25.9% | | |
| 33,000 EUR | 20,269 EUR | 38.6% | 24,427 EUR | 26.0% | | |
| 34,000 EUR | 20,849 EUR | 38.7% | 25,133 EUR | 26.1% | | |
| 35,000 EUR | 21,429 EUR | 38.8% | 25,839 EUR | 26.2% | | |
| 36,000 EUR | 22,009 EUR | 38.9% | 26,545 EUR | 26.3% | | |
| 37,000 EUR | 22,589 EUR | 38.9% | 27,251 EUR | 26.3% | | |
| 38,000 EUR | 23,169 EUR | 39.0% | 27,957 EUR | 26.4% | | |
| 39,000 EUR | 23,749 EUR | 39.1% | 28,663 EUR | 26.5% | | |
| 40,000 EUR | 24,329 EUR | 39.2% | 29,369 EUR | 26.6% | | |
| 41,000 EUR | 24,909 EUR | 39.2% | 30,075 EUR | 26.6% | | |
| 42,000 EUR | 25,489 EUR | 39.3% | 30,781 EUR | 26.7% | | |
| 43,000 EUR | 26,069 EUR | 39.4% | 31,487 EUR | 26.8% | | |
| 44,000 EUR | 26,649 EUR | 39.4% | 32,193 EUR | 26.8% | | |
| 45,000 EUR | 27,229 EUR | 39.5% | 32,899 EUR | 26.9% | | |
| 46,000 EUR | 27,809 EUR | 39.5% | 33,605 EUR | 26.9% | | |
| 47,000 EUR | 28,389 EUR | 39.6% | 34,311 EUR | 27.0% | | |
| 48,000 EUR | 28,969 EUR | 39.6% | 35,017 EUR | 27.0% | | |
| 49,000 EUR | 29,549 EUR | 39.7% | 35,723 EUR | 27.1% | | |
| 50,000 EUR | 30,129 EUR | 39.7% | 36,429 EUR | 27.1% | | |
| 51,000 EUR | 30,709 EUR | 39.8% | 37,135 EUR | 27.2% | | |
| 52,000 EUR | 31,289 EUR | 39.8% | 37,841 EUR | 27.2% | | |
| 53,000 EUR | 31,869 EUR | 39.9% | 38,547 EUR | 27.3% | | |
| 54,000 EUR | 32,449 EUR | 39.9% | 39,253 EUR | 27.3% | | |
| 55,000 EUR | 33,029 EUR | 39.9% | 39,959 EUR | 27.3% | | |
| 56,000 EUR | 33,609 EUR | 40.0% | 40,665 EUR | 27.4% | | |
| 57,000 EUR | 34,142 EUR | 40.1% | 41,371 EUR | 27.4% | | |
| 58,000 EUR | 34,622 EUR | 40.3% | 42,077 EUR | 27.5% | | |
| 59,000 EUR | 35,102 EUR | 40.5% | 42,783 EUR | 27.5% | | |
| 60,000 EUR | 35,582 EUR | 40.7% | 43,489 EUR | 27.5% | | |
| 61,000 EUR | 36,062 EUR | 40.9% | 44,195 EUR | 27.5% | | |
| 62,000 EUR | 36,542 EUR | 41.1% | 44,901 EUR | 27.6% | | |
| 63,000 EUR | 37,022 EUR | 41.2% | 45,607 EUR | 27.6% | | |
| 64,000 EUR | 37,502 EUR | 41.4% | 46,313 EUR | 27.6% | | |
| 65,000 EUR | 37,982 EUR | 41.6% | 47,019 EUR | 27.7% | | |
| 66,000 EUR | 38,462 EUR | 41.7% | 47,725 EUR | 27.7% | | |
| 67,000 EUR | 38,942 EUR | 41.9% | 48,431 EUR | 27.7% | | |
| 68,000 EUR | 39,422 EUR | 42.0% | 49,137 EUR | 27.7% | | |
| 69,000 EUR | 39,902 EUR | 42.2% | 49,843 EUR | 27.8% | | |
| 70,000 EUR | 40,382 EUR | 42.3% | 50,549 EUR | 27.8% | | |
| 71,000 EUR | 40,862 EUR | 42.4% | 51,255 EUR | 27.8% | | |
| 72,000 EUR | 41,342 EUR | 42.6% | 51,961 EUR | 27.8% | | |
| 73,000 EUR | 41,822 EUR | 42.7% | 52,667 EUR | 27.9% | | |
| 74,000 EUR | 42,302 EUR | 42.8% | 53,373 EUR | 27.9% | | |
| 75,000 EUR | 42,782 EUR | 43.0% | 54,079 EUR | 27.9% | | |
| 76,000 EUR | 43,262 EUR | 43.1% | 54,785 EUR | 27.9% | | |
| 77,000 EUR | 43,742 EUR | 43.2% | 55,491 EUR | 27.9% | | |
| 78,000 EUR | 44,222 EUR | 43.3% | 56,197 EUR | 28.0% | | |
| 79,000 EUR | 44,702 EUR | 43.4% | 56,903 EUR | 28.0% | | |
| 80,000 EUR | 45,182 EUR | 43.5% | 57,609 EUR | 28.0% | | |
| 81,000 EUR | 45,662 EUR | 43.6% | 58,298 EUR | 28.0% | | |
| 82,000 EUR | 46,142 EUR | 43.7% | 58,934 EUR | 28.1% | | |
| 83,000 EUR | 46,622 EUR | 43.8% | 59,570 EUR | 28.2% | | |
| 84,000 EUR | 47,102 EUR | 43.9% | 60,206 EUR | 28.3% | | |
| 85,000 EUR | 47,582 EUR | 44.0% | 60,842 EUR | 28.4% | | |
| 86,000 EUR | 48,062 EUR | 44.1% | 61,478 EUR | 28.5% | | |
| 87,000 EUR | 48,542 EUR | 44.2% | 62,114 EUR | 28.6% | | |
| 88,000 EUR | 49,022 EUR | 44.3% | 62,750 EUR | 28.7% | | |
| 89,000 EUR | 49,502 EUR | 44.4% | 63,386 EUR | 28.8% | | |
| 90,000 EUR | 49,982 EUR | 44.5% | 64,022 EUR | 28.9% | | |
| 91,000 EUR | 50,462 EUR | 44.5% | 64,658 EUR | 28.9% | | |
| 92,000 EUR | 50,942 EUR | 44.6% | 65,294 EUR | 29.0% | | |
| 93,000 EUR | 51,422 EUR | 44.7% | 65,930 EUR | 29.1% | | |
| 94,000 EUR | 51,902 EUR | 44.8% | 66,566 EUR | 29.2% | | |
| 95,000 EUR | 52,382 EUR | 44.9% | 67,202 EUR | 29.3% | | |
| 96,000 EUR | 52,862 EUR | 44.9% | 67,838 EUR | 29.3% | | |
| 97,000 EUR | 53,342 EUR | 45.0% | 68,474 EUR | 29.4% | | |
| 98,000 EUR | 53,822 EUR | 45.1% | 69,110 EUR | 29.5% | | |
| 99,000 EUR | 54,302 EUR | 45.1% | 69,746 EUR | 29.5% | | |
| 100,000 EUR | 54,782 EUR | 45.2% | 70,382 EUR | 29.6% | | |
+----------------+---------------+----------+------------------+----------+ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment