From cf92c9b63806fef504383105a06e175f9877130e Mon Sep 17 00:00:00 2001 From: RunasSudo Date: Sat, 24 Dec 2022 16:57:53 +1100 Subject: [PATCH] Visual improvements, add navbar --- drcr/models.py | 3 + drcr/templates/base.html | 13 +- drcr/templates/general_journal.html | 54 +++--- drcr/templates/general_ledger.html | 54 +++--- drcr/templates/index.html | 38 +++++ .../statement_line_edit_transaction.html | 158 +++++++++--------- .../templates/statements/statement_lines.html | 96 +++++------ drcr/templates/transactions.html | 120 +++++++------ drcr/templates/trial_balance.html | 50 +++--- drcr/views.py | 2 +- 10 files changed, 316 insertions(+), 272 deletions(-) create mode 100644 drcr/templates/index.html diff --git a/drcr/models.py b/drcr/models.py index ae8db3e..fc37258 100644 --- a/drcr/models.py +++ b/drcr/models.py @@ -80,6 +80,9 @@ class TrialBalancer: # TODO: Keep a record of internal transactions? + if source_account not in self.accounts: + return + if destination_account not in self.accounts: self.accounts[destination_account] = Amount(0, '$') # FIXME: Other commodities diff --git a/drcr/templates/base.html b/drcr/templates/base.html index 983b8f7..d5fe7db 100644 --- a/drcr/templates/base.html +++ b/drcr/templates/base.html @@ -25,6 +25,17 @@ - {% block body %}{% endblock %} + {% block body %} + +
+ {% block content %}{% endblock %} +
+ {% endblock %} + + {% block scripts %}{% endblock %} diff --git a/drcr/templates/general_journal.html b/drcr/templates/general_journal.html index 2a31ba3..31f1411 100644 --- a/drcr/templates/general_journal.html +++ b/drcr/templates/general_journal.html @@ -18,38 +18,36 @@ {% extends 'base.html' %} {% block title %}General journal{% endblock %} -{% block body %} -
-

General journal

- - - +{% block content %} +

General journal

+ +
+ + + + + + + + + + {% for transaction in transactions %} - - - - + + + + - - - {% for transaction in transactions %} + {% for posting in transaction.postings %} - - - + + + + - {% for posting in transaction.postings %} - - - - - - - - {% endfor %} {% endfor %} - -
DateDescriptionDrCr
DateDescriptionDrCr{{ transaction.dt.strftime('%Y-%m-%d') }}{{ transaction.description }}
{{ transaction.dt.strftime('%Y-%m-%d') }}{{ transaction.description }} {{ posting.description or '' }}{{ 'Dr' if posting.quantity >= 0 else 'Cr' }} {{ posting.account }}{{ posting.amount().format() if posting.quantity >= 0 else '' }}{{ (posting.amount()|abs).format() if posting.quantity < 0 else '' }}
{{ posting.description or '' }}{{ 'Dr' if posting.quantity >= 0 else 'Cr' }} {{ posting.account }}{{ posting.amount().format() if posting.quantity >= 0 else '' }}{{ (posting.amount()|abs).format() if posting.quantity < 0 else '' }}
-
+ {% endfor %} + + {% endblock %} diff --git a/drcr/templates/general_ledger.html b/drcr/templates/general_ledger.html index 5f1d656..bd3cfad 100644 --- a/drcr/templates/general_ledger.html +++ b/drcr/templates/general_ledger.html @@ -18,38 +18,36 @@ {% extends 'base.html' %} {% block title %}General ledger{% endblock %} -{% block body %} -
-

General ledger

- - - +{% block content %} +

General ledger

+ +
+ + + + + + + + + + {% for transaction in transactions %} - - - - + + + + - - - {% for transaction in transactions %} + {% for posting in transaction.postings %} - - - + + + + - {% for posting in transaction.postings %} - - - - - - - - {% endfor %} {% endfor %} - -
DateDescriptionDrCr
DateDescriptionDrCr{{ transaction.dt.strftime('%Y-%m-%d') }}{{ transaction.description }}
{{ transaction.dt.strftime('%Y-%m-%d') }}{{ transaction.description }} {{ posting.description or '' }}{{ 'Dr' if posting.quantity >= 0 else 'Cr' }} {{ posting.account }}{{ posting.amount().format() if posting.quantity >= 0 else '' }}{{ (posting.amount()|abs).format() if posting.quantity < 0 else '' }}
{{ posting.description or '' }}{{ 'Dr' if posting.quantity >= 0 else 'Cr' }} {{ posting.account }}{{ posting.amount().format() if posting.quantity >= 0 else '' }}{{ (posting.amount()|abs).format() if posting.quantity < 0 else '' }}
-
+ {% endfor %} + + {% endblock %} diff --git a/drcr/templates/index.html b/drcr/templates/index.html new file mode 100644 index 0000000..477e1cd --- /dev/null +++ b/drcr/templates/index.html @@ -0,0 +1,38 @@ +{# DrCr: Web-based double-entry bookkeeping framework + Copyright (C) 2022 Lee Yingtong Li (RunasSudo) + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU Affero General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU Affero General Public License for more details. + + You should have received a copy of the GNU Affero General Public License + along with this program. If not, see . +#} + +{% extends 'base.html' %} +{% block title %}DrCr{% endblock %} + +{% block content %} +

Data sources

+ + +

General reports

+ + +

Advanced reports

+ +{% endblock %} diff --git a/drcr/templates/statements/statement_line_edit_transaction.html b/drcr/templates/statements/statement_line_edit_transaction.html index 3459cd0..f2d83ba 100644 --- a/drcr/templates/statements/statement_line_edit_transaction.html +++ b/drcr/templates/statements/statement_line_edit_transaction.html @@ -18,99 +18,99 @@ {% extends 'base.html' %} {% block title %}Edit statement line charge{% endblock %} -{% block body %} -
-

Statement line

- +{% block content %} +

Statement line

+ + + + + + + + + + + + + + + + + + + + + + +
Source accountDateDescriptionDrCrBalance
{{ statement_line.source_account }}{{ statement_line.dt.strftime('%Y-%m-%d') }}{{ statement_line.description }}{{ statement_line.amount().format() if statement_line.quantity >= 0 else '' }}{{ (statement_line.amount()|abs).format() if statement_line.quantity < 0 else '' }}{{ statement_line.balance or '' }}
+ +

Transaction

+ +
- - + - - - + {# FIXME: Customise date, etc. #} + - - - - + + + + + + {# Source line #} + + + + {% if statement_line.quantity >= 0 %}{% else %}{% endif %} + {% if statement_line.quantity < 0 %}{% else %}{% endif %} + + {# Charge lines #} + {% if transaction == None %} + + + + + {% if statement_line.quantity < 0 %}{% else %}{% endif %} + {% if statement_line.quantity >= 0 %}{% else %}{% endif %} + + {% elif transaction.postings|length == 2 %} + + + + + {% if statement_line.quantity < 0 %}{% else %}{% endif %} + {% if statement_line.quantity >= 0 %}{% else %}{% endif %} + + {% else %} + {% for posting in transaction.postings if posting.account != statement_line.source_account %} + + + + + {% if statement_line.quantity < 0 %}{% else %}{% endif %} + {% if statement_line.quantity >= 0 %}{% else %}{% endif %} + + {% endfor %} + {% endif %}
Source account DateDescriptionDescription Dr CrBalance
{{ statement_line.source_account }}
{{ statement_line.dt.strftime('%Y-%m-%d') }}{{ statement_line.description }}{{ statement_line.amount().format() if statement_line.quantity >= 0 else '' }}{{ (statement_line.amount()|abs).format() if statement_line.quantity < 0 else '' }}{{ statement_line.balance or '' }}
{{ 'Dr' if statement_line.quantity >= 0 else 'Cr' }} {{ statement_line.source_account }} {##}{{ statement_line.amount().format() }}{{ (statement_line.amount()|abs).format() }}
{{ 'Cr' if statement_line.quantity >= 0 else 'Dr' }} {{ (statement_line.amount()|abs).format() }}{{ statement_line.amount().format() }}
{{ 'Cr' if statement_line.quantity >= 0 else 'Dr' }} {{ (statement_line.amount()|abs).format() }}{{ statement_line.amount().format() }}
{{ 'Cr' if statement_line.quantity >= 0 else 'Dr' }} {{ posting.commodity }}{{ posting.commodity }}
-

Transaction

- - - - - - - - - - - - - {# FIXME: Customise date, etc. #} - - - - - - - - {# Source line #} - - - - {% if statement_line.quantity >= 0 %}{% else %}{% endif %} - {% if statement_line.quantity < 0 %}{% else %}{% endif %} - - {# Charge lines #} - {% if transaction == None %} - - - - - {% if statement_line.quantity < 0 %}{% else %}{% endif %} - {% if statement_line.quantity >= 0 %}{% else %}{% endif %} - - {% elif transaction.postings|length == 2 %} - - - - - {% if statement_line.quantity < 0 %}{% else %}{% endif %} - {% if statement_line.quantity >= 0 %}{% else %}{% endif %} - - {% else %} - {% for posting in transaction.postings if posting.account != statement_line.source_account %} - - - - - {% if statement_line.quantity < 0 %}{% else %}{% endif %} - {% if statement_line.quantity >= 0 %}{% else %}{% endif %} - - {% endfor %} - {% endif %} - - -
DateDescriptionDrCr
{{ statement_line.dt.strftime('%Y-%m-%d') }}
{{ 'Dr' if statement_line.quantity >= 0 else 'Cr' }} {{ statement_line.source_account }} {##}{{ statement_line.amount().format() }}{{ (statement_line.amount()|abs).format() }}
{{ 'Cr' if statement_line.quantity >= 0 else 'Dr' }} {{ (statement_line.amount()|abs).format() }}{{ statement_line.amount().format() }}
{{ 'Cr' if statement_line.quantity >= 0 else 'Dr' }} {{ (statement_line.amount()|abs).format() }}{{ statement_line.amount().format() }}
{{ 'Cr' if statement_line.quantity >= 0 else 'Dr' }} {{ posting.commodity }}{{ posting.commodity }}
- -
- -
-
-
- +
+ +
+ +{% endblock %} + +{% block scripts %}