Revised the indent in the views of the accounting application.

This commit is contained in:
依瑪貓 2020-07-19 18:54:44 +08:00
parent 36c9aaa975
commit 119349868d

View File

@ -162,8 +162,9 @@ def cash(request, subject_code, period_spec):
Q(subject__code__startswith="12") | Q(subject__code__startswith="12") |
Q(subject__code__startswith="21") | Q(subject__code__startswith="21") |
Q(subject__code__startswith="21")))\ Q(subject__code__startswith="21")))\
.aggregate(balance=Coalesce(Sum(Case(When( .aggregate(
is_credit=True, then=-1), balance=Coalesce(Sum(Case(
When(is_credit=True, then=-1),
default=1) * F("amount")), 0))["balance"] default=1) * F("amount")), 0))["balance"]
else: else:
records = list(Record.objects.filter( records = list(Record.objects.filter(
@ -176,7 +177,8 @@ def cash(request, subject_code, period_spec):
balance_before = Record.objects.filter( balance_before = Record.objects.filter(
transaction__date__lt=period.start, transaction__date__lt=period.start,
subject__code__startswith=current_subject.code)\ subject__code__startswith=current_subject.code)\
.aggregate(balance=Coalesce(Sum(Case(When( .aggregate(
balance=Coalesce(Sum(Case(When(
is_credit=True, then=-1), is_credit=True, then=-1),
default=1) * F("amount")), 0))["balance"] default=1) * F("amount")), 0))["balance"]
balance = balance_before balance = balance_before
@ -343,7 +345,8 @@ def ledger(request, subject_code, period_spec):
balance = Record.objects.filter( balance = Record.objects.filter(
transaction__date__lt=period.start, transaction__date__lt=period.start,
subject__code__startswith=current_subject.code)\ subject__code__startswith=current_subject.code)\
.aggregate(balance=Coalesce(Sum(Case(When( .aggregate(
balance=Coalesce(Sum(Case(When(
is_credit=True, then=-1), is_credit=True, then=-1),
default=1) * F("amount")), 0))["balance"] default=1) * F("amount")), 0))["balance"]
record_brought_forward = Record( record_brought_forward = Record(