/usr/share/doc/libdate-pcalc-perl/examples/income.pl is in libdate-pcalc-perl 6.1-2build1.
This file is owned by root:root, with mode 0o755.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 | #!/usr/bin/perl -w
###############################################################################
## ##
## Copyright (c) 2001 - 2009 by Steffen Beyer. ##
## All rights reserved. ##
## ##
## This program is free software; you can redistribute it ##
## and/or modify it under the same terms as Perl itself. ##
## ##
###############################################################################
BEGIN { eval { require bytes; }; }
use Date::Pcalendar::Profiles qw( $Profiles );
use Date::Pcalendar;
use Date::Pcalc qw(:all);
$self = $0;
$self =~ s!^.*[/\\]!!;
$self =~ s!\.+[^./\\]*$!!;
unless (@ARGV == 4)
{
die "Usage: $self <year_of_birth> <vacation_days_per_year> <hours_per_week> <brut_yearly_income>\n";
}
$birth = shift;
$vacation = shift;
$hours_per_week = shift;
$brut_yearly_income = shift;
$start = This_Year();
$stop = $birth + 65;
$sum = 0; # total of workdays
$len = 0; # total of days
print "\n";
print "Year of birth = $birth\n";
print "Current year = $start\n";
print "Year of retirement = $stop\n";
print "Vacation days/year = $vacation\n";
print "Hours per week = $hours_per_week\n";
print "Brut annual income = $brut_yearly_income\n";
print "\n";
#$Cal = Date::Pcalendar->new( $Profiles->{'sdm-MUC'} );
$Cal = Date::Pcalendar->new( $Profiles->{'DE-NW'} );
for ( $year = $start; $year <= $stop; $year++ )
{
$Year = $Cal->year( $year );
$full = $Year->vec_full(); # full holidays
$half = $Year->vec_half(); # half holidays
$work = $Year->vec_work(); # workspace
$work->Complement($full); # workdays plus half holidays
$full = $full->Norm();
$half = $half->Norm();
$work = $work->Norm();
$term = $half * 0.5;
$work -= $term + $vacation;
$days = $Year->val_days();
#print "full = $full\n";
#print "half = $half\n";
#print "term = $term\n";
#print "work = $work\n";
#print "days = $days\n";
#print "size = ", $Year->vec_full()->Size(), "\n";
#print "work + full + term = ", $work + $full + $term, "\n";
print "$year : $work\n";
$sum += $work;
$len += $days;
}
print "\nTotal workdays = $sum\n";
print "Average workdays per year = ", $sum / ($stop - $start + 1), "\n";
print "\nTotal days = $len\n";
print "Average year length in days = ", $len / ($stop - $start + 1), "\n";
print "\nQuotient = ", $sum / $len, "\n";
print "\nNet hourly wages (assuming 50% taxes on income) = ",
$brut_yearly_income * ($stop - $start + 1) * 5 / ($sum * $hours_per_week * 2), "\n";
# "Magic numbers": 5 = workdays per week, 2 = 50% tax
print "\n";
__END__
|