From 7fe81c710b5f08c72f2a8b7fb9c215dd22971eef Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E4=BE=9D=E7=91=AA=E8=B2=93?= Date: Wed, 8 Mar 2023 07:20:20 +0800 Subject: [PATCH] Added the balance-sheet-section.html template to simplify the template of balance sheet. --- .../accounting/report/balance-sheet.html | 75 +++---------------- .../report/include/balance-sheet-section.html | 43 +++++++++++ 2 files changed, 52 insertions(+), 66 deletions(-) create mode 100644 src/accounting/templates/accounting/report/include/balance-sheet-section.html diff --git a/src/accounting/templates/accounting/report/balance-sheet.html b/src/accounting/templates/accounting/report/balance-sheet.html index 81afc56..ff57ad5 100644 --- a/src/accounting/templates/accounting/report/balance-sheet.html +++ b/src/accounting/templates/accounting/report/balance-sheet.html @@ -127,28 +127,9 @@ First written: 2023/3/7
{% if report.assets.subsections %} -
-
{{ report.assets.title.title|title }}
-
-
- {% for subsection in report.assets.subsections %} -
-
- {{ subsection.title.code }} - {{ subsection.title.title|title }} -
-
- {% for account in subsection.accounts %} - - {% endfor %} - {% endfor %} -
+ {% with section = report.assets %} + {% include "accounting/report/include/balance-sheet-section.html" %} + {% endwith %}
{{ A_("Total") }}
{{ report.assets.total|accounting_report_format_amount }}
@@ -158,28 +139,9 @@ First written: 2023/3/7
{% if report.liabilities.subsections %} -
-
{{ report.liabilities.title.title|title }}
-
-
- {% for subsection in report.liabilities.subsections %} -
-
- {{ subsection.title.code }} - {{ subsection.title.title|title }} -
-
- {% for account in subsection.accounts %} - - {% endfor %} - {% endfor %} -
+ {% with section = report.liabilities %} + {% include "accounting/report/include/balance-sheet-section.html" %} + {% endwith %}
{{ A_("Total") }}
{{ report.liabilities.total|accounting_report_format_amount }}
@@ -187,28 +149,9 @@ First written: 2023/3/7 {% endif %} {% if report.owner_s_equity.subsections %} -
-
{{ report.owner_s_equity.title.title|title }}
-
-
- {% for subsection in report.owner_s_equity.subsections %} -
-
- {{ subsection.title.code }} - {{ subsection.title.title|title }} -
-
- {% for account in subsection.accounts %} - - {% endfor %} - {% endfor %} -
+ {% with section = report.owner_s_equity %} + {% include "accounting/report/include/balance-sheet-section.html" %} + {% endwith %}
{{ A_("Total") }}
{{ report.owner_s_equity.total|accounting_report_format_amount }}
diff --git a/src/accounting/templates/accounting/report/include/balance-sheet-section.html b/src/accounting/templates/accounting/report/include/balance-sheet-section.html new file mode 100644 index 0000000..0ca887b --- /dev/null +++ b/src/accounting/templates/accounting/report/include/balance-sheet-section.html @@ -0,0 +1,43 @@ +{# +The Mia! Accounting Flask Project +balance-sheet-section.html: A section in the balance sheet. + + Copyright (c) 2023 imacat. + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + +Author: imacat@mail.imacat.idv.tw (imacat) +First written: 2023/3/8 +#} +
+
{{ section.title.title|title }}
+
+
+ {% for subsection in section.subsections %} +
+
+ {{ subsection.title.code }} + {{ subsection.title.title|title }} +
+
+ {% for account in subsection.accounts %} + + {% endfor %} + {% endfor %} +