#!/usr/bin/perl
# script: wcinterest.pl
# Copyright (C) 2007 J. William Snyder, Jr.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# 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. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
use strict;
use CGI qw/:standard/;
use POSIX;
#use Date::Parse;
my $versiondate = "November 24, 2007";
my $ttdstartmon;
my $ttdstartday;
my $ttdstartyear;
my $ttdstartraw;
my $ttdendmon;
my $ttdendday;
my $ttdendyear;
my $ttdendraw;
my $doihmon;
my $doihday;
my $doihyear;
my $doihraw;
my $dopmon;
my $dopday;
my $dopyear;
my $dopraw;
my @dopsraw;
my $ttdthruhg;
my $ttdthruhgint;
my $ttdfromhg;
my $ttdfromhgint;
my $ttdthruhgnumsecs;
my $ttdthruhgnumweeks;
my $ttdfromhgnumsecs;
my $ttdfromhgnumweeks;
my $fromhgtodopnumsecs;
my @fromhgtodopnumweeks;
my $comprate;
my @interest;
my $intratewkly = 0.001538462; # 8% per annum reduced to a weekly rate
my $secondsinday = 86400;
my $secondsinweek = 604800;
my $n;
my $i;
my $m;
my $datesop;
my $openorclosed;
sub legalbackground
{
print hr;
print "";
print "This program calculates the interest due on total disability compensation due on awards ";
print "of the NCIC full Commission pursuant to N.C. Gen. Stat. Sec. 97-86.2,
which mandates ";
print "that an employer that is ordered to pay compensation pursuant to an award of the ";
print "full Commission pay interest on the award at the legal rate prescribed by N.C. Gen. Stat. Sec. ";
print "24-1. The rate prescribed by N.C. Gen. Stat. Sec. 24-1
is \"eight \(8\%\) per annum\". Although the statutes ";
print "are silent about whether simple or compound interest is to be paid, the Commission ";
print "in Tracy
W. Moore v. Standard Mineral Company, I.C. File No. 177919 (March ";
print "19, 1998) held that 8% simple interest (Math formula: Interest = Principal X Rate X Time) ";
print "is to be paid unless the plaintiff can prove that s/he could have obtained a greater ";
print "return than 8% simple interest on the compensation awarded. ";
print "The method used by this program is modeled after the method used by Commissioner Thomas ";
print "Bolch to calculate the interest on compensation due in Robert
Moore v. Foam Ex, ";
print "I.C. File No. 241740 (April 1, 1999) except that 1. the program handles fractional ";
print "weeks, and 2. the program takes account of the fact that workers' compensation benefits
are paid in arrears and not in advance.";
print " ";
print "";
print "
This version of the program was released on
$versiondate.
";
print "";
print "";
print "Results generated by wcinterest.pl, written by J. William Snyder, Jr. (jwsnyder\@jwsnyder.com) $versiondate. ";
print "Date this calculation was generated: ";
print strftime "%A, %B %d, %Y", localtime(time);
print ". ";
print "The calculations produced by this program are render \"AS IS\" with no warranty of any kind whatsoever, even if the calculations turn out to be inaccurate. The user of this program assumes all responsibility and risk for the use of the figures generated by this program.";
print "";
print "