fixed missing field, updated for 2012
This commit is contained in:
parent
717f929015
commit
30376a54f3
3 changed files with 18 additions and 8 deletions
|
@ -16,9 +16,16 @@ RECORD_TYPES = [
|
||||||
|
|
||||||
def test():
|
def test():
|
||||||
import record, model
|
import record, model
|
||||||
|
from fields import ValidationError
|
||||||
for rname in RECORD_TYPES:
|
for rname in RECORD_TYPES:
|
||||||
inst = record.__dict__[rname]()
|
inst = record.__dict__[rname]()
|
||||||
print type(inst), inst.record_identifier, len(inst.output())
|
try:
|
||||||
|
output_length = len(inst.output())
|
||||||
|
except ValidationError, e:
|
||||||
|
print e.msg, type(inst), inst.record_identifier
|
||||||
|
continue
|
||||||
|
|
||||||
|
print type(inst), inst.record_identifier, output_length
|
||||||
|
|
||||||
|
|
||||||
def test_dump():
|
def test_dump():
|
||||||
|
|
|
@ -2,7 +2,8 @@ from fields import Field, ValidationError
|
||||||
import copy
|
import copy
|
||||||
import pdb
|
import pdb
|
||||||
|
|
||||||
class Model(object):
|
|
||||||
|
class Model(object):
|
||||||
record_identifier = ' '
|
record_identifier = ' '
|
||||||
required = False
|
required = False
|
||||||
|
|
||||||
|
@ -53,7 +54,7 @@ class Model(object):
|
||||||
def output(self):
|
def output(self):
|
||||||
result = ''.join([self.record_identifier] + [field.get_data() for field in self.get_sorted_fields()])
|
result = ''.join([self.record_identifier] + [field.get_data() for field in self.get_sorted_fields()])
|
||||||
if len(result) != 512:
|
if len(result) != 512:
|
||||||
raise ValidationError("Record result length not equal to 512 bytes")
|
raise ValidationError("Record result length not equal to 512 bytes (%d)" % len(result))
|
||||||
return result
|
return result
|
||||||
|
|
||||||
def read(self, fp):
|
def read(self, fp):
|
||||||
|
|
|
@ -151,6 +151,7 @@ class EmployeeWageRecord(model.Model):
|
||||||
location_address = TextField(max_length=22)
|
location_address = TextField(max_length=22)
|
||||||
delivery_address = TextField(max_length=22)
|
delivery_address = TextField(max_length=22)
|
||||||
city = TextField(max_length=22)
|
city = TextField(max_length=22)
|
||||||
|
city = TextField(max_length=22)
|
||||||
state = StateField()
|
state = StateField()
|
||||||
zipcode = TextField(max_length=5, required=False)
|
zipcode = TextField(max_length=5, required=False)
|
||||||
zipcode_ext = TextField(max_length=4, required=False)
|
zipcode_ext = TextField(max_length=4, required=False)
|
||||||
|
@ -172,23 +173,24 @@ class EmployeeWageRecord(model.Model):
|
||||||
deferred_compensation_408k = MoneyField(max_length=11, required=False)
|
deferred_compensation_408k = MoneyField(max_length=11, required=False)
|
||||||
deferred_compensation_457b = MoneyField(max_length=11, required=False)
|
deferred_compensation_457b = MoneyField(max_length=11, required=False)
|
||||||
deferred_compensation_501c = MoneyField(max_length=11, required=False)
|
deferred_compensation_501c = MoneyField(max_length=11, required=False)
|
||||||
military_pay = MoneyField(max_length=11, required=False)
|
blank2 = BlankField(max_length=11)
|
||||||
non_qualified_457 = MoneyField(max_length=11, required=False)
|
non_qualified_457 = MoneyField(max_length=11, required=False)
|
||||||
employer_contrib_to_hsa = MoneyField(max_length=11, required=False)
|
employer_contrib_to_hsa = MoneyField(max_length=11, required=False)
|
||||||
non_qualified_not_457 = MoneyField(max_length=11, required=False)
|
non_qualified_not_457 = MoneyField(max_length=11, required=False)
|
||||||
nontaxable_combat_pay = MoneyField(max_length=11, required=False)
|
nontaxable_combat_pay = MoneyField(max_length=11, required=False)
|
||||||
blank2 = BlankField(max_length=11)
|
blank3 = BlankField(max_length=11)
|
||||||
cost_of_premiums_for_insurance = MoneyField(max_length=11, required=False)
|
cost_of_premiums_for_insurance = MoneyField(max_length=11, required=False)
|
||||||
income_nonstatutory_stock_opts = MoneyField(max_length=11, required=False)
|
income_nonstatutory_stock_opts = MoneyField(max_length=11, required=False)
|
||||||
deferred_compensation_409a = MoneyField(max_length=11, required=False)
|
deferred_compensation_409a = MoneyField(max_length=11, required=False)
|
||||||
designated_roth_contrib_401k = MoneyField(max_length=11, required=False)
|
designated_roth_contrib_401k = MoneyField(max_length=11, required=False)
|
||||||
designated_roth_contrib_403b = MoneyField(max_length=11, required=False)
|
designated_roth_contrib_403b = MoneyField(max_length=11, required=False)
|
||||||
blank3 = BlankField(max_length=12)
|
employer_sponsored_health = MoneyField(max_length=11, required=False)
|
||||||
|
blank4 = BlankField(max_length=12)
|
||||||
statutory_employee_indicator = BooleanField()
|
statutory_employee_indicator = BooleanField()
|
||||||
blank4 = BlankField(max_length=1)
|
blank5 = BlankField(max_length=1)
|
||||||
retirement_plan_indicator = BooleanField()
|
retirement_plan_indicator = BooleanField()
|
||||||
third_party_sick_pay = BooleanField()
|
third_party_sick_pay = BooleanField()
|
||||||
blank5 = BlankField(max_length=23)
|
blank6 = BlankField(max_length=23)
|
||||||
|
|
||||||
def validate_ssn(self, f):
|
def validate_ssn(self, f):
|
||||||
if str(f.value).startswith('666','9'):
|
if str(f.value).startswith('666','9'):
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue