Add home link and tweak transactions report heading
This commit is contained in:
parent
1c217fd8d4
commit
f5f59a7098
@ -98,6 +98,14 @@ def balance():
|
|||||||
|
|
||||||
return flask.render_template('balance.html', ledger=l, balance_sheets=balance_sheets, accounts=accounts, config=config, report_currency=report_currency)
|
return flask.render_template('balance.html', ledger=l, balance_sheets=balance_sheets, accounts=accounts, config=config, report_currency=report_currency)
|
||||||
|
|
||||||
|
def describe_period(date_end, date_beg):
|
||||||
|
if date_end == (date_beg.replace(year=date_beg.year + 1) - timedelta(days=1)):
|
||||||
|
return 'year ended {}'.format(date_end.strftime('%d %B %Y'))
|
||||||
|
elif date_beg == ledger.financial_year(date_end):
|
||||||
|
return 'financial year to {}'.format(date_end.strftime('%d %B %Y'))
|
||||||
|
else:
|
||||||
|
return 'period from {} to {}'.format(date_beg.strftime('%d %B %Y'), date_end.strftime('%d %B %Y'))
|
||||||
|
|
||||||
@app.route('/pandl')
|
@app.route('/pandl')
|
||||||
def pandl():
|
def pandl():
|
||||||
date_beg = datetime.strptime(flask.request.args['date_beg'], '%Y-%m-%d')
|
date_beg = datetime.strptime(flask.request.args['date_beg'], '%Y-%m-%d')
|
||||||
@ -118,14 +126,7 @@ def pandl():
|
|||||||
if all(p.get_balance(account) == 0 and p.get_total(account) == 0 for p in pandls):
|
if all(p.get_balance(account) == 0 and p.get_total(account) == 0 for p in pandls):
|
||||||
accounts.remove(account)
|
accounts.remove(account)
|
||||||
|
|
||||||
if date_end == (date_beg.replace(year=date_beg.year + 1) - timedelta(days=1)):
|
return flask.render_template('pandl.html', period=describe_period(date_end, date_beg), ledger=l, pandls=pandls, accounts=accounts, config=config, report_currency=report_currency)
|
||||||
period = 'year ended {}'.format(date_end.strftime('%d %B %Y'))
|
|
||||||
elif date_beg == ledger.financial_year(date_end):
|
|
||||||
period = 'financial year to {}'.format(date_end.strftime('%d %B %Y'))
|
|
||||||
else:
|
|
||||||
period = 'period from {} to {}'.format(date_beg.strftime('%d %B %Y'), date_end.strftime('%d %B %Y'))
|
|
||||||
|
|
||||||
return flask.render_template('pandl.html', period=period, ledger=l, pandls=pandls, accounts=accounts, config=config, report_currency=report_currency)
|
|
||||||
|
|
||||||
@app.route('/transactions')
|
@app.route('/transactions')
|
||||||
def transactions():
|
def transactions():
|
||||||
@ -154,7 +155,7 @@ def transactions():
|
|||||||
opening_balance = accounting.trial_balance(l, pstart, pstart).get_balance(account).exchange(report_currency, True)
|
opening_balance = accounting.trial_balance(l, pstart, pstart).get_balance(account).exchange(report_currency, True)
|
||||||
closing_balance = accounting.trial_balance(l, date, pstart).get_balance(account).exchange(report_currency, True)
|
closing_balance = accounting.trial_balance(l, date, pstart).get_balance(account).exchange(report_currency, True)
|
||||||
|
|
||||||
return flask.render_template('transactions.html', date=date, pstart=pstart, account=account, ledger=l, transactions=transactions, opening_balance=opening_balance, closing_balance=closing_balance, report_currency=report_currency)
|
return flask.render_template('transactions.html', date=date, pstart=pstart, period=describe_period(date, pstart), account=account, ledger=l, transactions=transactions, opening_balance=opening_balance, closing_balance=closing_balance, report_currency=report_currency, timedelta=timedelta)
|
||||||
|
|
||||||
@app.template_filter('a')
|
@app.template_filter('a')
|
||||||
def filter_amount(amt):
|
def filter_amount(amt):
|
||||||
|
@ -16,6 +16,8 @@
|
|||||||
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
#}
|
#}
|
||||||
|
|
||||||
|
{% extends 'base_report.html' %}
|
||||||
|
|
||||||
{% macro print_rows(account, invert=False, level=0) %}
|
{% macro print_rows(account, invert=False, level=0) %}
|
||||||
<tr>
|
<tr>
|
||||||
<td style="padding-left: calc(2px + {{ level }}em);">
|
<td style="padding-left: calc(2px + {{ level }}em);">
|
||||||
@ -80,40 +82,33 @@
|
|||||||
</tr>
|
</tr>
|
||||||
{% endmacro %}
|
{% endmacro %}
|
||||||
|
|
||||||
<!DOCTYPE html>
|
{% block title %}Balance Sheet as at {{ balance_sheets[0].date.strftime('%d %B %Y') }}{% endblock %}
|
||||||
<html>
|
|
||||||
<head>
|
|
||||||
<meta charset="utf-8">
|
|
||||||
<title>Balance Sheet as at {{ balance_sheets[0].date.strftime('%d %B %Y') }}</title>
|
|
||||||
<link rel="stylesheet" type="text/css" href="https://cdnjs.cloudflare.com/ajax/libs/normalize/8.0.1/normalize.min.css" integrity="sha256-l85OmPOjvil/SOvVt3HnSSjzF1TUMyT9eV0c2BzEGzU=" crossorigin="anonymous">
|
|
||||||
<link rel="stylesheet" type="text/css" href="{{ url_for('static', filename='main.css') }}">
|
|
||||||
</head>
|
|
||||||
<body>
|
|
||||||
<h1>Balance Sheet</h1>
|
|
||||||
<h2>As at {{ balance_sheets[0].date.strftime('%d %B %Y') }}</h2>
|
|
||||||
|
|
||||||
<table class="ledger onedesc">
|
{% block report %}
|
||||||
{# Assets #}
|
<h1>Balance Sheet</h1>
|
||||||
<tr><th class="h1" colspan="{{ balance_sheets|length + 1 }}">Assets</th></tr>
|
<h2>As at {{ balance_sheets[0].date.strftime('%d %B %Y') }}</h2>
|
||||||
{{ do_accounts(ledger.get_account(config['assets_account']), 'Assets', False, True) }}
|
|
||||||
<tr><td colspan="2"> </td></tr>
|
|
||||||
|
|
||||||
{# Liabilities #}
|
<table class="ledger onedesc">
|
||||||
<tr><th class="h1" colspan="{{ balance_sheets|length + 1 }}">Liabilities</th></tr>
|
{# Assets #}
|
||||||
{{ do_accounts(ledger.get_account(config['liabilities_account']), 'Liabilities', True, False) }}
|
<tr><th class="h1" colspan="{{ balance_sheets|length + 1 }}">Assets</th></tr>
|
||||||
<tr><td colspan="2"> </td></tr>
|
{{ do_accounts(ledger.get_account(config['assets_account']), 'Assets', False, True) }}
|
||||||
|
<tr><td colspan="2"> </td></tr>
|
||||||
|
|
||||||
{# Equity #}
|
{# Liabilities #}
|
||||||
<tr><th class="h1" colspan="{{ balance_sheets|length + 1 }}">Equity</th></tr>
|
<tr><th class="h1" colspan="{{ balance_sheets|length + 1 }}">Liabilities</th></tr>
|
||||||
|
{{ do_accounts(ledger.get_account(config['liabilities_account']), 'Liabilities', True, False) }}
|
||||||
|
<tr><td colspan="2"> </td></tr>
|
||||||
|
|
||||||
{% for account in ledger.get_account(config['equity_account']).children if account in accounts %}
|
{# Equity #}
|
||||||
{{ print_rows(account, invert=True) }}
|
<tr><th class="h1" colspan="{{ balance_sheets|length + 1 }}">Equity</th></tr>
|
||||||
{% endfor %}
|
|
||||||
|
|
||||||
<tr class="total">
|
{% for account in ledger.get_account(config['equity_account']).children if account in accounts %}
|
||||||
<td>Total Equity</td>
|
{{ print_rows(account, invert=True) }}
|
||||||
{% for balance_sheet in balance_sheets %}<td>{{ -balance_sheet.get_total(ledger.get_account(config['equity_account'])).exchange(report_currency, True)|a }}</td>{% endfor %}
|
{% endfor %}
|
||||||
</tr>
|
|
||||||
</table>
|
<tr class="total">
|
||||||
</body>
|
<td>Total Equity</td>
|
||||||
</html>
|
{% for balance_sheet in balance_sheets %}<td>{{ -balance_sheet.get_total(ledger.get_account(config['equity_account'])).exchange(report_currency, True)|a }}</td>{% endfor %}
|
||||||
|
</tr>
|
||||||
|
</table>
|
||||||
|
{% endblock %}
|
||||||
|
30
ledger_pyreport/jinja2/base.html
Normal file
30
ledger_pyreport/jinja2/base.html
Normal file
@ -0,0 +1,30 @@
|
|||||||
|
{#
|
||||||
|
ledger-pyreport
|
||||||
|
Copyright © 2020 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 <https://www.gnu.org/licenses/>.
|
||||||
|
#}
|
||||||
|
|
||||||
|
<!DOCTYPE html>
|
||||||
|
<html>
|
||||||
|
<head>
|
||||||
|
<meta charset="utf-8">
|
||||||
|
<title>{% block title %}{% endblock %}</title>
|
||||||
|
<link rel="stylesheet" type="text/css" href="https://cdnjs.cloudflare.com/ajax/libs/normalize/8.0.1/normalize.min.css" integrity="sha256-l85OmPOjvil/SOvVt3HnSSjzF1TUMyT9eV0c2BzEGzU=" crossorigin="anonymous">
|
||||||
|
<link rel="stylesheet" type="text/css" href="{{ url_for('static', filename='main.css') }}">
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
{% block body %}{% endblock %}
|
||||||
|
</body>
|
||||||
|
</html>
|
26
ledger_pyreport/jinja2/base_report.html
Normal file
26
ledger_pyreport/jinja2/base_report.html
Normal file
@ -0,0 +1,26 @@
|
|||||||
|
{#
|
||||||
|
ledger-pyreport
|
||||||
|
Copyright © 2020 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 <https://www.gnu.org/licenses/>.
|
||||||
|
#}
|
||||||
|
|
||||||
|
{% extends 'base.html' %}
|
||||||
|
|
||||||
|
{% block body %}
|
||||||
|
<a class="homelink" href="/">Home</a>
|
||||||
|
|
||||||
|
{% block report %}
|
||||||
|
{% endblock %}
|
||||||
|
{% endblock %}
|
@ -16,60 +16,57 @@
|
|||||||
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
#}
|
#}
|
||||||
|
|
||||||
<!DOCTYPE html>
|
{% extends 'base.html' %}
|
||||||
<html>
|
|
||||||
<head>
|
|
||||||
<meta charset="utf-8">
|
|
||||||
<title>ledger-pyreport</title>
|
|
||||||
</head>
|
|
||||||
<body>
|
|
||||||
<ul>
|
|
||||||
<li><form action="{{ url_for('trial') }}">
|
|
||||||
<button type="submit">Trial balance</button>
|
|
||||||
<label>Date: <input name="date" value="{{ date.strftime('%Y-%m-%d') }}" style="width: 6em;" oninput="txtc(this)"></label>
|
|
||||||
<label>Period start: <input name="pstart" value="{{ pstart.strftime('%Y-%m-%d') }}" style="width: 6em;" oninput="txtc(this)"></label>
|
|
||||||
<label>Compare <input name="compare" value="0" style="width: 2em;" oninput="txtc(this)"> periods</label>
|
|
||||||
{#<label><input name="cash" type="checkbox" oninput="chbc(this)"> Cash basis</label>#}
|
|
||||||
</form></li>
|
|
||||||
|
|
||||||
<li><form action="{{ url_for('balance') }}">
|
{% block title %}ledger-pyreport{% endblock %}
|
||||||
<button type="submit">Balance sheet</button>
|
|
||||||
<label>Date: <input name="date" value="{{ date.strftime('%Y-%m-%d') }}" style="width: 6em;" oninput="txtc(this)"></label>
|
|
||||||
<label>Period start: <input name="pstart" value="{{ pstart.strftime('%Y-%m-%d') }}" style="width: 6em;" oninput="txtc(this)"></label>
|
|
||||||
<label>Compare <input name="compare" value="0" style="width: 2em;" oninput="txtc(this)"> periods</label>
|
|
||||||
{#<label><input name="cash" type="checkbox" oninput="chbc(this)"> Cash basis</label>#}
|
|
||||||
</form></li>
|
|
||||||
|
|
||||||
<li><form action="{{ url_for('pandl') }}">
|
{% block body %}
|
||||||
<button type="submit">Income statement</button>
|
<ul>
|
||||||
<label>Begin date: <input name="date_beg" value="{{ pstart.strftime('%Y-%m-%d') }}" style="width: 6em;" oninput="txtc(this)"></label>
|
<li><form action="{{ url_for('trial') }}">
|
||||||
<label>End date: <input name="date_end" value="{{ date.strftime('%Y-%m-%d') }}" style="width: 6em;" oninput="txtc(this)"></label>
|
<button type="submit">Trial balance</button>
|
||||||
<label>Compare <input name="compare" value="0" style="width: 2em;" oninput="txtc(this)"> periods</label>
|
<label>Date: <input name="date" value="{{ date.strftime('%Y-%m-%d') }}" style="width: 6em;" oninput="txtc(this)"></label>
|
||||||
{#<label><input name="cash" type="checkbox" oninput="chbc(this)"> Cash basis</label>#}
|
<label>Period start: <input name="pstart" value="{{ pstart.strftime('%Y-%m-%d') }}" style="width: 6em;" oninput="txtc(this)"></label>
|
||||||
</form></li>
|
<label>Compare <input name="compare" value="0" style="width: 2em;" oninput="txtc(this)"> periods</label>
|
||||||
|
{#<label><input name="cash" type="checkbox" oninput="chbc(this)"> Cash basis</label>#}
|
||||||
|
</form></li>
|
||||||
|
|
||||||
<li><form action="{{ url_for('transactions') }}">
|
<li><form action="{{ url_for('balance') }}">
|
||||||
<button type="submit">General ledger</button>
|
<button type="submit">Balance sheet</button>
|
||||||
<label>Date: <input name="date" value="{{ date.strftime('%Y-%m-%d') }}" style="width: 6em;" oninput="txtc(this)"></label>
|
<label>Date: <input name="date" value="{{ date.strftime('%Y-%m-%d') }}" style="width: 6em;" oninput="txtc(this)"></label>
|
||||||
<label>Period start: <input name="pstart" value="{{ pstart.strftime('%Y-%m-%d') }}" style="width: 6em;" oninput="txtc(this)"></label>
|
<label>Period start: <input name="pstart" value="{{ pstart.strftime('%Y-%m-%d') }}" style="width: 6em;" oninput="txtc(this)"></label>
|
||||||
{#<label><input name="cash" type="checkbox" oninput="chbc(this)"> Cash basis</label>#}
|
<label>Compare <input name="compare" value="0" style="width: 2em;" oninput="txtc(this)"> periods</label>
|
||||||
</form></li>
|
{#<label><input name="cash" type="checkbox" oninput="chbc(this)"> Cash basis</label>#}
|
||||||
</ul>
|
</form></li>
|
||||||
|
|
||||||
<script>
|
<li><form action="{{ url_for('pandl') }}">
|
||||||
// Called whenever a text input changes - update others to match
|
<button type="submit">Income statement</button>
|
||||||
function txtc(el) {
|
<label>Begin date: <input name="date_beg" value="{{ pstart.strftime('%Y-%m-%d') }}" style="width: 6em;" oninput="txtc(this)"></label>
|
||||||
for (var e2 of document.querySelectorAll('input[name="' + el.name + '"]')) {
|
<label>End date: <input name="date_end" value="{{ date.strftime('%Y-%m-%d') }}" style="width: 6em;" oninput="txtc(this)"></label>
|
||||||
e2.value = el.value;
|
<label>Compare <input name="compare" value="0" style="width: 2em;" oninput="txtc(this)"> periods</label>
|
||||||
}
|
{#<label><input name="cash" type="checkbox" oninput="chbc(this)"> Cash basis</label>#}
|
||||||
|
</form></li>
|
||||||
|
|
||||||
|
<li><form action="{{ url_for('transactions') }}">
|
||||||
|
<button type="submit">General ledger</button>
|
||||||
|
<label>Date: <input name="date" value="{{ date.strftime('%Y-%m-%d') }}" style="width: 6em;" oninput="txtc(this)"></label>
|
||||||
|
<label>Period start: <input name="pstart" value="{{ pstart.strftime('%Y-%m-%d') }}" style="width: 6em;" oninput="txtc(this)"></label>
|
||||||
|
{#<label><input name="cash" type="checkbox" oninput="chbc(this)"> Cash basis</label>#}
|
||||||
|
</form></li>
|
||||||
|
</ul>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
// Called whenever a text input changes - update others to match
|
||||||
|
function txtc(el) {
|
||||||
|
for (var e2 of document.querySelectorAll('input[name="' + el.name + '"]')) {
|
||||||
|
e2.value = el.value;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Ditto for checkboxes
|
// Ditto for checkboxes
|
||||||
function chbc(el) {
|
function chbc(el) {
|
||||||
for (var e2 of document.querySelectorAll('input[name="' + el.name + '"]')) {
|
for (var e2 of document.querySelectorAll('input[name="' + el.name + '"]')) {
|
||||||
e2.checked = el.checked;
|
e2.checked = el.checked;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
</script>
|
}
|
||||||
</body>
|
</script>
|
||||||
</html>
|
{% endblock %}
|
||||||
|
@ -16,6 +16,8 @@
|
|||||||
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
#}
|
#}
|
||||||
|
|
||||||
|
{% extends 'base_report.html' %}
|
||||||
|
|
||||||
{% macro print_rows(account, invert=False, level=0) %}
|
{% macro print_rows(account, invert=False, level=0) %}
|
||||||
<tr>
|
<tr>
|
||||||
<td style="padding-left: calc(2px + {{ level }}em);">
|
<td style="padding-left: calc(2px + {{ level }}em);">
|
||||||
@ -57,29 +59,22 @@
|
|||||||
</tr>
|
</tr>
|
||||||
{% endmacro %}
|
{% endmacro %}
|
||||||
|
|
||||||
<!DOCTYPE html>
|
{% block title %}Income Statement for the {{ period }}{% endblock %}
|
||||||
<html>
|
|
||||||
<head>
|
|
||||||
<meta charset="utf-8">
|
|
||||||
<title>Income Statement for the {{ period }}</title>
|
|
||||||
<link rel="stylesheet" type="text/css" href="https://cdnjs.cloudflare.com/ajax/libs/normalize/8.0.1/normalize.min.css" integrity="sha256-l85OmPOjvil/SOvVt3HnSSjzF1TUMyT9eV0c2BzEGzU=" crossorigin="anonymous">
|
|
||||||
<link rel="stylesheet" type="text/css" href="{{ url_for('static', filename='main.css') }}">
|
|
||||||
</head>
|
|
||||||
<body>
|
|
||||||
<h1>Income Statement</h1>
|
|
||||||
<h2>For the {{ period }}</h2>
|
|
||||||
|
|
||||||
<table class="ledger onedesc">
|
{% block report %}
|
||||||
{{ do_accounts(ledger.get_account(config['income_account']), 'Income', True, True) }}
|
<h1>Income Statement</h1>
|
||||||
<tr><td colspan="2"> </td></tr>
|
<h2>For the {{ period }}</h2>
|
||||||
|
|
||||||
{{ do_accounts(ledger.get_account(config['expenses_account']), 'Expenses', False, False) }}
|
<table class="ledger onedesc">
|
||||||
<tr><td colspan="2"> </td></tr>
|
{{ do_accounts(ledger.get_account(config['income_account']), 'Income', True, True) }}
|
||||||
|
<tr><td colspan="2"> </td></tr>
|
||||||
|
|
||||||
<tr class="total">
|
{{ do_accounts(ledger.get_account(config['expenses_account']), 'Expenses', False, False) }}
|
||||||
<td>Net Surplus (Loss)</td>
|
<tr><td colspan="2"> </td></tr>
|
||||||
{% for pandl in pandls %}<td>{{ -(pandl.get_total(ledger.get_account(config['income_account'])) + pandl.get_total(ledger.get_account(config['expenses_account']))).exchange(report_currency, True)|a }}</td>{% endfor %}
|
|
||||||
</tr>
|
<tr class="total">
|
||||||
</table>
|
<td>Net Surplus (Loss)</td>
|
||||||
</body>
|
{% for pandl in pandls %}<td>{{ -(pandl.get_total(ledger.get_account(config['income_account'])) + pandl.get_total(ledger.get_account(config['expenses_account']))).exchange(report_currency, True)|a }}</td>{% endfor %}
|
||||||
</html>
|
</tr>
|
||||||
|
</table>
|
||||||
|
{% endblock %}
|
||||||
|
@ -16,105 +16,102 @@
|
|||||||
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
#}
|
#}
|
||||||
|
|
||||||
<!DOCTYPE html>
|
{% extends 'base_report.html' %}
|
||||||
<html>
|
|
||||||
<head>
|
{% block title %}{% if account %}Account Transactions{% else %}General Ledger{% endif %} as at {{ date.strftime('%d %B %Y') }}{% endblock %}
|
||||||
<meta charset="utf-8">
|
|
||||||
<title>{% if account %}Account Transactions{% else %}General Ledger{% endif %} as at {{ date.strftime('%d %B %Y') }}</title>
|
{% block report %}
|
||||||
<link rel="stylesheet" type="text/css" href="https://cdnjs.cloudflare.com/ajax/libs/normalize/8.0.1/normalize.min.css" integrity="sha256-l85OmPOjvil/SOvVt3HnSSjzF1TUMyT9eV0c2BzEGzU=" crossorigin="anonymous">
|
{% if account %}
|
||||||
<link rel="stylesheet" type="text/css" href="{{ url_for('static', filename='main.css') }}">
|
<h1>Account Transactions</h1>
|
||||||
</head>
|
<h2 style="margin-bottom: 0;">For {{ account.name }}</h2>
|
||||||
<body>
|
{% else %}
|
||||||
|
<h1>General Ledger</h1>
|
||||||
|
{% endif %}
|
||||||
|
<h2>For the {{ period }}</h2>
|
||||||
|
|
||||||
|
<table class="ledger">
|
||||||
|
<tr>
|
||||||
|
<th style="width: 5em;">Date</th>
|
||||||
|
<th>Description</th>
|
||||||
|
<th style="max-width: 8em;">Account</th>
|
||||||
|
<th class="h1" style="text-align: right; width: 5em;">Dr</th>
|
||||||
|
<th class="h1" style="text-align: right; width: 5em;">Cr</th>
|
||||||
|
{% if account %}<th class="h1" style="text-align: right; width: 6em;">Balance</th>{% endif %}
|
||||||
|
</tr>
|
||||||
|
|
||||||
|
{% set ns = namespace(balance=None) %}
|
||||||
{% if account %}
|
{% if account %}
|
||||||
<h1>Account Transactions</h1>
|
<tr class="total">
|
||||||
<h2 style="margin-bottom: 0;">For {{ account.name }}</h2>
|
<td>{{ pstart.strftime('%Y-%m-%d') }}</td>
|
||||||
{% else %}
|
<td><a href="/transactions?{{ {'date': (pstart - timedelta(days=1)).strftime('%Y-%m-%d'), 'pstart': pstart.replace(year=pstart.year-1).strftime('%Y-%m-%d'), 'account': account.name}|urlencode }}">Opening Balance</a></td>
|
||||||
<h1>General Ledger</h1>
|
<td></td>
|
||||||
{% endif %}
|
<td style="text-align: right;"></td>
|
||||||
<h2>As at {{ date.strftime('%d %B %Y') }}</h2>
|
<td style="text-align: right;"></td>
|
||||||
|
<td style="text-align: right;">
|
||||||
<table class="ledger">
|
<a href="/transactions?{{ {'date': (pstart - timedelta(days=1)).strftime('%Y-%m-%d'), 'pstart': pstart.replace(year=pstart.year-1).strftime('%Y-%m-%d'), 'account': account.name}|urlencode }}">
|
||||||
<tr>
|
|
||||||
<th style="width: 5em;">Date</th>
|
|
||||||
<th>Description</th>
|
|
||||||
<th style="max-width: 8em;">Account</th>
|
|
||||||
<th class="h1" style="text-align: right; width: 5em;">Dr</th>
|
|
||||||
<th class="h1" style="text-align: right; width: 5em;">Cr</th>
|
|
||||||
{% if account %}<th class="h1" style="text-align: right; width: 6em;">Balance</th>{% endif %}
|
|
||||||
</tr>
|
|
||||||
|
|
||||||
{% set ns = namespace(balance=None) %}
|
|
||||||
{% if account %}
|
|
||||||
<tr class="total">
|
|
||||||
<td>{{ pstart.strftime('%Y-%m-%d') }}</td>
|
|
||||||
<td>Opening Balance</td>
|
|
||||||
<td></td>
|
|
||||||
<td style="text-align: right;"></td>
|
|
||||||
<td style="text-align: right;"></td>
|
|
||||||
<td style="text-align: right;">
|
|
||||||
{% if opening_balance >= 0 %}
|
{% if opening_balance >= 0 %}
|
||||||
{{ opening_balance|b }} Dr
|
{{ opening_balance|b }} Dr
|
||||||
{% else %}
|
{% else %}
|
||||||
{{ -opening_balance|b }} Cr
|
{{ -opening_balance|b }} Cr
|
||||||
{% endif %}
|
{% endif %}
|
||||||
</td>
|
</a>
|
||||||
</tr>
|
</td>
|
||||||
{% set ns.balance = opening_balance %}
|
</tr>
|
||||||
{% endif %}
|
{% set ns.balance = opening_balance %}
|
||||||
|
{% endif %}
|
||||||
|
|
||||||
{% for transaction in transactions %}
|
{% for transaction in transactions %}
|
||||||
{% for posting in transaction.postings if (posting.amount.amount >= 0.05 or posting.amount.amount < -0.05) and posting.account != account %}
|
{% for posting in transaction.postings if (posting.amount.amount >= 0.05 or posting.amount.amount < -0.05) and posting.account != account %}
|
||||||
{% set amount = posting.exchange(report_currency, transaction.date) %}
|
{% set amount = posting.exchange(report_currency, transaction.date) %}
|
||||||
<tr>
|
<tr>
|
||||||
<td>{% if loop.first %}{{ transaction.date.strftime('%Y-%m-%d') }}{% endif %}</td>
|
<td>{% if loop.first %}{{ transaction.date.strftime('%Y-%m-%d') }}{% endif %}</td>
|
||||||
<td>{% if loop.first %}{{ transaction.description }}{% endif %}</td>
|
<td>{% if loop.first %}{{ transaction.description }}{% endif %}</td>
|
||||||
<td><a href="/transactions?{{ {'date': date.strftime('%Y-%m-%d'), 'pstart': pstart.strftime('%Y-%m-%d'), 'account': posting.account.name}|urlencode }}">{{ (posting.account.name|e).__str__().replace(':', ':<wbr>')|safe }}</a></td>
|
<td><a href="/transactions?{{ {'date': date.strftime('%Y-%m-%d'), 'pstart': pstart.strftime('%Y-%m-%d'), 'account': posting.account.name}|urlencode }}">{{ (posting.account.name|e).__str__().replace(':', ':<wbr>')|safe }}</a></td>
|
||||||
{% if account %}
|
{% if account %}
|
||||||
{# Reverse Dr/Cr so it's from the "perspective" of this account #}
|
{# Reverse Dr/Cr so it's from the "perspective" of this account #}
|
||||||
{% set ns.balance = ns.balance - amount %}
|
{% set ns.balance = ns.balance - amount %}
|
||||||
<td style="text-align: right;">{% if amount < 0 %}<span title="{{ (-posting.amount).tostr(False) }}">{{ -amount|b }}</span>{% endif %}</td>
|
<td style="text-align: right;">{% if amount < 0 %}<span title="{{ (-posting.amount).tostr(False) }}">{{ -amount|b }}</span>{% endif %}</td>
|
||||||
<td style="text-align: right;">{% if amount > 0 %}<span title="{{ posting.amount.tostr(False) }}">{{ amount|b }}</span>{% endif %}</td>
|
<td style="text-align: right;">{% if amount > 0 %}<span title="{{ posting.amount.tostr(False) }}">{{ amount|b }}</span>{% endif %}</td>
|
||||||
<td style="text-align: right;">
|
<td style="text-align: right;">
|
||||||
{% if loop.last %}
|
{% if loop.last %}
|
||||||
{% if ns.balance >= 0 %}
|
{% if ns.balance >= 0 %}
|
||||||
{{ ns.balance|b }} Dr
|
{{ ns.balance|b }} Dr
|
||||||
{% else %}
|
{% else %}
|
||||||
{{ -ns.balance|b }} Cr
|
{{ -ns.balance|b }} Cr
|
||||||
{% endif %}
|
|
||||||
{% endif %}
|
{% endif %}
|
||||||
</td>
|
{% endif %}
|
||||||
{% else %}
|
</td>
|
||||||
<td style="text-align: right;">{% if amount > 0 %}<span title="{{ posting.amount.tostr(False) }}">{{ amount|b }}</span>{% endif %}</td>
|
{% else %}
|
||||||
<td style="text-align: right;">{% if amount < 0 %}<span title="{{ (-posting.amount).tostr(False) }}">{{ -amount|b }}</span>{% endif %}</td>
|
<td style="text-align: right;">{% if amount > 0 %}<span title="{{ posting.amount.tostr(False) }}">{{ amount|b }}</span>{% endif %}</td>
|
||||||
{% endif %}
|
<td style="text-align: right;">{% if amount < 0 %}<span title="{{ (-posting.amount).tostr(False) }}">{{ -amount|b }}</span>{% endif %}</td>
|
||||||
</tr>
|
{% endif %}
|
||||||
{% endfor %}
|
</tr>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
|
{% endfor %}
|
||||||
|
|
||||||
{% if account %}
|
{% if account %}
|
||||||
<tr class="total">
|
<tr class="total">
|
||||||
<td>{{ date.strftime('%Y-%m-%d') }}</td>
|
<td>{{ date.strftime('%Y-%m-%d') }}</td>
|
||||||
<td>Closing Balance</td>
|
<td>Closing Balance</td>
|
||||||
<td></td>
|
<td></td>
|
||||||
<td style="text-align: right;"></td>
|
<td style="text-align: right;"></td>
|
||||||
<td style="text-align: right;"></td>
|
<td style="text-align: right;"></td>
|
||||||
<td style="text-align: right;">
|
<td style="text-align: right;">
|
||||||
{% if closing_balance >= 0 %}
|
{% if closing_balance >= 0 %}
|
||||||
{{ closing_balance|b }} Dr
|
{{ closing_balance|b }} Dr
|
||||||
{% else %}
|
{% else %}
|
||||||
{{ -closing_balance|b }} Cr
|
{{ -closing_balance|b }} Cr
|
||||||
{% endif %}
|
{% endif %}
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
{% else %}
|
{% else %}
|
||||||
<tr class="total">
|
<tr class="total">
|
||||||
<td>{{ date.strftime('%Y-%m-%d') }}</td>
|
<td>{{ date.strftime('%Y-%m-%d') }}</td>
|
||||||
<td>Total</td>
|
<td>Total</td>
|
||||||
<td></td>
|
<td></td>
|
||||||
<td style="text-align: right;">{{ total_dr|b }}</td>
|
<td style="text-align: right;">{{ total_dr|b }}</td>
|
||||||
<td style="text-align: right;">{{ -total_cr|b }}</td>
|
<td style="text-align: right;">{{ -total_cr|b }}</td>
|
||||||
</tr>
|
</tr>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
</table>
|
</table>
|
||||||
</body>
|
{% endblock %}
|
||||||
</html>
|
|
||||||
|
@ -16,41 +16,36 @@
|
|||||||
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
#}
|
#}
|
||||||
|
|
||||||
<!DOCTYPE html>
|
{% extends 'base_report.html' %}
|
||||||
<html>
|
|
||||||
<head>
|
|
||||||
<meta charset="utf-8">
|
|
||||||
<title>Trial Balance as at {{ trial_balance.date.strftime('%d %B %Y') }}</title>
|
|
||||||
<link rel="stylesheet" type="text/css" href="https://cdnjs.cloudflare.com/ajax/libs/normalize/8.0.1/normalize.min.css" integrity="sha256-l85OmPOjvil/SOvVt3HnSSjzF1TUMyT9eV0c2BzEGzU=" crossorigin="anonymous">
|
|
||||||
<link rel="stylesheet" type="text/css" href="{{ url_for('static', filename='main.css') }}">
|
|
||||||
</head>
|
|
||||||
<body>
|
|
||||||
<h1>Trial Balance</h1>
|
|
||||||
<h2>As at {{ trial_balance.date.strftime('%d %B %Y') }}</h2>
|
|
||||||
|
|
||||||
<table class="ledger onedesc">
|
{% block title %}Trial Balance as at {{ trial_balance.date.strftime('%d %B %Y') }}{% endblock %}
|
||||||
<tr>
|
|
||||||
<th></th>
|
{% block report %}
|
||||||
<th class="h1">Dr</th>
|
<h1>Trial Balance</h1>
|
||||||
<th class="h1">Cr</th>
|
<h2>As at {{ trial_balance.date.strftime('%d %B %Y') }}</h2>
|
||||||
</tr>
|
|
||||||
{% for account in accounts %}
|
<table class="ledger onedesc">
|
||||||
{# Display in "cost basis" as we have already accounted for unrealised gains #}
|
<tr>
|
||||||
{% set balance = trial_balance.get_balance(account).exchange(report_currency, True) %}
|
<th></th>
|
||||||
{% set trn_url = "/transactions?" + {'date': trial_balance.date.strftime('%Y-%m-%d'), 'pstart': trial_balance.pstart.strftime('%Y-%m-%d'), 'account': account.name}|urlencode %}
|
<th class="h1">Dr</th>
|
||||||
{% if balance != 0 %}
|
<th class="h1">Cr</th>
|
||||||
<tr>
|
</tr>
|
||||||
<td><a href="{{ trn_url }}">{{ account.name }}</a></td>
|
{% for account in accounts %}
|
||||||
<td>{% if balance > 0 %}<a href="{{ trn_url }}">{{ balance|b }}</a>{% endif %}</td>
|
{# Display in "cost basis" as we have already accounted for unrealised gains #}
|
||||||
<td>{% if balance < 0 %}<a href="{{ trn_url }}">{{ -balance|b }}</a>{% endif %}</td>
|
{% set balance = trial_balance.get_balance(account).exchange(report_currency, True) %}
|
||||||
</tr>
|
{% set trn_url = "/transactions?" + {'date': trial_balance.date.strftime('%Y-%m-%d'), 'pstart': trial_balance.pstart.strftime('%Y-%m-%d'), 'account': account.name}|urlencode %}
|
||||||
{% endif %}
|
{% if balance != 0 %}
|
||||||
{% endfor %}
|
<tr>
|
||||||
<tr class="total">
|
<td><a href="{{ trn_url }}">{{ account.name }}</a></td>
|
||||||
<td></td>
|
<td>{% if balance > 0 %}<a href="{{ trn_url }}">{{ balance|b }}</a>{% endif %}</td>
|
||||||
<td>{{ total_dr|b }}</td>
|
<td>{% if balance < 0 %}<a href="{{ trn_url }}">{{ -balance|b }}</a>{% endif %}</td>
|
||||||
<td>{{ total_cr|b }}</td>
|
</tr>
|
||||||
</tr>
|
{% endif %}
|
||||||
</table>
|
{% endfor %}
|
||||||
</body>
|
<tr class="total">
|
||||||
</html>
|
<td></td>
|
||||||
|
<td>{{ total_dr|b }}</td>
|
||||||
|
<td>{{ total_cr|b }}</td>
|
||||||
|
</tr>
|
||||||
|
</table>
|
||||||
|
{% endblock %}
|
||||||
|
@ -16,32 +16,27 @@
|
|||||||
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
#}
|
#}
|
||||||
|
|
||||||
<!DOCTYPE html>
|
{% extends 'base_report.html' %}
|
||||||
<html>
|
|
||||||
<head>
|
|
||||||
<meta charset="utf-8">
|
|
||||||
<title>Trial Balance as at {{ trial_balances[0].date.strftime('%d %B %Y') }}</title>
|
|
||||||
<link rel="stylesheet" type="text/css" href="https://cdnjs.cloudflare.com/ajax/libs/normalize/8.0.1/normalize.min.css" integrity="sha256-l85OmPOjvil/SOvVt3HnSSjzF1TUMyT9eV0c2BzEGzU=" crossorigin="anonymous">
|
|
||||||
<link rel="stylesheet" type="text/css" href="{{ url_for('static', filename='main.css') }}">
|
|
||||||
</head>
|
|
||||||
<body>
|
|
||||||
<h1>Trial Balance</h1>
|
|
||||||
<h2>As at {{ trial_balances[0].date.strftime('%d %B %Y') }}</h2>
|
|
||||||
|
|
||||||
<table class="ledger onedesc">
|
{% block title %}Trial Balance as at {{ trial_balances[0].date.strftime('%d %B %Y') }}{% endblock %}
|
||||||
|
|
||||||
|
{% block report %}
|
||||||
|
<h1>Trial Balance</h1>
|
||||||
|
<h2>As at {{ trial_balances[0].date.strftime('%d %B %Y') }}</h2>
|
||||||
|
|
||||||
|
<table class="ledger onedesc">
|
||||||
|
<tr>
|
||||||
|
<th></th>
|
||||||
|
{% for trial_balance in trial_balances %}<th class="h2">{{ trial_balance.date.strftime('%Y') }} </th>{% endfor %}
|
||||||
|
</tr>
|
||||||
|
{% for account in accounts %}
|
||||||
<tr>
|
<tr>
|
||||||
<th></th>
|
<td>{{ account.name }}</td>
|
||||||
{% for trial_balance in trial_balances %}<th class="h2">{{ trial_balance.date.strftime('%Y') }} </th>{% endfor %}
|
{% for trial_balance in trial_balances %}
|
||||||
|
{% set balance = trial_balance.get_balance(account).exchange(report_currency, True) %}
|
||||||
|
<td>{% if balance != 0 %}{{ balance|a }}{% endif %}</td>
|
||||||
|
{% endfor %}
|
||||||
</tr>
|
</tr>
|
||||||
{% for account in accounts %}
|
{% endfor %}
|
||||||
<tr>
|
</table>
|
||||||
<td>{{ account.name }}</td>
|
{% endblock %}
|
||||||
{% for trial_balance in trial_balances %}
|
|
||||||
{% set balance = trial_balance.get_balance(account).exchange(report_currency, True) %}
|
|
||||||
<td>{% if balance != 0 %}{{ balance|a }}{% endif %}</td>
|
|
||||||
{% endfor %}
|
|
||||||
</tr>
|
|
||||||
{% endfor %}
|
|
||||||
</table>
|
|
||||||
</body>
|
|
||||||
</html>
|
|
||||||
|
@ -72,8 +72,21 @@ table.ledger a:hover {
|
|||||||
text-decoration: underline;
|
text-decoration: underline;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
a.homelink {
|
||||||
|
color: #888;
|
||||||
|
position: absolute;
|
||||||
|
top: 0;
|
||||||
|
left: 0;
|
||||||
|
}
|
||||||
|
|
||||||
@media screen {
|
@media screen {
|
||||||
body {
|
body {
|
||||||
padding: 2em;
|
padding: 2em;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@media print {
|
||||||
|
a.homelink {
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
Reference in New Issue
Block a user