maybe good
This commit is contained in:
67
app/models/files.py
Normal file
67
app/models/files.py
Normal file
@@ -0,0 +1,67 @@
|
||||
"""
|
||||
File Cabinet models based on legacy FILCABNT.SC analysis
|
||||
"""
|
||||
from sqlalchemy import Column, Integer, String, Date, Text, Float, ForeignKey, Boolean
|
||||
from sqlalchemy.orm import relationship
|
||||
from decimal import Decimal
|
||||
from app.models.base import BaseModel
|
||||
|
||||
|
||||
class File(BaseModel):
|
||||
"""
|
||||
Client files/cases with financial tracking
|
||||
Corresponds to FILES table in legacy system
|
||||
"""
|
||||
__tablename__ = "files"
|
||||
|
||||
file_no = Column(String(45), primary_key=True, index=True) # Unique file number
|
||||
id = Column(String(80), ForeignKey("rolodex.id"), nullable=False) # File owner ID
|
||||
regarding = Column(Text) # Description of matter
|
||||
empl_num = Column(String(10), nullable=False) # Assigned attorney/employee
|
||||
file_type = Column(String(45), nullable=False) # Area of law
|
||||
|
||||
# Dates
|
||||
opened = Column(Date, nullable=False) # Date file opened
|
||||
closed = Column(Date) # Date file closed
|
||||
|
||||
# Status and billing
|
||||
status = Column(String(45), nullable=False) # ACTIVE, INACTIVE, FOLLOW UP, etc.
|
||||
footer_code = Column(String(45)) # Statement footer code
|
||||
opposing = Column(String(80)) # Opposing attorney ID
|
||||
rate_per_hour = Column(Float, nullable=False) # Hourly billing rate
|
||||
|
||||
# Account balances - previously billed
|
||||
trust_bal_p = Column(Float, default=0.0) # Trust account balance (billed)
|
||||
hours_p = Column(Float, default=0.0) # Hours (billed)
|
||||
hourly_fees_p = Column(Float, default=0.0) # Hourly fees (billed)
|
||||
flat_fees_p = Column(Float, default=0.0) # Flat fees (billed)
|
||||
disbursements_p = Column(Float, default=0.0) # Disbursements (billed)
|
||||
credit_bal_p = Column(Float, default=0.0) # Credit balance (billed)
|
||||
total_charges_p = Column(Float, default=0.0) # Total charges (billed)
|
||||
amount_owing_p = Column(Float, default=0.0) # Amount owing (billed)
|
||||
|
||||
# Account balances - current totals
|
||||
trust_bal = Column(Float, default=0.0) # Trust account balance (total)
|
||||
hours = Column(Float, default=0.0) # Total hours
|
||||
hourly_fees = Column(Float, default=0.0) # Total hourly fees
|
||||
flat_fees = Column(Float, default=0.0) # Total flat fees
|
||||
disbursements = Column(Float, default=0.0) # Total disbursements
|
||||
credit_bal = Column(Float, default=0.0) # Total credit balance
|
||||
total_charges = Column(Float, default=0.0) # Total charges
|
||||
amount_owing = Column(Float, default=0.0) # Total amount owing
|
||||
transferable = Column(Float, default=0.0) # Amount transferable from trust
|
||||
|
||||
# Notes
|
||||
memo = Column(Text) # File notes
|
||||
|
||||
# Relationships
|
||||
owner = relationship("Rolodex", back_populates="files")
|
||||
ledger_entries = relationship("Ledger", back_populates="file", cascade="all, delete-orphan")
|
||||
qdros = relationship("QDRO", back_populates="file", cascade="all, delete-orphan")
|
||||
pensions = relationship("Pension", back_populates="file", cascade="all, delete-orphan")
|
||||
pension_schedules = relationship("PensionSchedule", back_populates="file", cascade="all, delete-orphan")
|
||||
marriage_history = relationship("MarriageHistory", back_populates="file", cascade="all, delete-orphan")
|
||||
death_benefits = relationship("DeathBenefit", back_populates="file", cascade="all, delete-orphan")
|
||||
separation_agreements = relationship("SeparationAgreement", back_populates="file", cascade="all, delete-orphan")
|
||||
payments = relationship("Payment", back_populates="file", cascade="all, delete-orphan")
|
||||
notes = relationship("FileNote", back_populates="file", cascade="all, delete-orphan")
|
||||
Reference in New Issue
Block a user