ledger
Module for accounting ledger.
Classes:
-
Ledger
–A class representing a ledger.
Ledger
dataclass
Ledger(
chart_of_accounts: ChartOfAccounts,
journal: Journal = Journal(),
date_closed: date | None = None,
)
A class representing a ledger.
Methods:
-
close_contra_accounts
–Close contra income and contra expense accounts.
-
close_income_and_expense_accounts
–Close all income and expense accounts.
-
close_income_summary_account
–Close the Income Summary account.
-
close_ledger
–Close the ledger at the end of an accounting period.
-
generate_closing_entry
–Generate a closing entry for a given account at a specific date.
-
get_account_balances
–Retrieve the balances of all accounts.
-
get_accounts_by_type
–Retrieve all accounts of a given account type.
-
post
–Post a journal entry to the ledger.
-
set_account_balances
–Set the starting balances of accounts based on their normal balances (debit or credit).
Attributes:
-
coa
(ChartOfAccounts
) –Return the chart of accounts.
close_contra_accounts
close_contra_accounts(date: date) -> None
Close contra income and contra expense accounts.
Contra accounts are not closed to ISA, but closed to the original income or expense accounts.
close_income_and_expense_accounts
close_income_and_expense_accounts(date: date) -> None
Close all income and expense accounts.
close_income_summary_account
close_income_summary_account(date: date) -> None
Close the Income Summary account.
close_ledger
close_ledger(date: date) -> None
Close the ledger at the end of an accounting period.
generate_closing_entry
generate_closing_entry(
account: TAccount, date: date
) -> CompoundEntry
Generate a closing entry for a given account at a specific date.
get_account_balances
get_account_balances() -> AccountBalances
Retrieve the balances of all accounts.
get_accounts_by_type
get_accounts_by_type(
account_type: AccountType,
) -> list[TAccount]
Retrieve all accounts of a given account type.
set_account_balances
set_account_balances(balances: AccountBalances) -> None
Set the starting balances of accounts based on their normal balances (debit or credit).