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
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
Employee pay settings table
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: