def __init__(self, booking: 'Booking') -> None:
self.errors: list[str] = []
self.booking = booking
+ self.idx = 0
class IntroLine(BookingLine):
class TransferLine(BookingLine):
"""Non-first Booking line, expected to carry value movement."""
- def __init__(self, booking: 'Booking', code: str) -> None:
+ def __init__(self, booking: 'Booking', code: str, idx: int) -> None:
super().__init__(booking)
+ self.idx = idx
self.currency = ''
self.amount: Optional[Decimal] = None
if not code[0].isspace():
self.intro_line = IntroLine(self, dat_lines[0].code)
dat_lines[0].booking_line = self.intro_line
self._transfer_lines = []
- for dat_line in dat_lines[1:]:
- dat_line.booking_line = TransferLine(self, dat_line.code)
+ for i, dat_line in enumerate(dat_lines[1:]):
+ dat_line.booking_line = TransferLine(self, dat_line.code, i + 1)
self._transfer_lines += [dat_line.booking_line]
changes = Wealth()
sink_account = None
td.invalid, tr.warning td.invalid { background-color: #ff0000; }
{% endmacro %}
+{% macro css_ledger_index_col() %}
+table.ledger tr > td:first-child { background-color: white; }
+{% endmacro %}
+
{% macro table_dat_lines(dat_lines, raw) %}
-<table>
+<table class="ledger">
{% for dat_line in dat_lines %}
{% if (not raw) and dat_line.is_intro and loop.index > 1 %}
- <tr class="alternating"><td colspan=5> </td></tr>
+ <tr class="alternating"><td><td colspan=4> </td></tr>
{% endif %}
<tr class="alternating{% if dat_line.is_questionable %} warning{% endif %}">
{% if dat_line.is_intro %}
- <td id="{{dat_line.booking_id}}"><a href="#{{dat_line.booking_id}}">#</a>/<a href="/balance?up_incl={{dat_line.booking_id}}">b</a></td>
+ <td id="{{dat_line.booking_id}}"><a href="#{{dat_line.booking_id}}">[#]</a></td>
+ {% elif dat_line.booking_line.idx == 1 %}
+ <td><a href="/balance?up_incl={{dat_line.booking_id}}">[b]</a></td>
{% else %}
<td></td>
{% endif %}
</td>
{% else %}
{% if dat_line.is_intro %}
- <td{% if dat_line.error %} class="invalid"{% endif %}><a href="/bookings/{{dat_line.booking_id}}">{{dat_line.booking_line.date}}</a></td>
- <td{% if dat_line.error %} class="invalid"{% endif %} colspan=2>{{dat_line.booking_line.target}}</td>
+ <td class="date {% if dat_line.error %} invalid{% endif %}" colspan=2><a href="/bookings/{{dat_line.booking_id}}">{{dat_line.booking_line.date}}</a></td>
+ <td{% if dat_line.error %} class="invalid"{% endif %}>{{dat_line.booking_line.target}}</td>
{% elif not dat_line.error %}
<td class="amt">{{dat_line.booking_line.amount_short}}</td>
<td class="curr">{{dat_line.booking_line.currency|truncate(4,true,"…")}}</td>
{% block css %}
table { font-family: monospace; }
{{ macros.css_errors() }}
+{{ macros.css_ledger_index_col() }}
{% endblock %}
{% block content %}
{% block css %}
{{ macros.css_td_money() }}
{{ macros.css_errors() }}
+{{ macros.css_ledger_index_col() }}
+table.ledger > tbody > tr > td.date, table.ledger > tbody > tr > td:first-child { font-family: monospace; font-size: 1.3em; text-align: center; }
+table.ledger > tbody > tr > td { vertical-align: middle; }
{% endblock %}
{% block content %}