272 lines
9.7 KiB
Python
272 lines
9.7 KiB
Python
"""
|
|
Lookup table models based on legacy system analysis
|
|
"""
|
|
from sqlalchemy import Column, Integer, String, Text, Boolean, Float, ForeignKey
|
|
from app.models.base import BaseModel
|
|
|
|
|
|
class Employee(BaseModel):
|
|
"""
|
|
Employee/Staff information
|
|
Corresponds to EMPLOYEE table in legacy system
|
|
"""
|
|
__tablename__ = "employees"
|
|
|
|
empl_num = Column(String(10), primary_key=True, index=True) # Employee number
|
|
first_name = Column(String(50)) # First name
|
|
last_name = Column(String(100), nullable=False) # Last name
|
|
title = Column(String(100)) # Job title
|
|
initials = Column(String(10)) # Initials for billing
|
|
rate_per_hour = Column(Float, default=0.0) # Default hourly rate
|
|
active = Column(Boolean, default=True) # Is employee active
|
|
email = Column(String(100)) # Email address
|
|
phone = Column(String(20)) # Phone number
|
|
|
|
def __repr__(self):
|
|
return f"<Employee(empl_num='{self.empl_num}', name='{self.first_name} {self.last_name}')>"
|
|
|
|
|
|
class FileType(BaseModel):
|
|
"""
|
|
File/Case types (areas of law)
|
|
Corresponds to FILETYPE table in legacy system
|
|
"""
|
|
__tablename__ = "file_types"
|
|
|
|
type_code = Column(String(45), primary_key=True, index=True) # Type code
|
|
description = Column(String(200), nullable=False) # Description
|
|
default_rate = Column(Float, default=0.0) # Default hourly rate
|
|
active = Column(Boolean, default=True) # Is type active
|
|
|
|
def __repr__(self):
|
|
return f"<FileType(code='{self.type_code}', description='{self.description}')>"
|
|
|
|
|
|
class FileStatus(BaseModel):
|
|
"""
|
|
File status codes
|
|
Corresponds to FILESTAT table in legacy system
|
|
"""
|
|
__tablename__ = "file_statuses"
|
|
|
|
status_code = Column(String(45), primary_key=True, index=True) # Status code
|
|
description = Column(String(200), nullable=False) # Description
|
|
active = Column(Boolean, default=True) # Is status active
|
|
sort_order = Column(Integer, default=0) # Display order
|
|
# Legacy fields for typed import support
|
|
send = Column(Boolean, default=True) # Should statements print by default
|
|
footer_code = Column(String(45), ForeignKey("footers.footer_code")) # Default footer
|
|
|
|
def __repr__(self):
|
|
return f"<FileStatus(code='{self.status_code}', description='{self.description}')>"
|
|
|
|
|
|
class TransactionType(BaseModel):
|
|
"""
|
|
Transaction types for ledger entries
|
|
Corresponds to TRNSTYPE table in legacy system
|
|
"""
|
|
__tablename__ = "transaction_types"
|
|
|
|
t_type = Column(String(1), primary_key=True, index=True) # Transaction type code
|
|
description = Column(String(100), nullable=False) # Description
|
|
debit_credit = Column(String(1)) # D=Debit, C=Credit
|
|
footer_code = Column(String(45), ForeignKey("footers.footer_code")) # Default footer for statements (legacy TRNSTYPE Footer)
|
|
active = Column(Boolean, default=True) # Is type active
|
|
|
|
def __repr__(self):
|
|
return f"<TransactionType(type='{self.t_type}', description='{self.description}')>"
|
|
|
|
|
|
class TransactionCode(BaseModel):
|
|
"""
|
|
Transaction codes for ledger entries
|
|
Corresponds to TRNSLKUP table in legacy system
|
|
"""
|
|
__tablename__ = "transaction_codes"
|
|
|
|
t_code = Column(String(10), primary_key=True, index=True) # Transaction code
|
|
description = Column(String(200), nullable=False) # Description
|
|
t_type = Column(String(1)) # Associated transaction type
|
|
default_rate = Column(Float, default=0.0) # Default rate
|
|
active = Column(Boolean, default=True) # Is code active
|
|
|
|
def __repr__(self):
|
|
return f"<TransactionCode(code='{self.t_code}', description='{self.description}')>"
|
|
|
|
|
|
class State(BaseModel):
|
|
"""
|
|
US States and territories
|
|
Corresponds to STATES table in legacy system
|
|
"""
|
|
__tablename__ = "states"
|
|
|
|
abbreviation = Column(String(2), primary_key=True, index=True) # State abbreviation
|
|
name = Column(String(100), nullable=False) # Full state name
|
|
active = Column(Boolean, default=True) # Is state active for selection
|
|
|
|
def __repr__(self):
|
|
return f"<State(abbrev='{self.abbreviation}', name='{self.name}')>"
|
|
|
|
|
|
class GroupLookup(BaseModel):
|
|
"""
|
|
Customer group categories
|
|
Corresponds to GRUPLKUP table in legacy system
|
|
"""
|
|
__tablename__ = "group_lookups"
|
|
|
|
group_code = Column(String(45), primary_key=True, index=True) # Group code
|
|
description = Column(String(200), nullable=False) # Description
|
|
title = Column(String(200)) # Legacy GRUPLKUP Title
|
|
active = Column(Boolean, default=True) # Is group active
|
|
|
|
def __repr__(self):
|
|
return f"<GroupLookup(code='{self.group_code}', description='{self.description}')>"
|
|
|
|
|
|
class Footer(BaseModel):
|
|
"""
|
|
Statement footer templates
|
|
Corresponds to FOOTERS table in legacy system
|
|
"""
|
|
__tablename__ = "footers"
|
|
|
|
footer_code = Column(String(45), primary_key=True, index=True) # Footer code
|
|
content = Column(Text) # Footer content/template
|
|
description = Column(String(200)) # Description
|
|
active = Column(Boolean, default=True) # Is footer active
|
|
|
|
def __repr__(self):
|
|
return f"<Footer(code='{self.footer_code}', description='{self.description}')>"
|
|
|
|
|
|
class PlanInfo(BaseModel):
|
|
"""
|
|
Retirement plan information
|
|
Corresponds to PLANINFO table in legacy system
|
|
"""
|
|
__tablename__ = "plan_info"
|
|
|
|
plan_id = Column(String(45), primary_key=True, index=True) # Plan identifier
|
|
plan_name = Column(String(200), nullable=False) # Plan name
|
|
plan_type = Column(String(45)) # Type of plan (401k, pension, etc.)
|
|
sponsor = Column(String(200)) # Plan sponsor
|
|
administrator = Column(String(200)) # Plan administrator
|
|
address1 = Column(String(100)) # Address line 1
|
|
address2 = Column(String(100)) # Address line 2
|
|
city = Column(String(50)) # City
|
|
state = Column(String(2)) # State abbreviation
|
|
zip_code = Column(String(10)) # ZIP code
|
|
phone = Column(String(20)) # Phone number
|
|
active = Column(Boolean, default=True) # Is plan active
|
|
notes = Column(Text) # Additional notes
|
|
|
|
def __repr__(self):
|
|
return f"<PlanInfo(id='{self.plan_id}', name='{self.plan_name}')>"
|
|
|
|
|
|
class FormIndex(BaseModel):
|
|
"""
|
|
Form templates index
|
|
Corresponds to FORM_INX table in legacy system
|
|
"""
|
|
__tablename__ = "form_index"
|
|
|
|
form_id = Column(String(45), primary_key=True, index=True) # Form identifier (maps to Name)
|
|
form_name = Column(String(200), nullable=False) # Form name
|
|
category = Column(String(45)) # Form category
|
|
keyword = Column(String(200)) # Legacy FORM_INX Name/Keyword pair
|
|
active = Column(Boolean, default=True) # Is form active
|
|
|
|
def __repr__(self):
|
|
return f"<FormIndex(id='{self.form_id}', name='{self.form_name}')>"
|
|
|
|
|
|
class FormList(BaseModel):
|
|
"""
|
|
Form template content
|
|
Corresponds to FORM_LST table in legacy system
|
|
"""
|
|
__tablename__ = "form_list"
|
|
|
|
id = Column(Integer, primary_key=True, autoincrement=True)
|
|
form_id = Column(String(45), nullable=False) # Form identifier
|
|
line_number = Column(Integer, nullable=False) # Line number in form
|
|
content = Column(Text) # Line content
|
|
status = Column(String(45)) # Legacy FORM_LST Status
|
|
|
|
def __repr__(self):
|
|
return f"<FormList(form_id='{self.form_id}', line={self.line_number})>"
|
|
|
|
|
|
class PrinterSetup(BaseModel):
|
|
"""
|
|
Printer configuration
|
|
Corresponds to PRINTERS table in legacy system
|
|
"""
|
|
__tablename__ = "printers"
|
|
|
|
# Core identity and basic configuration
|
|
printer_name = Column(String(100), primary_key=True, index=True) # Printer name
|
|
description = Column(String(200)) # Description
|
|
driver = Column(String(100)) # Print driver
|
|
port = Column(String(20)) # Port/connection
|
|
default_printer = Column(Boolean, default=False) # Is default printer
|
|
active = Column(Boolean, default=True) # Is printer active
|
|
|
|
# Legacy numeric printer number (from PRINTERS.csv "Number")
|
|
number = Column(Integer)
|
|
|
|
# Legacy control sequences and formatting (from PRINTERS.csv)
|
|
page_break = Column(String(50))
|
|
setup_st = Column(String(200))
|
|
reset_st = Column(String(200))
|
|
b_underline = Column(String(100))
|
|
e_underline = Column(String(100))
|
|
b_bold = Column(String(100))
|
|
e_bold = Column(String(100))
|
|
|
|
# Optional report configuration toggles (legacy flags)
|
|
phone_book = Column(Boolean, default=False)
|
|
rolodex_info = Column(Boolean, default=False)
|
|
envelope = Column(Boolean, default=False)
|
|
file_cabinet = Column(Boolean, default=False)
|
|
accounts = Column(Boolean, default=False)
|
|
statements = Column(Boolean, default=False)
|
|
calendar = Column(Boolean, default=False)
|
|
|
|
def __repr__(self):
|
|
return f"<Printer(name='{self.printer_name}', description='{self.description}')>"
|
|
|
|
|
|
class SystemSetup(BaseModel):
|
|
"""
|
|
System configuration settings
|
|
Corresponds to SETUP table in legacy system
|
|
"""
|
|
__tablename__ = "system_setup"
|
|
|
|
setting_key = Column(String(100), primary_key=True, index=True) # Setting key
|
|
setting_value = Column(Text) # Setting value
|
|
description = Column(String(200)) # Description of setting
|
|
setting_type = Column(String(20), default="STRING") # DATA type (STRING, INTEGER, FLOAT, BOOLEAN)
|
|
|
|
def __repr__(self):
|
|
return f"<SystemSetup(key='{self.setting_key}', value='{self.setting_value}')>"
|
|
|
|
|
|
class FormKeyword(BaseModel):
|
|
"""
|
|
Form keyword lookup
|
|
Corresponds to INX_LKUP table in legacy system
|
|
"""
|
|
__tablename__ = "form_keywords"
|
|
|
|
keyword = Column(String(200), primary_key=True, index=True)
|
|
description = Column(String(200))
|
|
active = Column(Boolean, default=True)
|
|
|
|
def __repr__(self):
|
|
return f"<FormKeyword(keyword='{self.keyword}')>" |