Spaces:
Sleeping
Sleeping
| from sqlalchemy.orm import Session | |
| from app.db.models import Account, TaxLine, AccountTaxMapping | |
| def initialize_startup_coa(db: Session, user_id: str): | |
| """ | |
| Creates a standard Chart of Accounts (COA) for a new startup user | |
| and maps those accounts to the correct IRS Tax Lines. | |
| """ | |
| # 1. Create the standard buckets (Accounts) | |
| accounts_data = [ | |
| # ASSETS | |
| {"name": "Checking Account", "type": "ASSET", "desc": "Primary business bank account"}, | |
| # LIABILITIES | |
| {"name": "Credit Card", "type": "LIABILITY", "desc": "Corporate credit card liability"}, | |
| # REVENUE | |
| {"name": "Revenue", "type": "REVENUE", "desc": "Customer payments and sales income"}, | |
| {"name": "SaaS Subscriptions Revenue", "type": "REVENUE", "desc": "Recurring software subscription revenue"}, | |
| # EXPENSES — SG&A (Sales, General & Admin) — Kruze Consulting / Pilot.com standard | |
| {"name": "Payroll", "type": "EXPENSE", "desc": "W-2 gross wages and salaries"}, | |
| {"name": "Payroll Taxes", "type": "EXPENSE", "desc": "Employer FICA, FUTA, SUTA"}, | |
| {"name": "Software Subscriptions", "type": "EXPENSE", "desc": "AWS, GitHub, Slack, Notion, Figma"}, | |
| {"name": "Advertising", "type": "EXPENSE", "desc": "Google Ads, Facebook, LinkedIn"}, | |
| {"name": "Travel", "type": "EXPENSE", "desc": "Flights, hotels, car rental"}, | |
| {"name": "Meals & Entertainment", "type": "EXPENSE", "desc": "Client dinners, team meals (50% deductible)"}, | |
| {"name": "Rent & Office", "type": "EXPENSE", "desc": "Office lease, co-working space (WeWork)"}, | |
| {"name": "Professional Services", "type": "EXPENSE", "desc": "Legal, accounting, consulting fees"}, | |
| {"name": "Utilities & Communications", "type": "EXPENSE", "desc": "Internet, phone, electricity"}, | |
| {"name": "Insurance", "type": "EXPENSE", "desc": "Business, D&O, E&O insurance"}, | |
| {"name": "Office Supplies", "type": "EXPENSE", "desc": "Stationery, equipment, hardware"}, | |
| {"name": "Contractor Payments", "type": "EXPENSE", "desc": "1099-NEC independent contractors"}, | |
| {"name": "Bank Fees", "type": "EXPENSE", "desc": "Wire fees, monthly bank charges"}, | |
| ] | |
| for acc in accounts_data: | |
| new_account = Account( | |
| user_id=user_id, | |
| name=acc["name"], | |
| account_type=acc["type"], | |
| description=acc["desc"] | |
| ) | |
| db.add(new_account) | |
| db.commit() | |
| print(f"✅ Generated Chart of Accounts for User {user_id}") | |
| # In the future, we will add the TaxLine mappings here! |