Fixed the sign of the liabilities and owner's equity in the balance sheet in the accounting application.

This commit is contained in:
依瑪貓 2020-07-22 10:26:04 +08:00
parent c7ab277698
commit 968516c472

View File

@ -778,7 +778,7 @@ def balance_sheet(request, period):
default=1) * F("amount")))["balance"] default=1) * F("amount")))["balance"]
if balance is not None and balance != 0: if balance is not None and balance != 0:
brought_forward = Account.objects.get(code="3351") brought_forward = Account.objects.get(code="3351")
brought_forward.balance = -balance brought_forward.balance = balance
brought_forward.url = reverse( brought_forward.url = reverse(
"accounting:income-statement", args=(period,)) "accounting:income-statement", args=(period,))
accounts.append(brought_forward) accounts.append(brought_forward)
@ -796,10 +796,12 @@ def balance_sheet(request, period):
default=1) * F("amount")))["balance"] default=1) * F("amount")))["balance"]
if balance is not None and balance != 0: if balance is not None and balance != 0:
net_income = Account.objects.get(code="3353") net_income = Account.objects.get(code="3353")
net_income.balance = -balance net_income.balance = balance
net_income.url = reverse( net_income.url = reverse(
"accounting:income-statement", args=(period,)) "accounting:income-statement", args=(period,))
accounts.append(net_income) accounts.append(net_income)
for account in [x for x in accounts if x.code[0] in "23"]:
account.balance = -account.balance
groups = list(Account.objects.filter( groups = list(Account.objects.filter(
code__in=[x.code[:2] for x in accounts])) code__in=[x.code[:2] for x in accounts]))
sections = list(Account.objects.filter( sections = list(Account.objects.filter(