maybe good

This commit is contained in:
HotSwapp
2025-08-08 15:55:15 -05:00
parent ab6f163c15
commit b257a06787
80 changed files with 19739 additions and 0 deletions

40
app/models/ledger.py Normal file
View File

@@ -0,0 +1,40 @@
"""
Ledger models based on legacy LEDGER.SC analysis
"""
from sqlalchemy import Column, Integer, String, Date, Float, Boolean, Text, ForeignKey
from sqlalchemy.orm import relationship
from app.models.base import BaseModel
class Ledger(BaseModel):
"""
Financial transactions per case
Corresponds to LEDGER table in legacy system
"""
__tablename__ = "ledger"
id = Column(Integer, primary_key=True, autoincrement=True)
file_no = Column(String(45), ForeignKey("files.file_no"), nullable=False)
item_no = Column(Integer, nullable=False, default=1) # Item number within file
# Transaction details
date = Column(Date, nullable=False) # Transaction date
t_code = Column(String(10), nullable=False) # Transaction code (PMT, FEE, etc.)
t_type = Column(String(1), nullable=False) # Transaction type (1-5)
t_type_l = Column(String(1)) # Transaction type letter (C=Credit, D=Debit, etc.)
# Employee and billing
empl_num = Column(String(10), nullable=False) # Employee number
quantity = Column(Float, default=0.0) # Number of billable units (hours)
rate = Column(Float, default=0.0) # Rate per unit
amount = Column(Float, nullable=False) # Dollar amount
billed = Column(String(1), default="N") # Y/N - has been billed
# Description
note = Column(Text) # Additional notes for transaction
# Relationships
file = relationship("File", back_populates="ledger_entries")
def __repr__(self):
return f"<Ledger(file_no='{self.file_no}', amount={self.amount}, date='{self.date}')>"