Skip to content

Database schema

When using TaxControls in your application, taxes are computed one at a time, and any tax may give special meaning to some or all of these input properties:

We recommend a database structure that allows values for these properties to be stored for each tax to be applied to each employee.

Column Type Description
id int Employee ID
name text Employee name
earnings number Gross earnings per pay period
filing_status number Filing status

Primary key: id

Column Type Description
id int Employee ID
tax_name string Tax name from table
exemptions number Number of exemptions claimed for this tax
state_exemptions number Number of state exemptions claimed for this tax
miscellaneous number Miscellaneous amount for this tax
auxiliary number Auxiliary amount for this tax

Primary key: id,tax_name

With this structure, each employee has a row in the pay settings table for each tax associated with their pay.

This table will be sparsely populated, but allows maximum flexibility. When your application calculates taxes, it will set every TaxControls property to the value in this table for each employee, for each tax.

Here’s a pseudocode example of how the application would process payroll:

tc = TaxControl()
for employee in employees:
for setting in paysettings(employee):
tc.SelectedTax = setting.tax_name
tc.Earnings = employee.earnings
tc.FilingStatus = employee.filing_status
tc.Exemptions = setting.exemptions
tc.StateExemptions = setting.state_exemptions
tc.Miscellaneous = setting.miscellaneous
tc.Auxiliary = setting.auxiliary
tax = tc.TaxAmount()