for all required records in a set. Added a controller class but decided to put stuff in __init__ instead, at least for now. Added a DateField which converts datetime.date into the proper string format for EFW2 files (hopefully), this should still be tested next week.
277 lines
16 KiB
Python
277 lines
16 KiB
Python
import model
|
|
from fields import *
|
|
|
|
__all__ = RECORD_TYPES = ['SubmitterRecord', 'EmployerRecord',
|
|
'EmployeeWageRecord', 'OptionalEmployeeWageRecord',
|
|
'TotalRecord', 'OptionalTotalRecord',
|
|
'StateTotalRecord', 'FinalRecord',]
|
|
|
|
class SubmitterRecord(model.Model):
|
|
record_identifier = 'RA'
|
|
required = True
|
|
|
|
submitter_ein = NumericField(max_length=9)
|
|
user_id = TextField(max_length=8)
|
|
software_vendor = TextField(max_length=4)
|
|
blank1 = BlankField(max_length=5)
|
|
resub_indictator = BooleanField()
|
|
resub_identifier = TextField(max_length=6, required=False)
|
|
software_code = StaticField(value='98') # In-house program
|
|
company_name = TextField(max_length=57)
|
|
company_address = TextField(max_length=22)
|
|
company_delivery_address = TextField(max_length=22)
|
|
company_city = TextField(max_length=22)
|
|
company_state = StateField()
|
|
company_zipcode = TextField(max_length=5)
|
|
company_zipcode_ext = TextField(max_length=4, required=False)
|
|
blank2 = BlankField(max_length=5)
|
|
company_foreign_state_province= TextField(max_length=23, required=False)
|
|
company_foreign_postal_code = TextField(max_length=15, required=False)
|
|
company_country_code = TextField(max_length=2)
|
|
submitter_name = TextField(max_length=57)
|
|
submitter_address = TextField(max_length=22)
|
|
submitter_delivery_address = TextField(max_length=22)
|
|
submitter_city = TextField(max_length=22)
|
|
submitter_state = StateField()
|
|
submitter_zipcode = TextField(max_length=5)
|
|
submitter_zipcode_ext = TextField(max_length=4, required=False)
|
|
blank3 = BlankField(max_length=5)
|
|
submitter_foreign_state_province = TextField(max_length=23, required=False)
|
|
submitter_foreign_postal_code = TextField(max_length=15, required=False)
|
|
submitter_country_code = TextField(max_length=2)
|
|
contact_name = TextField(max_length=27)
|
|
contact_phone = TextField(max_length=15)
|
|
contact_phone_ext = TextField(max_length=5, required=False)
|
|
blank4 = BlankField(max_length=3)
|
|
contact_email = EmailField(max_length=40)
|
|
blank5 = BlankField(max_length=3)
|
|
contact_fax = TextField(max_length=10, required=False)
|
|
preferred_notification = TextField(max_length=1)
|
|
preparer_code = TextField(max_length=1)
|
|
blank6 = BlankField(max_length=12)
|
|
|
|
class EmployerRecord(model.Model):
|
|
record_identifier = 'RE'
|
|
required = True
|
|
|
|
tax_year = NumericField(max_length=4)
|
|
agent_indicator = NumericField(max_length=1)
|
|
employer_ein = TextField(max_length=9)
|
|
agent_for_ein = TextField(max_length=9, required=False)
|
|
terminating_business_indicator = BooleanField()
|
|
establishment_number = TextField(max_length=4, required=False)
|
|
other_ein = TextField(max_length=9, required=False)
|
|
employer_name = TextField(max_length=57)
|
|
location_address = TextField(max_length=22)
|
|
delivery_address = TextField(max_length=22)
|
|
city = TextField(max_length=22)
|
|
state = StateField()
|
|
zipcode = TextField(max_length=5)
|
|
zipcode_ext = TextField(max_length=4, required=False)
|
|
blank1 = BlankField(max_length=5)
|
|
foreign_state_province = TextField(max_length=23)
|
|
foreign_postal_code = TextField(max_length=15)
|
|
country_code = TextField(max_length=2, required=False)
|
|
employment_code = TextField(max_length=1)
|
|
tax_jurisdiction_code = TextField(max_length=1)
|
|
third_party_sick_pay = BooleanField()
|
|
blank2 = BlankField(max_length=291)
|
|
|
|
|
|
class EmployeeWageRecord(model.Model):
|
|
record_identifier = 'RW'
|
|
required = True
|
|
|
|
ssn = NumericField(max_length=9, required=False)
|
|
employee_first_name = TextField(max_length=15)
|
|
employee_middle_name = TextField(max_length=15)
|
|
employee_last_name = TextField(max_length=20)
|
|
employee_suffix = TextField(max_length=4)
|
|
location_address = TextField(max_length=22)
|
|
delivery_address = TextField(max_length=22)
|
|
city = TextField(max_length=22)
|
|
state = StateField()
|
|
zipcode = TextField(max_length=5, required=False)
|
|
zipcode_ext = TextField(max_length=4, required=False)
|
|
blank1 = BlankField(max_length=5)
|
|
foreign_state = TextField(max_length=23, required=False)
|
|
foreign_postal_code = TextField(max_length=15, required=False)
|
|
country = TextField(max_length=2)
|
|
wages_tips = MoneyField(max_length=11)
|
|
federal_income_tax_withheld = MoneyField(max_length=11)
|
|
social_security_wages = MoneyField(max_length=11)
|
|
social_security_tax_withheld = MoneyField(max_length=11)
|
|
medicare_wages_and_tips = MoneyField(max_length=11)
|
|
medicare_tax_withheld = MoneyField(max_length=11)
|
|
social_security_tips = MoneyField(max_length=11)
|
|
advance_eic = MoneyField(max_length=11)
|
|
dependent_care_benefits = MoneyField(max_length=11)
|
|
deferred_compensation_401k = MoneyField(max_length=11)
|
|
deferred_compensation_403b = MoneyField(max_length=11)
|
|
deferred_compensation_408k = MoneyField(max_length=11)
|
|
deferred_compensation_457b = MoneyField(max_length=11)
|
|
deferred_compensation_501c = MoneyField(max_length=11)
|
|
military_pay = MoneyField(max_length=11)
|
|
non_qualified_457 = MoneyField(max_length=11)
|
|
employer_contrib_to_hsa = MoneyField(max_length=11)
|
|
non_qualified_not_457 = MoneyField(max_length=11)
|
|
nontaxable_combat_pay = MoneyField(max_length=11)
|
|
blank2 = BlankField(max_length=11)
|
|
cost_of_premiums_for_insurance = MoneyField(max_length=11)
|
|
income_nonstatutory_stock_opts = MoneyField(max_length=11)
|
|
deferred_compensation_409a = MoneyField(max_length=11)
|
|
designated_roth_contrib_401k = MoneyField(max_length=11)
|
|
designated_roth_contrib_403b = MoneyField(max_length=11)
|
|
blank3 = BlankField(max_length=23)
|
|
statutory_employee_indicator = BooleanField()
|
|
blank4 = BlankField(max_length=1)
|
|
retirement_plan_indicator = BooleanField()
|
|
third_party_sick_pay = BooleanField()
|
|
blank5 = BlankField(max_length=23)
|
|
|
|
|
|
class OptionalEmployeeWageRecord(model.Model):
|
|
record_identifier = 'RO'
|
|
required = False
|
|
|
|
blank1 = BlankField(max_length=9)
|
|
allocated_tips = MoneyField(max_length=11)
|
|
uncollected_tax_on_tips = MoneyField(max_length=11)
|
|
medical_savings_account = MoneyField(max_length=11)
|
|
simple_retirement_account = MoneyField(max_length=11)
|
|
qualified_adoption_expenses = MoneyField(max_length=11)
|
|
uncollected_ss_life_ins = MoneyField(max_length=11)
|
|
uncollected_medicare_life_ins = MoneyField(max_length=11)
|
|
income_under_409a = MoneyField(max_length=11)
|
|
hire_exempt_wages_and_tips = MoneyField(max_length=11)
|
|
blank2 = BlankField(max_length=164)
|
|
wages_subject_to_puerto_rico_tax = MoneyField(max_length=11, required=False)
|
|
commissions_subject_to_puerto_rico_tax = MoneyField(max_length=11, required=False)
|
|
allowances_subject_to_puerto_rico_tax = MoneyField(max_length=11, required=False)
|
|
tips_subject_to_puerto_rico_tax = MoneyField(max_length=11, required=False)
|
|
total_wages_subject_to_puerto_rico_tax = MoneyField(max_length=11, required=False)
|
|
puerto_rico_tax_withheld = MoneyField(max_length=11, required=False)
|
|
retirement_fund_contrib = MoneyField(max_length=11, required=False)
|
|
blank3 = BlankField(max_length=11)
|
|
total_wages_tips_virgin_islands = MoneyField(max_length=11, required=False)
|
|
virgin_islands_income_tax_withheld = MoneyField(max_length=11, required=False)
|
|
blank4 = BlankField(max_length=128)
|
|
|
|
|
|
class StateWageRecord(model.Model):
|
|
record_identifier = 'RS'
|
|
required = False
|
|
|
|
state_code = NumericField(max_length=2)
|
|
taxing_entity_code = TextField(max_length=5)
|
|
ssn = NumericField(max_length=9, required=False)
|
|
employee_first_name = TextField(max_length=15)
|
|
employee_middle_name = TextField(max_length=15)
|
|
employee_last_name = TextField(max_length=20)
|
|
employee_suffix = TextField(max_length=4)
|
|
location_address = TextField(max_length=22)
|
|
delivery_address = TextField(max_length=22)
|
|
city = TextField(max_length=22)
|
|
state = StateField()
|
|
zipcode = TextField(max_length=5, required=False)
|
|
zipcode_ext = TextField(max_length=4, required=False)
|
|
blank1 = BlankField(max_length=5)
|
|
foreign_state_province = TextField(max_length=23, required=False)
|
|
foreign_postal_code = TextField(max_length=15, required=False)
|
|
country_code = TextField(max_length=2)
|
|
optional_code = TextField(max_length=2, required=False)
|
|
reporting_period = NumericField(max_length=6) # MAYBE MAKE A CUSTOM FIELD TYPE FOR THIS
|
|
quarterly_unemp_ins_wages = MoneyField(max_length=11)
|
|
quarterly_unemp_ins_taxable_wages = MoneyField(max_length=11)
|
|
number_of_weeks_worked = NumericField(max_length=2)
|
|
date_first_employed = DateField()
|
|
date_of_separation = DateField()
|
|
blank2 = BlankField(max_length=5)
|
|
state_employer_account_num = NumericField(max_length=20)
|
|
blank3 = BlankField(max_length=6)
|
|
state_code_2 = NumericField(max_length=2)
|
|
state_taxable_wages = MoneyField(max_length=11)
|
|
state_income_tax_wh = MoneyField(max_length=11)
|
|
other_state_data = TextField(max_length=10)
|
|
tax_type_code = TextField(max_length=1) # VALIDATE C, D, E, or F
|
|
local_taxable_wages = MoneyField(max_length=11)
|
|
local_income_tax_wh = MoneyField(max_length=11)
|
|
state_control_number = NumericField(max_length=7, required=False)
|
|
supplemental_data1 = TextField(max_length=75)
|
|
supplemental_data2 = TextField(max_length=75)
|
|
blank4 = BlankField(max_length=25)
|
|
|
|
class TotalRecord(model.Model):
|
|
record_identifier = 'RT'
|
|
required = True
|
|
|
|
number_of_rw_records = NumericField(max_length=7)
|
|
wages_tips = NumericField(max_length=15)
|
|
federal_income_tax_withheld = NumericField(max_length=15)
|
|
social_security_wages = NumericField(max_length=15)
|
|
social_security_tax_withheld = NumericField(max_length=15)
|
|
medicare_wages_and_tips = NumericField(max_length=15)
|
|
medicare_tax_withheld = NumericField(max_length=15)
|
|
social_security_tips = NumericField(max_length=15)
|
|
advance_eic = NumericField(max_length=15)
|
|
dependent_care_benefits = NumericField(max_length=15)
|
|
deferred_compensation_401k = NumericField(max_length=15)
|
|
deferred_compensation_403b = NumericField(max_length=15)
|
|
deferred_compensation_408k = NumericField(max_length=15)
|
|
deferred_compensation_457b = NumericField(max_length=15)
|
|
deferred_compensation_501c = NumericField(max_length=15)
|
|
military_pay = NumericField(max_length=15)
|
|
non_qualified_457 = NumericField(max_length=15)
|
|
employer_contrib_to_hsa = NumericField(max_length=15)
|
|
non_qualified_not_457 = NumericField(max_length=15)
|
|
nontaxable_combat_pay = NumericField(max_length=15)
|
|
blank1 = BlankField(max_length=15)
|
|
employer_cost_term_life_ins = NumericField(max_length=15)
|
|
income_tax_wh_sick_pay = NumericField(max_length=15)
|
|
income_exercise_nonstat_stock_opts = NumericField(max_length=15)
|
|
deferred_409a_compensation_plan = NumericField(max_length=15)
|
|
designated_roth_contribs_401k = NumericField(max_length=15)
|
|
disignated_roth_contribs_403b = NumericField(max_length=15)
|
|
blank2 = BlankField(max_length=113)
|
|
|
|
|
|
class OptionalTotalRecord(model.Model):
|
|
record_identifier = 'RU'
|
|
required = False
|
|
|
|
number_of_ro_records = NumericField(max_length=7)
|
|
allocated_tips = NumericField(max_length=15)
|
|
uncollected_tax_on_tips = NumericField(max_length=15)
|
|
medical_savings_account = NumericField(max_length=15)
|
|
simple_retirement_account = NumericField(max_length=15)
|
|
qualified_adoption_expenses = NumericField(max_length=15)
|
|
uncollected_ss_life_ins = NumericField(max_length=15)
|
|
uncollected_medicare_life_ins = NumericField(max_length=15)
|
|
income_under_409a = NumericField(max_length=15)
|
|
hire_exempt_wages_and_tips = NumericField(max_length=15)
|
|
blank1 = BlankField(max_length=210)
|
|
wages_subject_to_puerto_rico_tax = NumericField(max_length=15, required=False)
|
|
commissions_subject_to_puerto_rico_tax = NumericField(max_length=15, required=False)
|
|
allowances_subject_to_puerto_rico_tax = NumericField(max_length=15, required=False)
|
|
tips_subject_to_puerto_rico_tax = NumericField(max_length=15, required=False)
|
|
total_wages_subject_to_puerto_rico_tax = NumericField(max_length=15, required=False)
|
|
puerto_rico_tax_withheld = NumericField(max_length=15, required=False)
|
|
retirement_fund_contrib = NumericField(max_length=15, required=False)
|
|
total_wages_tips_virgin_islands = NumericField(max_length=15, required=False)
|
|
virgin_islands_income_tax_withheld = NumericField(max_length=15, required=False)
|
|
blank2 = BlankField(max_length=23)
|
|
|
|
|
|
class StateTotalRecord(model.Model):
|
|
record_identifier = 'RV'
|
|
required = False
|
|
|
|
supplemental_data = TextField(max_length=510)
|
|
|
|
class FinalRecord(model.Model):
|
|
record_identifier = 'RF'
|
|
required = True
|
|
|
|
blank1 = BlankField(max_length=5)
|
|
number_of_rw_records = NumericField(max_length=9)
|
|
blank2 = BlankField(max_length=496)
|