Improve formatting of transaction lists

This commit is contained in:
RunasSudo 2020-05-08 23:20:18 +10:00
parent d9a0b5d1b5
commit 456352c88f
Signed by: RunasSudo
GPG Key ID: 7234E476BF21C61A
3 changed files with 17 additions and 9 deletions

View File

@ -47,7 +47,7 @@
{% set ns = namespace(balance=None) %}
{% if account %}
{% set prevlink = '/transactions?' + {'date_end': (date_beg - timedelta(days=1)).strftime('%Y-%m-%d'), 'date_beg': date_beg.replace(year=date_beg.year-1).strftime('%Y-%m-%d'), 'account': account.name, 'cash': 'on' if cash else ''}|urlencode %}
<tr class="total">
<tr class="total trn-first trn-last">
<td><a href="{{ prevlink }}">{{ date_beg.strftime('%Y-%m-%d') }}</a></td>
<td><a href="{{ prevlink }}">Opening Balance</a></td>
<td></td>
@ -70,7 +70,7 @@
{% for posting in transaction.postings if posting.account != account %}
{% set amount = posting.exchange(report_commodity, transaction.date) %}
{% set trn_url = '/transaction?' + {'tid': transaction.id, 'cash': 'on' if cash else ''}|urlencode %}
<tr>
<tr{% if loop.first and loop.last %} class="trn-first trn-last"{% elif loop.first %} class="trn-first"{% elif loop.last %} class="trn-last"{% endif %}>
<td>{% if loop.first %}{% if transaction.id %}<a href="{{ trn_url }}">{% endif %}{{ transaction.date.strftime('%Y-%m-%d') }}{% if transaction.id %}</a>{% endif %}{% endif %}</td>
<td>{% if loop.first %}{% if transaction.id %}<a href="{{ trn_url }}">{% endif %}{{ transaction.description }}{% if transaction.id %}</a>{% endif %}{% endif %}</td>
<td><a href="/transactions?{{ {'date_end': date_end.strftime('%Y-%m-%d'), 'date_beg': date_beg.strftime('%Y-%m-%d'), 'account': posting.account.name, 'cash': 'on' if cash else ''}|urlencode }}">{{ (posting.account.name|e).__str__().replace(':', ':<wbr>')|safe }}</a></td>
@ -97,7 +97,7 @@
{% endfor %}
{% if account %}
<tr class="total">
<tr class="total trn-first trn-last">
<td>{{ date_end.strftime('%Y-%m-%d') }}</td>
<td>Closing Balance</td>
<td></td>
@ -112,7 +112,7 @@
</td>
</tr>
{% else %}
<tr class="total">
<tr class="total trn-first trn-last">
<td>{{ date_end.strftime('%Y-%m-%d') }}</td>
<td>Total</td>
<td></td>

View File

@ -41,7 +41,7 @@
{% set ns = namespace(balance=None) %}
{% set prevlink = '/transactions?' + {'date_end': (date_beg - timedelta(days=1)).strftime('%Y-%m-%d'), 'date_beg': date_beg.replace(year=date_beg.year-1).strftime('%Y-%m-%d'), 'account': account.name, 'cash': 'on' if cash else '', 'commodity': 'on'}|urlencode %}
{% for amount in opening_balance.amounts %}
<tr class="total">
<tr class="total{% if loop.first %} trn-first{% endif %}{% if loop.last %} trn-last{% endif %}">
<td>{% if loop.first %}<a href="{{ prevlink }}">{{ date_beg.strftime('%Y-%m-%d') }}</a>{% endif %}</td>
<td>{% if loop.first %}<a href="{{ prevlink }}">Opening Balance</a>{% endif %}</td>
<td></td>
@ -51,7 +51,7 @@
<td>{% if amount >= 0 %}Dr{% else %}Cr{% endif %}</td>
</tr>
{% else %}
<tr class="total">
<tr class="total trn-first trn-last">
<td><a href="{{ prevlink }}">{{ date_beg.strftime('%Y-%m-%d') }}</a></td>
<td><a href="{{ prevlink }}">Opening Balance</a></td>
<td></td>
@ -72,7 +72,7 @@
{% endfor %}
{% for amount in ns.balance.amounts %}
{% set posting = matching_posting(transaction, amount) %}
<tr{% if loop.first %} style="border-top: 1px solid black;"{% endif %}>
<tr{% if loop.first and loop.last %} class="trn-first trn-last"{% elif loop.first %} class="trn-first"{% elif loop.last %} class="trn-last"{% endif %}>
<td>{% if loop.first %}{% if transaction.id %}<a href="{{ trn_url }}">{% endif %}{{ transaction.date.strftime('%Y-%m-%d') }}{% if transaction.id %}</a>{% endif %}{% endif %}</td>
<td>{% if loop.first %}{% if transaction.id %}<a href="{{ trn_url }}">{% endif %}{{ transaction.description }}{% if transaction.id %}</a>{% endif %}{% endif %}</td>
{% if posting %}
@ -89,7 +89,7 @@
{% endfor %}
{% for amount in closing_balance.amounts %}
<tr class="total explicit-rules" style="{% if loop.first %}border-top: 1pt solid black;{% endif %}{% if loop.last %}border-bottom: 1pt solid black;{% endif %}">
<tr class="total explicit-rules{% if loop.first %} trn-first{% endif %}{% if loop.last %} trn-last{% endif %}" style="{% if loop.first %}border-top: 1pt solid black;{% endif %}{% if loop.last %}border-bottom: 1pt solid black;{% endif %}">
<td>{% if loop.first %}{{ date_end.strftime('%Y-%m-%d') }}{% endif %}</td>
<td>{% if loop.first %}Closing Balance{% endif %}</td>
<td></td>
@ -100,7 +100,7 @@
</tr>
{% endfor %}
<tr class="total">
<tr class="total trn-first trn-last">
<td></td>
<td></td>
<td></td>

View File

@ -44,6 +44,7 @@ table.ledger {
table.ledger td, table.ledger th {
padding: 2px 2px 2px 2px;
vertical-align: top;
}
table.ledger th {
@ -66,6 +67,13 @@ table.ledger.onedesc tr td:not(:first-child), table.ledger.onedesc tr th:not(:fi
width: 6em;
}
table.ledger tr.trn-first td {
padding-top: 1.5mm;
}
table.ledger tr.trn-last td {
padding-bottom: 1.5mm;
}
table.ledger a {
color: black;
text-decoration: none;