[BUG] Balance sheet display order incorrect - should be Assets, Liabilities, Equity #24

Open
opened 2026-03-15 17:03:53 +00:00 by Francy51 · 1 comment
Owner

Description

The balance sheet is displaying items in an incorrect order. Per standard accounting presentation, the order should be:

  1. Assets (current then non-current)
  2. Liabilities (current then non-current)
  3. Equity

Current Template Order

From lib/server/financials/standard-template.ts, the template defines correct order numbers:

  • Assets: order 10-150
  • Liabilities: order 160-260
  • Equity: order 270-310

Surface Display Order

From lib/server/financials/surface.ts:77-96:

balance: [
  { key: 'cash_and_equivalents', order: 10 },      // Asset
  { key: 'receivables', order: 20 },               // Asset
  { key: 'inventory', order: 30 },                 // Asset
  { key: 'current_assets', order: 40 },            // Asset
  { key: 'ppe', order: 50 },                       // Asset
  { key: 'goodwill_and_intangibles', order: 60 },  // Asset
  { key: 'total_assets', order: 70 },              // Asset
  { key: 'current_liabilities', order: 80 },       // Liability
  { key: 'debt', order: 90 },                      // Liability
  { key: 'total_liabilities', order: 100 },        // Liability
  { key: 'shareholders_equity', order: 110 }       // Equity
]

Problem

The surface definitions appear correct in order, but:

  1. Items may not be grouped visually by category (assets, liabilities, equity)
  2. Some items may have incorrect category values
  3. The view model sorting in statement-view-model.ts sorts by order but doesn't create visual section breaks

Proposed Fix

  1. Verify all balance sheet items have correct category field (assets, liabilities, equity)
  2. Add visual section headers/Grouping in the UI for Assets, Liabilities, Equity
  3. Ensure any unmapped balance sheet items are categorized correctly

Files Affected

  • lib/server/financials/standard-template.ts
  • lib/server/financials/surface.ts
  • lib/financials/statement-view-model.ts
  • UI components displaying balance sheet
## Description The balance sheet is displaying items in an incorrect order. Per standard accounting presentation, the order should be: 1. **Assets** (current then non-current) 2. **Liabilities** (current then non-current) 3. **Equity** ## Current Template Order From `lib/server/financials/standard-template.ts`, the template defines correct order numbers: - Assets: order 10-150 - Liabilities: order 160-260 - Equity: order 270-310 ## Surface Display Order From `lib/server/financials/surface.ts:77-96`: ```typescript balance: [ { key: 'cash_and_equivalents', order: 10 }, // Asset { key: 'receivables', order: 20 }, // Asset { key: 'inventory', order: 30 }, // Asset { key: 'current_assets', order: 40 }, // Asset { key: 'ppe', order: 50 }, // Asset { key: 'goodwill_and_intangibles', order: 60 }, // Asset { key: 'total_assets', order: 70 }, // Asset { key: 'current_liabilities', order: 80 }, // Liability { key: 'debt', order: 90 }, // Liability { key: 'total_liabilities', order: 100 }, // Liability { key: 'shareholders_equity', order: 110 } // Equity ] ``` ## Problem The surface definitions appear correct in order, but: 1. Items may not be grouped visually by category (assets, liabilities, equity) 2. Some items may have incorrect `category` values 3. The view model sorting in `statement-view-model.ts` sorts by order but doesn't create visual section breaks ## Proposed Fix 1. Verify all balance sheet items have correct `category` field (`assets`, `liabilities`, `equity`) 2. Add visual section headers/Grouping in the UI for Assets, Liabilities, Equity 3. Ensure any unmapped balance sheet items are categorized correctly ## Files Affected - `lib/server/financials/standard-template.ts` - `lib/server/financials/surface.ts` - `lib/financials/statement-view-model.ts` - UI components displaying balance sheet
Author
Owner

Update: Root Cause Analysis

The Rust sidecar IS being used. The balance sheet order IS correctly defined in rust/taxonomy/fiscal/v1/core.surface.json.

Current Order (from core.surface.json):

  • Assets (order 10-150): cash_and_equivalents → total_assets
  • Liabilities (order 160-300): accounts_payable → total_liabilities
  • Equity (order 310-360): common_stock → total_liabilities_and_equity

Problem:

The order values ARE correct in the JSON, but the UI may not be:

  1. Grouping items visually by category (current_assets, noncurrent_assets, current_liabilities, etc.)
  2. Adding section headers/visual breaks between Assets, Liabilities, Equity
  3. The category field in surface definitions is set but may not be used for grouping in the UI

Evidence from core.surface.json:

// Assets
{ "surface_key": "cash_and_equivalents", "category": "current_assets", "order": 10 }
{ "surface_key": "total_assets", "category": "derived", "order": 150 }

// Liabilities  
{ "surface_key": "accounts_payable", "category": "current_liabilities", "order": 160 }
{ "surface_key": "total_liabilities", "category": "derived", "order": 300 }

// Equity
{ "surface_key": "common_stock", "category": "equity", "order": 310 }
{ "surface_key": "total_equity", "category": "equity", "order": 350 }

Fix Required:

  1. UI-side: Add visual grouping/section headers based on category field
  2. Verify: Check if the statement-view-model.ts correctly groups by category
  3. Consider: Add a section field (assets/liabilities/equity) in addition to category for clearer grouping

Files to Review:

  • lib/financials/statement-view-model.ts - Check tree node grouping logic
  • UI components that render balance sheet - Add section headers
## Update: Root Cause Analysis **The Rust sidecar IS being used.** The balance sheet order IS correctly defined in `rust/taxonomy/fiscal/v1/core.surface.json`. ### Current Order (from core.surface.json): - **Assets** (order 10-150): cash_and_equivalents → total_assets - **Liabilities** (order 160-300): accounts_payable → total_liabilities - **Equity** (order 310-360): common_stock → total_liabilities_and_equity ### Problem: The order values ARE correct in the JSON, but the UI may not be: 1. Grouping items visually by category (current_assets, noncurrent_assets, current_liabilities, etc.) 2. Adding section headers/visual breaks between Assets, Liabilities, Equity 3. The `category` field in surface definitions is set but may not be used for grouping in the UI ### Evidence from core.surface.json: ```json // Assets { "surface_key": "cash_and_equivalents", "category": "current_assets", "order": 10 } { "surface_key": "total_assets", "category": "derived", "order": 150 } // Liabilities { "surface_key": "accounts_payable", "category": "current_liabilities", "order": 160 } { "surface_key": "total_liabilities", "category": "derived", "order": 300 } // Equity { "surface_key": "common_stock", "category": "equity", "order": 310 } { "surface_key": "total_equity", "category": "equity", "order": 350 } ``` ### Fix Required: 1. **UI-side**: Add visual grouping/section headers based on `category` field 2. **Verify**: Check if the statement-view-model.ts correctly groups by category 3. **Consider**: Add a `section` field (assets/liabilities/equity) in addition to category for clearer grouping ### Files to Review: - `lib/financials/statement-view-model.ts` - Check tree node grouping logic - UI components that render balance sheet - Add section headers
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: Francy51/Neon-Desk#24