Renamed the TrialBalanceTotal class to Total, to be short and clear.

This commit is contained in:
依瑪貓 2023-03-08 17:56:57 +08:00
parent 729a7fd107
commit f277010991

View File

@ -55,8 +55,8 @@ class ReportAccount:
"""The URL to the ledger of the account.""" """The URL to the ledger of the account."""
class TrialBalanceTotal: class Total:
"""The total in the trial balance.""" """The totals."""
def __init__(self, debit: Decimal, credit: Decimal): def __init__(self, debit: Decimal, credit: Decimal):
"""Constructs the total in the trial balance. """Constructs the total in the trial balance.
@ -104,7 +104,7 @@ class PageParams(BasePageParams):
def __init__(self, currency: Currency, def __init__(self, currency: Currency,
period: Period, period: Period,
accounts: list[ReportAccount], accounts: list[ReportAccount],
total: TrialBalanceTotal): total: Total):
"""Constructs the HTML page parameters. """Constructs the HTML page parameters.
:param currency: The currency. :param currency: The currency.
@ -118,7 +118,7 @@ class PageParams(BasePageParams):
"""The period.""" """The period."""
self.accounts: list[ReportAccount] = accounts self.accounts: list[ReportAccount] = accounts
"""The accounts in the trial balance.""" """The accounts in the trial balance."""
self.total: TrialBalanceTotal = total self.total: Total = total
"""The total of the trial balance.""" """The total of the trial balance."""
self.period_chooser: TrialBalancePeriodChooser \ self.period_chooser: TrialBalancePeriodChooser \
= TrialBalancePeriodChooser(currency) = TrialBalancePeriodChooser(currency)
@ -178,7 +178,7 @@ class TrialBalance(BaseReport):
"""The period.""" """The period."""
self.__accounts: list[ReportAccount] self.__accounts: list[ReportAccount]
"""The accounts in the trial balance.""" """The accounts in the trial balance."""
self.__total: TrialBalanceTotal self.__total: Total
"""The total of the trial balance.""" """The total of the trial balance."""
self.__set_data() self.__set_data()
@ -224,7 +224,7 @@ class TrialBalance(BaseReport):
amount=x.balance, amount=x.balance,
url=get_url(accounts[x.id])) url=get_url(accounts[x.id]))
for x in balances] for x in balances]
self.__total = TrialBalanceTotal( self.__total = Total(
sum([x.debit for x in self.__accounts if x.debit is not None]), sum([x.debit for x in self.__accounts if x.debit is not None]),
sum([x.credit for x in self.__accounts if x.credit is not None])) sum([x.credit for x in self.__accounts if x.credit is not None]))