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:
@ -20,31 +20,31 @@ Author: imacat@mail.imacat.idv.tw (imacat)
|
||||
First written: 2023/3/5
|
||||
#}
|
||||
<div>
|
||||
{% if item.date is not none or item.account is not none %}
|
||||
{% if entry.date or entry.account %}
|
||||
<div class="text-muted small">
|
||||
{% if item.date is not none %}
|
||||
{{ item.date|accounting_format_date }}
|
||||
{% if entry.date %}
|
||||
{{ entry.date|accounting_format_date }}
|
||||
{% endif %}
|
||||
{% if item.account is not none %}
|
||||
{{ item.account.title|title }}
|
||||
{% if entry.account %}
|
||||
{{ entry.account.title|title }}
|
||||
{% endif %}
|
||||
</div>
|
||||
{% endif %}
|
||||
{% if item.summary is not none %}
|
||||
<div>{{ item.summary }}</div>
|
||||
{% if entry.summary %}
|
||||
<div>{{ entry.summary }}</div>
|
||||
{% endif %}
|
||||
</div>
|
||||
|
||||
<div class="text-nowrap">
|
||||
{% if item.income is not none %}
|
||||
<span class="badge rounded-pill bg-success">+{{ item.income|accounting_format_amount }}</span>
|
||||
{% if entry.income %}
|
||||
<span class="badge rounded-pill bg-success">+{{ entry.income|accounting_format_amount }}</span>
|
||||
{% endif %}
|
||||
{% if item.expense is not none %}
|
||||
<span class="badge rounded-pill bg-warning">-{{ item.expense|accounting_format_amount }}</span>
|
||||
{% if entry.expense %}
|
||||
<span class="badge rounded-pill bg-warning">-{{ entry.expense|accounting_format_amount }}</span>
|
||||
{% endif %}
|
||||
{% if item.balance < 0 %}
|
||||
<span class="badge rounded-pill bg-danger">{{ item.balance|accounting_format_amount }}</span>
|
||||
{% if entry.balance < 0 %}
|
||||
<span class="badge rounded-pill bg-danger">{{ entry.balance|accounting_format_amount }}</span>
|
||||
{% else %}
|
||||
<span class="badge rounded-pill bg-primary">{{ item.balance|accounting_format_amount }}</span>
|
||||
<span class="badge rounded-pill bg-primary">{{ entry.balance|accounting_format_amount }}</span>
|
||||
{% endif %}
|
||||
</div>
|
||||
|
@ -20,22 +20,22 @@ Author: imacat@mail.imacat.idv.tw (imacat)
|
||||
First written: 2023/3/5
|
||||
#}
|
||||
<div>
|
||||
{% if item.date is not none %}
|
||||
{% if entry.date %}
|
||||
<div class="text-muted small">
|
||||
{{ item.date|accounting_format_date }}
|
||||
{{ entry.date|accounting_format_date }}
|
||||
</div>
|
||||
{% endif %}
|
||||
{% if item.summary is not none %}
|
||||
<div>{{ item.summary }}</div>
|
||||
{% if entry.summary %}
|
||||
<div>{{ entry.summary }}</div>
|
||||
{% endif %}
|
||||
</div>
|
||||
|
||||
<div>
|
||||
{% if item.debit is not none %}
|
||||
<span class="badge rounded-pill bg-success">+{{ item.debit|accounting_format_amount }}</span>
|
||||
{% if entry.debit %}
|
||||
<span class="badge rounded-pill bg-success">+{{ entry.debit|accounting_format_amount }}</span>
|
||||
{% endif %}
|
||||
{% if item.credit is not none %}
|
||||
<span class="badge rounded-pill bg-warning">-{{ item.credit|accounting_format_amount }}</span>
|
||||
{% if entry.credit %}
|
||||
<span class="badge rounded-pill bg-warning">-{{ entry.credit|accounting_format_amount }}</span>
|
||||
{% endif %}
|
||||
<span class="badge rounded-pill bg-primary">{{ item.balance|accounting_format_amount }}</span>
|
||||
<span class="badge rounded-pill bg-primary">{{ entry.balance|accounting_format_amount }}</span>
|
||||
</div>
|
||||
|
@ -164,36 +164,36 @@ 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.account.title|title }}</div>
|
||||
<div>{{ item.summary|accounting_default }}</div>
|
||||
<div class="accounting-amount">{{ item.income|accounting_format_amount|accounting_default }}</div>
|
||||
<div class="accounting-amount">{{ item.expense|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.account.title|title }}</div>
|
||||
<div>{{ entry.summary|accounting_default }}</div>
|
||||
<div class="accounting-amount">{{ entry.income|accounting_format_amount|accounting_default }}</div>
|
||||
<div class="accounting-amount">{{ entry.expense|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.account.title|title }}</div>
|
||||
<div>{{ item.summary|accounting_default }}</div>
|
||||
<div class="accounting-amount">{{ item.income|accounting_format_amount|accounting_default }}</div>
|
||||
<div class="accounting-amount">{{ item.expense|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.account.title|title }}</div>
|
||||
<div>{{ entry.summary|accounting_default }}</div>
|
||||
<div class="accounting-amount">{{ entry.income|accounting_format_amount|accounting_default }}</div>
|
||||
<div class="accounting-amount">{{ entry.expense|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.income|accounting_format_amount }}</div>
|
||||
<div class="accounting-amount">{{ item.expense|accounting_format_amount }}</div>
|
||||
<div class="accounting-amount">{{ item.balance|accounting_format_amount }}</div>
|
||||
<div class="accounting-amount">{{ entry.income|accounting_format_amount }}</div>
|
||||
<div class="accounting-amount">{{ entry.expense|accounting_format_amount }}</div>
|
||||
<div class="accounting-amount">{{ entry.balance|accounting_format_amount }}</div>
|
||||
</div>
|
||||
</div>
|
||||
{% endwith %}
|
||||
@ -202,19 +202,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/income-expenses-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/income-expenses-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/income-expenses-mobile-row.html" %}
|
||||
</div>
|
||||
|
@ -129,40 +129,38 @@ First written: 2023/3/7
|
||||
</div>
|
||||
</div>
|
||||
<div class="accounting-report-table-body">
|
||||
{% for item in report.data_rows %}
|
||||
{% if item.is_category %}
|
||||
<div class="accounting-report-table-row accounting-income-statement-category">
|
||||
{% for section in report.sections %}
|
||||
<div class="accounting-report-table-row accounting-income-statement-section">
|
||||
<div>
|
||||
<span class="d-none d-md-inline">{{ section.title.code }}</span>
|
||||
{{ section.title.title|title }}
|
||||
</div>
|
||||
</div>
|
||||
{% for subsection in section.subsections %}
|
||||
<div class="accounting-report-table-row accounting-income-statement-subsection">
|
||||
<div>
|
||||
<span class="d-none d-md-inline">{{ item.code }}</span>
|
||||
{{ item.title|title }}
|
||||
<span class="d-none d-md-inline">{{ subsection.title.code }}</span>
|
||||
{{ subsection.title.title|title }}
|
||||
</div>
|
||||
</div>
|
||||
{% elif item.is_total %}
|
||||
<div class="accounting-report-table-row accounting-income-statement-total">
|
||||
<div>{{ item.title|title }}</div>
|
||||
<div class="accounting-amount">{{ item.amount|accounting_format_amount }}</div>
|
||||
</div>
|
||||
{% elif item.is_subcategory %}
|
||||
<div class="accounting-report-table-row accounting-income-statement-subcategory">
|
||||
<div>
|
||||
<span class="d-none d-md-inline">{{ item.code }}</span>
|
||||
{{ item.title|title }}
|
||||
</div>
|
||||
</div>
|
||||
{% elif item.is_subtotal %}
|
||||
{% for account in subsection.accounts %}
|
||||
<a class="accounting-report-table-row accounting-income-statement-account" href="{{ account.url }}">
|
||||
<div>
|
||||
<span class="d-none d-md-inline">{{ account.account.code }}</span>
|
||||
{{ account.account.title|title }}
|
||||
</div>
|
||||
<div class="accounting-amount">{{ account.amount|accounting_format_amount }}</div>
|
||||
</a>
|
||||
{% endfor %}
|
||||
<div class="accounting-report-table-row accounting-income-statement-subtotal">
|
||||
<div>{{ A_("Total") }}</div>
|
||||
<div class="accounting-amount">{{ item.amount|accounting_format_amount }}</div>
|
||||
<div class="accounting-amount">{{ subsection.total|accounting_format_amount }}</div>
|
||||
</div>
|
||||
{% else %}
|
||||
<a class="accounting-report-table-row accounting-income-statement-account" href="{{ item.url }}">
|
||||
<div>
|
||||
<span class="d-none d-md-inline">{{ item.code }}</span>
|
||||
{{ item.title|title }}
|
||||
</div>
|
||||
<div class="accounting-amount">{{ item.amount|accounting_format_amount }}</div>
|
||||
</a>
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
<div class="accounting-report-table-row accounting-income-statement-total">
|
||||
<div>{{ section.accumulated.title|title }}</div>
|
||||
<div class="accounting-amount">{{ section.accumulated.amount|accounting_format_amount }}</div>
|
||||
</div>
|
||||
{% endfor %}
|
||||
</div>
|
||||
</div>
|
||||
|
@ -105,38 +105,41 @@ First written: 2023/3/4
|
||||
</div>
|
||||
</div>
|
||||
<div class="accounting-report-table-body">
|
||||
{% 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.transaction.date|accounting_format_date }}</div>
|
||||
<div>{{ item.currency.name }}</div>
|
||||
<div>{{ item.account.title|title }}</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>
|
||||
{% 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.transaction.date|accounting_format_date }}</div>
|
||||
<div>{{ entry.currency.name }}</div>
|
||||
<div>
|
||||
<span class="d-none d-md-inline">{{ entry.account.code }}</span>
|
||||
{{ entry.account.title|title }}
|
||||
</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>
|
||||
</a>
|
||||
{% endfor %}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="list-group d-md-none">
|
||||
{% for item in report.data_rows %}
|
||||
<a class="list-group-item list-group-item-action" 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" href="{{ url_for("accounting.transaction.detail", txn=entry.transaction)|accounting_append_next }}">
|
||||
<div class="d-flex justify-content-between">
|
||||
<div {% if not item.is_debit %} class="accounting-mobile-journal-credit" {% endif %}>
|
||||
<div {% if not entry.is_debit %} class="accounting-mobile-journal-credit" {% endif %}>
|
||||
<div class="text-muted small">
|
||||
{{ item.transaction.date|accounting_format_date }}
|
||||
{{ item.account.title|title }}
|
||||
{% if item.currency_code != accounting_default_currency_code() %}
|
||||
<span class="badge rounded-pill bg-info">{{ item.currency_code }}</span>
|
||||
{{ entry.transaction.date|accounting_format_date }}
|
||||
{{ entry.account.title|title }}
|
||||
{% if entry.currency.code != accounting_default_currency_code() %}
|
||||
<span class="badge rounded-pill bg-info">{{ entry.currency.code }}</span>
|
||||
{% endif %}
|
||||
</div>
|
||||
{% if item.summary is not none %}
|
||||
<div>{{ item.summary }}</div>
|
||||
{% if entry.summary is not none %}
|
||||
<div>{{ entry.summary }}</div>
|
||||
{% endif %}
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<span class="badge rounded-pill bg-info">{{ item.amount|accounting_format_amount }}</span>
|
||||
<span class="badge rounded-pill bg-info">{{ entry.amount|accounting_format_amount }}</span>
|
||||
</div>
|
||||
</div>
|
||||
</a>
|
||||
|
@ -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>
|
||||
|
@ -131,14 +131,14 @@ First written: 2023/3/5
|
||||
</div>
|
||||
</div>
|
||||
<div class="accounting-report-table-body">
|
||||
{% for item in report.data_rows %}
|
||||
<a class="accounting-report-table-row" href="{{ item.url }}">
|
||||
{% for account in report.accounts %}
|
||||
<a class="accounting-report-table-row" href="{{ account.url }}">
|
||||
<div>
|
||||
<span class="d-none d-md-inline">{{ item.account.code }}</span>
|
||||
{{ item.account.title|title }}
|
||||
<span class="d-none d-md-inline">{{ account.account.code }}</span>
|
||||
{{ account.account.title|title }}
|
||||
</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">{{ account.debit|accounting_format_amount|accounting_default }}</div>
|
||||
<div class="accounting-amount">{{ account.credit|accounting_format_amount|accounting_default }}</div>
|
||||
</a>
|
||||
{% endfor %}
|
||||
</div>
|
||||
|
Reference in New Issue
Block a user