Skip to content

statement_viewer

Module for generating views of accounting statements.

Classes:

HTMLStatementViewer

HTMLStatementViewer(
    *,
    padding: int = 2,
    trial_balance_table_width: int | None = None,
    income_statement_table_width: int | None = None,
    balance_sheet_table_width: int | None = None,
    console: bool = True,
    jupyter: bool = False,
    hide_zero_balance_accounts: bool = False,
)

Bases: StatementVisitor

Concrete visitor for generating HTML view of statements.

Methods:

add_account_balance_rows

add_account_balance_rows(
    account: TAccount, table: Table, account_level: int = 1
) -> None

Recursively add account rows to the table.

add_account_debit_credit_rows

add_account_debit_credit_rows(
    account: TAccount,
    statement: TrialBalance,
    table: Table,
    account_level: int = 1,
) -> None

Recursively add account rows to the table.

format_amount staticmethod

format_amount(amount: float) -> Text

Return Text object with green for positive and red for negative values.

visit_balance_sheet

visit_balance_sheet(statement: BalanceSheet) -> str

Generate view for BalanceSheet.

visit_income_statement

visit_income_statement(statement: IncomeStatement) -> str

Generate view for IncomeStatement.

visit_trial_balance

visit_trial_balance(statement: TrialBalance) -> str

Generate view for TrialBalance.

StatementVisitor

Bases: ABC

Interface for statement visitors.

Methods:

visit_balance_sheet abstractmethod

visit_balance_sheet(statement: BalanceSheet) -> str

Generate view for BalanceSheet.

visit_income_statement abstractmethod

visit_income_statement(statement: IncomeStatement) -> str

Generate view for IncomeStatement.

visit_trial_balance abstractmethod

visit_trial_balance(statement: TrialBalance) -> str

Generate view for TrialBalance.

TextStatementViewer

Bases: StatementVisitor

Concrete visitor for generating plain text view of statements.

Methods:

visit_balance_sheet

visit_balance_sheet(statement: BalanceSheet) -> str

Generate view for BalanceSheet.

visit_income_statement

visit_income_statement(statement: IncomeStatement) -> str

Generate view for IncomeStatement.

visit_trial_balance

visit_trial_balance(statement: TrialBalance) -> str

Generate view for TrialBalance.