From 3c200d0dc6748e160f3645ed1b3fef65721330e0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E4=BE=9D=E7=91=AA=E8=B2=93?= Date: Tue, 7 Mar 2023 23:15:46 +0800 Subject: [PATCH] Fixed the sign of the amount in income statement. --- src/accounting/report/reports/income_statement.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/accounting/report/reports/income_statement.py b/src/accounting/report/reports/income_statement.py index 8ec99f7..97697b7 100644 --- a/src/accounting/report/reports/income_statement.py +++ b/src/accounting/report/reports/income_statement.py @@ -272,8 +272,8 @@ class IncomeStatement: if self.__period.end is not None: conditions.append(Transaction.date <= self.__period.end) balance_func: sa.Function = sa.func.sum(sa.case( - (JournalEntry.is_debit, JournalEntry.amount), - else_=-JournalEntry.amount)).label("balance") + (JournalEntry.is_debit, -JournalEntry.amount), + else_=JournalEntry.amount)).label("balance") select_balance: sa.Select \ = sa.select(JournalEntry.account_id, balance_func)\ .join(Transaction).join(Account)\