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.

Employee table

ColumnTypeDescription
idintEmployee ID
nametextEmployee name
earningsnumberGross earnings per pay period
filing_statusnumberFiling status

Primary key: id

Employee pay settings table

ColumnTypeDescription
idintEmployee ID
tax_namestringTax name from table
exemptionsnumberNumber of exemptions claimed for this tax
state_exemptionsnumberNumber of state exemptions claimed for this tax
miscellaneousnumberMiscellaneous amount for this tax
auxiliarynumberAuxiliary 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()