<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>PCX Payroll System</title>
<meta http-equiv="content-type" content="text/html; charset=ISO-8859-1">
</head>
<body>
<b>StateIncome.pm</b><br>
<br>
StateIncome->calculate( <br>
gross,
# - gross pay <br>
date,
#- date of payment format YYYYMMDD<br>
method, #- specifies
mthod to use. currently only 1 <br>
allowances #, - state allowances claimed,
integer<br>
period,
#- annual, semiannual, quarterly, monthly, semimonthly, biweekly, weekly,
daily <br>
marital,
#- single, married, spouseWorks, head<br>
federal,
#- amount of federal tax withheld here<br>
fYTD,
#- total federal tax withheld yeart to date<br>
round,
#yes, no - defaults to yes<br>
)<br>
{<br>
#Step 1.1<br>
if period ne "annual"<br>
aGross = annualize(gross, period)<br>
#Step 1.2 <br>
aGross -= dataTables{$foundDate}->{standardDeduction}->{marital}<br>
#Step 1.3<br>
if allowances >= 1<br>
aGross -= dataTables{$foundDate}->{allowance1}->{marital}<br>
if allowances >= 2<br>
aGross -= dataTables{$foundDate}->{allowance2}->{marital}<br>
if allowances >= 3<br>
aGross -= dataTables{$foundDate}->{allowance3}->{marital}<br>
if allowances >= 4<br>
aGross -= dataTables{$foundDate}->{allowance4}->{marital}<br>
if allowances >= 5<br>
aGross -= (dataTables{$foundDate}->{allowance5}->{marital}
* (allowances -4))<br>
#Step 1.4<br>
aFed = annualize(federal, period) - dataTables{$foundDate}->{federalLimit}->{marital}<br>
#Step 1.5 done along the way and finished here<br>
aGross -= aFed<br>
<br>
#Step 2.1 lookup tables for percentages<br>
#need to place table in reverse oder so that we can know the top is <br>
mGross = aGross<br>
for (in reverse) <br>
if mGross >= bottom[x]<br>
if bottom[x] == 0<br>
tax+= (mGross) *
percent[x]<br>
mGross = 0<br>
else<br>
tax += (mGross -
bottom[x] + .01) * percent[x] #bottom is inclusive<br>
mGross = bottom[x]
- .01<br>
<br>
#Step 2.2<br>
tax = reverseAnnualize(tax, period)<br>
<br>
if round eq "no"<br>
return tax<br>
else<br>
return round(tax) #to whole number<br>
}<br>
<br>
#############!!!!!!!!!!!!!!!make the ='s into =>'s<br>
new()<br>
{<br>
$dataTables->{tables}<br>
dataTables{'20020101' => <br>
{ standardDeduction
=> {single = '4700', married = '7850' , spouseworks = '3925', head ='6900'
},<br>
allowance1
=> { single = '1200', married = '1200' , spouseworks = '1200', head = '3500'},<br>
allowance2
=> { single = '1200', married = '1200' , spouseworks = '1200', head = '0'},<br>
allowance3
=> { single = '1200', married = '1200' , spouseworks = '1200', head = '0'},<br>
allowance4
=> { single = '1200', married = '1200' , spouseworks = '1200', head = '0'},<br>
allowance5
=> { single = '1200', married = '1200' , spouseworks = '1200', head = '1200'},<br>
federalLimit = '5000', married = '10000' , spouseworks = '5000', head = '10000'}
,<br>
percentTable => <br>
{top = '1000.00', percent = '1.5' },<br>
{top = '2000.00', percent = '2.0' },<br>
{top = '3000.00', percent = '2.5' },<br>
{top = '4000.00', percent = '3.0' },<br>
{top = '5000.00', percent = '3.5' },<br>
{top = '6000.00', percent = '4.0' },<br>
{top = '7000.00', percent = '4.5' },<br>
{top = '8000.00', percent = '5.0' },<br>
{top = '9000.00', percent = '5.5' },<br>
{top = '-1', percent = '6.0' }<br>
}<br>
}<br>
dataTables{$foundDate}->{allowance1}->{marital}<br>
<br>
The periodDays hash holds the number of days in a period<br>
<table cellpadding="2" cellspacing="2" border="0" width="50%">
<tbody>
<tr>
<td valign="top">periodDays-><br>
</td>
<td valign="top">{annual}<br>
</td>
<td valign="top">= 1<br>
</td>
</tr>
<tr>
<td valign="top"><br>
</td>
<td valign="top">{semiannual}<br>
</td>
<td valign="top">= 2<br>
</td>
</tr>
<tr>
<td valign="top"><br>
</td>
<td valign="top">{quarterly}<br>
</td>
<td valign="top">= 4<br>
</td>
</tr>
<tr>
<td valign="top"><br>
</td>
<td valign="top">{monthly}<br>
</td>
<td valign="top">= 12 </td>
</tr>
<tr>
<td valign="top"><br>
</td>
<td valign="top">{semimonthly}<br>
</td>
<td valign="top">= 24<br>
</td>
</tr>
<tr>
<td valign="top"><br>
</td>
<td valign="top">{biweekly}<br>
</td>
<td valign="top">= 26<br>
</td>
</tr>
<tr>
<td valign="top"><br>
</td>
<td valign="top">{weekly}<br>
</td>
<td valign="top">= 52<br>
</td>
</tr>
<tr>
<td valign="top"><br>
</td>
<td valign="top">{daily}<br>
</td>
<td valign="top">= 260<br>
</td>
</tr>
</tbody>
</table>
<br>
}<br>
</body>
</html>