#!/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 hr; } if (!param()) { print header; print "\n"; print "
"; print "

NCIC full Commission award interest calculation program: data entry form

"; print "
"; &legalbackground; print startform("GET","","application/x-www-form-urlencoded"); print ""; print ""; print ""; print ""; print ""; print ""; print ""; print ""; print ""; print ""; print ""; print ""; print ""; print ""; print ""; print ""; print ""; print ""; print ""; print ""; print ""; print ""; print ""; print ""; print ""; print ""; print ""; print ""; print ""; print "
"; print "First date of disability (start of award) (MM/DD/YYYY): "; print ""; print textfield('ttdstartmon','',2,2), "/", textfield('ttdstartday','',2,2),"/", textfield('ttdstartyear','',4,4); print "
"; print "Date of initial hearing (MM/DD/YYYY): "; print ""; print textfield('doihmon','',2,2), "/", textfield('doihday','',2,2),"/", textfield('doihyear','',4,4); print "
"; print "Open-ended award or closed period award: "; print ""; print "Open "; print "Closed"; print "
"; print "Last day of total disability (end of award) (MM/DD/YYYY): "; print ""; print textfield('ttdendmon','',2,2), "/", textfield('ttdendday','',2,2),"/", textfield('ttdendyear','',4,4); print "
"; print "First potential date of payment (MM/DD/YYYY): "; print ""; print textfield('dopmon','',2,2), "/", textfield('dopday','',2,2), "/", textfield('dopyear','',4,4); print "
"; print "Number of days from first potential date of payment over which to calculate interest due: "; print ""; print textfield('datesop','',10,10); print "
"; print "Employee\'s weekly compensation rate: "; print ""; print textfield('comprate','', 9,9); print "
"; print br; print submit("Run interest calculation"); print " "; print reset("Clear Form"); print end_form; print hr; } if (param()) { print header; print "\n"; print "
"; print "

NCIC full Commission award interest calculation program

"; print "
"; &legalbackground; $datesop = param('datesop'); $#interest = $datesop; $#dopsraw = $datesop; $ttdfromhgnumweeks = $datesop; $comprate = param('comprate'); $openorclosed = param('openorclosed'); $ttdstartmon = param('ttdstartmon') - 1; $ttdstartday = param('ttdstartday'); $ttdstartyear = param('ttdstartyear') - 1900; $ttdstartraw = POSIX::mktime(0, 0, 0, $ttdstartday, $ttdstartmon, $ttdstartyear); $ttdendmon = param('ttdendmon') - 1; $ttdendday = param('ttdendday'); $ttdendyear = param('ttdendyear') - 1900; $ttdendraw = POSIX::mktime(0, 0, 0, $ttdendday, $ttdendmon, $ttdendyear); $doihmon = param('doihmon') - 1; $doihday = param('doihday'); $doihyear = param('doihyear') - 1900; $doihraw = POSIX::mktime(0, 0, 0, $doihday, $doihmon, $doihyear); $dopmon = param('dopmon') - 1; $dopday = param('dopday'); $dopyear = param('dopyear') - 1900; $dopraw = POSIX::mktime(0, 0, 0, $dopday, $dopmon, $dopyear); if (($openorclosed == 0) & ($doihraw > $ttdendraw)) { $ttdthruhgnumsecs = POSIX::difftime($ttdendraw, $ttdstartraw); } else { $ttdthruhgnumsecs = POSIX::difftime($doihraw, $ttdstartraw); } $ttdthruhgnumweeks = $ttdthruhgnumsecs / $secondsinweek; $ttdthruhg = $comprate * $ttdthruhgnumweeks; @dopsraw[0] = $dopraw; $i = 1; for ( $i; $i <= $datesop; $i++) { @dopsraw[$i] = @dopsraw[$i - 1] + $secondsinday; } $i = 0; for ( $i; $i < $datesop; $i++) { $ttdthruhgint = 0; $ttdfromhgint = 0; if ($ttdendraw < @dopsraw[$i]) { $ttdfromhgnumsecs = POSIX::difftime($ttdendraw, $doihraw); $fromhgtodopnumsecs = POSIX::difftime(@dopsraw[$i], $doihraw); } else { $ttdfromhgnumsecs = POSIX::difftime(@dopsraw[$i], $doihraw); $fromhgtodopnumsecs = POSIX::difftime(@dopsraw[$i], $doihraw); } if ($openorclosed == 0) { $ttdfromhgnumsecs = $fromhgtodopnumsecs; } if ($ttdendraw < $doihraw) { $ttdfromhgnumsecs = 0; } $ttdfromhgnumweeks = $ttdfromhgnumsecs / $secondsinweek; @fromhgtodopnumweeks[$i] = $fromhgtodopnumsecs / $secondsinweek; $ttdthruhgint = $ttdthruhg * $intratewkly * @fromhgtodopnumweeks[$i]; $n = @fromhgtodopnumweeks[$i] - 1.0; if ($openorclosed == 0) { $m = 0; } if ($openorclosed == 1) { $m = $n - $ttdfromhgnumweeks + 1; } for ( $n; $n >= $m; $n--) { $ttdfromhgint = $ttdfromhgint + ($comprate * $intratewkly * $n); } @interest[$i] = $ttdthruhgint + $ttdfromhgint; } print "
"; print ""; print ""; print ""; print ""; print ""; print ""; print ""; print ""; print ""; print ""; print ""; print ""; print ""; if ($openorclosed == 1) { print ""; print ""; print ""; print ""; print ""; print ""; print ""; print ""; } print ""; print ""; print ""; print ""; print ""; print ""; print ""; print ""; print ""; print ""; $i = 0; for ( $i; $i < $datesop; $i++) { print ""; print ""; print ""; print ""; print ""; } print "
"; print "First date of disability \(start date of award\): "; print ""; print strftime "%A, %B %d, %Y", localtime($ttdstartraw); print "
"; print "Date of initial hearing: "; print ""; print strftime "%A, %B %d, %Y", localtime($doihraw); print "
"; print "Number of weeks from first date of disability to date of initial hearing: "; print ""; printf "%.2f", $ttdthruhgnumweeks; print "
"; print "Last date of disability \(end date of award\): "; print ""; print strftime "%A, %B %d, %Y", localtime($ttdendraw); print "
"; print "Number of weeks from date of initial hearing to date of end of disability: "; print ""; printf "%.2f", $ttdfromhgnumweeks; print "
"; print "Employee\'s weekly compensation rate: "; print ""; printf "\$%.2f", $comprate; print "
"; print "Date of payment"; print ""; print "Number of weeks from date of hearing to date of payment"; print ""; print "Total interest due on pre-hearing and post-hearing compensation \(8\% per annum simple interest\)"; print ""; print "Total amount of disability compensation plus interest owed on this date of payment"; print "
"; print strftime "%m/%d/%Y", localtime(@dopsraw[$i]); print ""; printf "%.2f", @fromhgtodopnumweeks[$i]; print ""; printf "\$%.2f", @interest[$i]; print ""; if ($openorclosed == 0) { printf "\$%.2f", ($comprate * ($ttdthruhgnumweeks + $fromhgtodopnumweeks[$i])) + @interest[$i]; } else { printf "\$%.2f", ($comprate * ($ttdthruhgnumweeks + $ttdfromhgnumweeks)) + @interest[$i]; } print "
"; 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 "
"; print ""; print ""; }