fund: Fund report columns more closely match the audit report.
This commit is contained in:
parent
5978c2f0c2
commit
d6821b1368
2 changed files with 23 additions and 9 deletions
|
@ -117,7 +117,7 @@ class ODSReport(core.BaseODS[FundPosts, None]):
|
|||
stylename=center_bold),
|
||||
self.string_cell("Income", stylename=center_bold),
|
||||
self.string_cell("Expenses", stylename=center_bold),
|
||||
self.multiline_cell(["Realized", "Gain/Loss"], stylename=center_bold),
|
||||
self.string_cell("Equity", stylename=center_bold),
|
||||
self.multiline_cell(["Balance as of", self.stop_date.isoformat()],
|
||||
stylename=center_bold),
|
||||
self.multiline_cell(["Of Which", "Receivable"], stylename=center_bold),
|
||||
|
@ -137,23 +137,36 @@ class ODSReport(core.BaseODS[FundPosts, None]):
|
|||
def end_spreadsheet(self) -> None:
|
||||
sheet = self.copy_element(self.sheet)
|
||||
sheet.setAttribute('name', 'Fund Report')
|
||||
row_qname = sheet.lastChild.qname
|
||||
row_qname = odf.table.TableRow().qname
|
||||
skip_rows: List[int] = []
|
||||
report_threshold = Decimal('.5')
|
||||
first_row = True
|
||||
for index, row in enumerate(sheet.childNodes):
|
||||
row.childNodes = row.childNodes[:6]
|
||||
if len(row.childNodes) < 6:
|
||||
continue
|
||||
row.childNodes = [*row.childNodes[:4], row.childNodes[5]]
|
||||
if row.qname != row_qname:
|
||||
pass
|
||||
elif first_row:
|
||||
ref_child = row.childNodes[2]
|
||||
stylename = ref_child.getAttribute('stylename')
|
||||
row.insertBefore(self.string_cell(
|
||||
"Additions", stylename=stylename,
|
||||
), ref_child)
|
||||
row.insertBefore(self.multiline_cell(
|
||||
["Releases from", "Restrictions"], stylename=stylename,
|
||||
), ref_child)
|
||||
del row.childNodes[4:6]
|
||||
first_row = False
|
||||
# Filter out fund rows that don't have anything reportable.
|
||||
if (row.qname == row_qname
|
||||
# len(childNodes) makes sure this isn't a header/spacer row.
|
||||
and len(row.childNodes) == 6
|
||||
and not any(
|
||||
elif not any(
|
||||
# Multiple childNodes means it's a multi-currency balance.
|
||||
len(cell.childNodes) > 1
|
||||
# Some column has to round up to 1 to be reportable.
|
||||
or (cell.getAttribute('valuetype') == 'currency'
|
||||
and Decimal(cell.getAttribute('value')) >= report_threshold)
|
||||
for cell in row.childNodes
|
||||
)):
|
||||
):
|
||||
skip_rows.append(index)
|
||||
for index in reversed(skip_rows):
|
||||
del sheet.childNodes[index]
|
||||
|
|
|
@ -185,6 +185,7 @@ def check_ods_sheet(sheet, account_balances, *, full):
|
|||
check_cell_balance(next(cells), balances['opening'])
|
||||
check_cell_balance(next(cells), balances['Income'])
|
||||
check_cell_balance(next(cells), -balances['Expenses'])
|
||||
if full:
|
||||
check_cell_balance(next(cells), balances['Equity:Realized'])
|
||||
check_cell_balance(next(cells), sum(balances[key] for key in [
|
||||
'opening', 'Income', 'Expenses', 'Equity:Realized',
|
||||
|
|
Loading…
Reference in a new issue