statement_viewer
Module for generating views of accounting statements.
Classes:
-
HTMLStatementViewer
–Concrete visitor for generating HTML view of statements.
-
StatementVisitor
–Interface for statement visitors.
-
TextStatementViewer
–Concrete visitor for generating plain text view of statements.
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
–Recursively add account rows to the table.
-
add_account_debit_credit_rows
–Recursively add account rows to the table.
-
format_amount
–Return Text object with green for positive and red for negative values.
-
visit_balance_sheet
–Generate view for BalanceSheet.
-
visit_income_statement
–Generate view for IncomeStatement.
-
visit_trial_balance
–Generate view for TrialBalance.
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
–Generate view for BalanceSheet.
-
visit_income_statement
–Generate view for IncomeStatement.
-
visit_trial_balance
–Generate view for TrialBalance.
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
–Generate view for BalanceSheet.
-
visit_income_statement
–Generate view for IncomeStatement.
-
visit_trial_balance
–Generate view for TrialBalance.
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.