Fixed the ledger when there is no brought-forward records in the accounting application.

This commit is contained in:
依瑪貓 2020-07-17 23:34:00 +08:00
parent 4c821a73ea
commit 39428d1d35

View File

@ -427,7 +427,7 @@ def ledger(request, subject_code, period_spec):
period.start - timedelta(days=1), period.start - timedelta(days=1),
current_subject.code + "%"]) current_subject.code + "%"])
row = cursor.fetchone() row = cursor.fetchone()
balance = row[0] balance = 0 if row[0] is None else row[0]
record_brought_forward = Record( record_brought_forward = Record(
transaction=Transaction( transaction=Transaction(
date=records[-1].transaction.date), date=records[-1].transaction.date),