Payroll Design notes

modules

Payroll
Payroll::XML
Payroll::US
Payroll::US::MO::StateIncome
Payroll::US::FedIncome
Payroll::US::FICA
Payroll::US::Medicare
Payroll::US::MO::<local>
Payroll::Canada

All withholding modules should return negative numbers. Any crediting modules should return positive numbers.

Payroll
The Payroll module's new method will setup the Payroll system.  The process() method will call Payroll::XML::Parser modules to change the XML input into the Perl data object (Payroll::XML::Data) that the countries can then work with.  It will then call the proper country module passing in the data object and the output object/hash. The resulting object is the XML module Payroll::XML::Output. Calling the generate() method will create the output XML document.  Pass in a list of supported countries to the Parser.

Payroll->new()
Payroll->process(fileName => , string =>)

Payroll::XML::Parser
Validates and then changes XML input to data object.

Payroll::XML::Data
The data object that XML is turned into.

Payroll::XML::Output
Changes output object into XML. Holds the output data and generate the output XML based on that data.

The US module may be configured to call the proper sub modules and return a shallow hash of the data:
Payroll::US->calculate(gross, date, method, allowances, period, marital, grossYTD)
  returns hash of {FedIncome} = X, {Medicate} = Y, {FICA} = Z

API for individual tax modules.  These modules will simply take the data given and figure out the tax.  Of course the date will affect which rates are used. The modules will return a float (rounded to 2 decimals) or undef

FedIncome->calculate( gross, date, method, allowances, period, marital)
StateIncome->calculate( gross, date, method, allowances, period, marital, federal, fYTD)
FICA->calculate( gross, date, YTD)
Medicare->calculte( gross, date )