# /// script # requires-python = ">=3.12" # dependencies = [] # exclude-newer = "2026-08-08T00:00:00Z" # /// """Readable equity-register and shareholders' equity close for Cedar Trail.""" from __future__ import annotations def money(amount: float) -> str: return f"({abs(amount):,.2f})" if amount < 0 else f"{amount:,.2f}" def shares(amount: float) -> str: return f"{amount:,.0f}" def show(title: str, rows: list[tuple[str, float]], formatter=money) -> None: print(f"\n{title}\n{'-' * len(title)}") width = max(len(label) for label, _ in rows) for label, value in rows: print(f"{label:<{width}} {formatter(value):>18}") # Opening legal register and equity accounts. authorized = 5_000_000.0 issued = 1_000_000.0 treasury_shares = 40_000.0 par = 1.00 common_stock = 1_000_000.00 preferred_stock = 2_000_000.00 apic = 4_800_000.00 retained_earnings = 6_200_000.00 aoci = -120_000.00 treasury_cost = 520_000.00 opening_equity = common_stock + preferred_stock + apic + retained_earnings + aoci - treasury_cost show( "Opening share register", [ ("Authorized", authorized), ("Issued", issued), ("Treasury", treasury_shares), ("Outstanding", issued - treasury_shares), ], shares, ) # April issuance: direct qualifying issue costs reduce equity proceeds. issue_shares = 200_000.0 gross_proceeds = 3_600_000.00 issue_costs = 120_000.00 net_proceeds = gross_proceeds - issue_costs issued += issue_shares common_stock += issue_shares * par apic += net_proceeds - issue_shares * par # September repurchase and November reissue use the cost method. repurchased_shares = 60_000.0 repurchase_cost = 900_000.00 treasury_shares += repurchased_shares treasury_cost += repurchase_cost reissued_shares = 20_000.0 reissue_cash = 340_000.00 cost_released = 300_000.00 treasury_shares -= reissued_shares treasury_cost -= cost_released apic += reissue_cash - cost_released show( "Pre-split share register", [("Issued", issued), ("Treasury", treasury_shares), ("Outstanding", issued - treasury_shares)], shares, ) # The split changes units and par, never total equity. split_factor = 2.0 authorized *= split_factor issued *= split_factor treasury_shares *= split_factor par /= split_factor # Preferred dividend priority under supplied class terms. preferred_shares = 40_000.0 preferred_stated_value = 50.00 preferred_rate = 0.06 opening_arrears = 120_000.00 declared_dividends = 600_000.00 current_preference = preferred_shares * preferred_stated_value * preferred_rate preferred_allocation = min(declared_dividends, opening_arrears + current_preference) common_allocation = declared_dividends - preferred_allocation net_income = 2_400_000.00 oci = 80_000.00 retained_earnings += net_income - declared_dividends aoci += oci ending_equity = common_stock + preferred_stock + apic + retained_earnings + aoci - treasury_cost show( "Dividend waterfall", [ ("Opening preferred arrears", opening_arrears), ("Current preferred dividend", current_preference), ("Preferred allocation", preferred_allocation), ("Common allocation", common_allocation), ], ) show( "Ending share register", [ ("Authorized", authorized), ("Issued", issued), ("Treasury", treasury_shares), ("Outstanding", issued - treasury_shares), ("Par per share", par), ], shares, ) show( "Ending shareholders' equity", [ ("Preferred stock", preferred_stock), ("Common stock", common_stock), ("APIC", apic), ("Retained earnings", retained_earnings), ("AOCI", aoci), ("Treasury stock", -treasury_cost), ("Total equity", ending_equity), ], ) # Independent total-equity bridge. The split contributes zero. bridge = ( opening_equity + net_proceeds - repurchase_cost + reissue_cash + net_income + oci - declared_dividends ) assert abs(common_stock - issued * par) < 0.01 assert abs(preferred_allocation - 240_000.00) < 0.01 assert abs(common_allocation - 360_000.00) < 0.01 assert abs((issued - treasury_shares) - 2_240_000.0) < 0.01 assert abs(ending_equity - 18_160_000.00) < 0.01 assert abs(ending_equity - bridge) < 0.01 print("\nArithmetic controls: PASS")