Replaced the report generators with a separated module for each report, to work with the diversity of the report formats without messing-up one another.

This commit is contained in:
2023-03-07 22:26:51 +08:00
parent 436a4c367f
commit edb893ecd3
21 changed files with 2228 additions and 1702 deletions

View File

@ -163,34 +163,34 @@ First written: 2023/3/5
</div>
<div class="accounting-report-table-body">
{% if report.brought_forward %}
{% with item = report.brought_forward %}
{% with entry = report.brought_forward %}
<div class="accounting-report-table-row">
<div>{{ item.date|accounting_format_date }}</div>
<div>{{ item.summary|accounting_default }}</div>
<div class="accounting-amount">{{ item.debit|accounting_format_amount|accounting_default }}</div>
<div class="accounting-amount">{{ item.credit|accounting_format_amount|accounting_default }}</div>
<div class="accounting-amount">{{ item.balance|accounting_format_amount }}</div>
<div>{{ entry.date|accounting_format_date }}</div>
<div>{{ entry.summary|accounting_default }}</div>
<div class="accounting-amount">{{ entry.debit|accounting_format_amount|accounting_default }}</div>
<div class="accounting-amount">{{ entry.credit|accounting_format_amount|accounting_default }}</div>
<div class="accounting-amount">{{ entry.balance|accounting_format_amount }}</div>
</div>
{% endwith %}
{% endif %}
{% for item in report.data_rows %}
<a class="accounting-report-table-row" href="{{ url_for("accounting.transaction.detail", txn=item.transaction)|accounting_append_next }}">
<div>{{ item.date|accounting_format_date }}</div>
<div>{{ item.summary|accounting_default }}</div>
<div class="accounting-amount">{{ item.debit|accounting_format_amount|accounting_default }}</div>
<div class="accounting-amount">{{ item.credit|accounting_format_amount|accounting_default }}</div>
<div class="accounting-amount">{{ item.balance|accounting_format_amount }}</div>
{% for entry in report.entries %}
<a class="accounting-report-table-row" href="{{ url_for("accounting.transaction.detail", txn=entry.transaction)|accounting_append_next }}">
<div>{{ entry.date|accounting_format_date }}</div>
<div>{{ entry.summary|accounting_default }}</div>
<div class="accounting-amount">{{ entry.debit|accounting_format_amount|accounting_default }}</div>
<div class="accounting-amount">{{ entry.credit|accounting_format_amount|accounting_default }}</div>
<div class="accounting-amount">{{ entry.balance|accounting_format_amount }}</div>
</a>
{% endfor %}
</div>
{% if report.total %}
{% with item = report.total %}
{% with entry = report.total %}
<div class="accounting-report-table-footer">
<div class="accounting-report-table-row">
<div>{{ A_("Total") }}</div>
<div class="accounting-amount">{{ item.debit|accounting_format_amount }}</div>
<div class="accounting-amount">{{ item.credit|accounting_format_amount }}</div>
<div class="accounting-amount">{{ item.balance|accounting_format_amount }}</div>
<div class="accounting-amount">{{ entry.debit|accounting_format_amount }}</div>
<div class="accounting-amount">{{ entry.credit|accounting_format_amount }}</div>
<div class="accounting-amount">{{ entry.balance|accounting_format_amount }}</div>
</div>
</div>
{% endwith %}
@ -199,19 +199,19 @@ First written: 2023/3/5
<div class="list-group d-md-none">
{% if report.brought_forward %}
{% with item = report.brought_forward %}
{% with entry = report.brought_forward %}
<div class="list-group-item list-group-item-action d-flex justify-content-between">
{% include "accounting/report/include/ledger-mobile-row.html" %}
</div>
{% endwith %}
{% endif %}
{% for item in report.data_rows %}
<a class="list-group-item list-group-item-action d-flex justify-content-between" href="{{ url_for("accounting.transaction.detail", txn=item.transaction)|accounting_append_next }}">
{% for entry in report.entries %}
<a class="list-group-item list-group-item-action d-flex justify-content-between" href="{{ url_for("accounting.transaction.detail", txn=entry.transaction)|accounting_append_next }}">
{% include "accounting/report/include/ledger-mobile-row.html" %}
</a>
{% endfor %}
{% if report.total is not none %}
{% with item = report.total %}
{% if report.total %}
{% with entry = report.total %}
<div class="list-group-item list-group-item-action d-flex justify-content-between">
{% include "accounting/report/include/ledger-mobile-row.html" %}
</div>