Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Reports #277

Merged
merged 13 commits into from
Jan 13, 2024
4 changes: 0 additions & 4 deletions assets/templates/accounts/associations_base.html
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,6 @@ <h2>{{ association }}</h2>
</li>

{% if association.has_site_stats_access %}
<li class="nav-item">
<a class="nav-link{% block tab_site_dining %}{% endblock %}"
href="{% url 'association_site_dining_stats' slug=association.slug %}">Site Dining</a>
</li>
<li class="nav-item">
<a class="nav-link{% block tab_site_credits %}{% endblock %}"
href="{% url 'association_site_credit_stats' slug=association.slug %}">Site Credits</a>
Expand Down
37 changes: 0 additions & 37 deletions assets/templates/accounts/site_dining_stats.html

This file was deleted.

29 changes: 13 additions & 16 deletions assets/templates/base.html
Original file line number Diff line number Diff line change
Expand Up @@ -40,11 +40,6 @@
<a class="dropdown-item {{ justify }}" href="{% url 'settings_account' %}">
Settings <i class="fas fa-cog fa-fw"></i>
</a>
{% if user.has_admin_site_access %}
<a class="dropdown-item {{ justify }}" href="{% url 'admin:index' %}">
Control panel <i class="fas fa-toolbox fa-fw"></i>
</a>
{% endif %}
{% if user.boards.count > 0 %}
<div class="dropdown-divider"></div>
{% endif %}
Expand All @@ -64,6 +59,19 @@
{% endif %}
</a>
{% endfor %}
{% if user.has_site_stats_access or user.has_admin_site_access %}
<div class="dropdown-divider"></div>
{% endif %}
{% if user.has_site_stats_access %}
<a class="dropdown-item {{ justify }}" href="{% url 'reports:index' %}">
Reports <i class="fas fa-chart-line fa-fw"></i>
</a>
{% endif %}
{% if user.has_admin_site_access %}
<a class="dropdown-item {{ justify }}" href="{% url 'admin:index' %}">
Control panel <i class="fas fa-toolbox fa-fw"></i>
</a>
{% endif %}
<div class="dropdown-divider"></div>
<form method="post" action="{% url 'account_logout' %}">
{% csrf_token %}
Expand Down Expand Up @@ -97,17 +105,6 @@
<span class="badge badge-pill badge-warning">!</span>
{% endif %}
</a>
{# <div class="dropdown-divider"></div>#}
{# <a class="dropdown-item {{ justify }}" href="{% url "statistics" %}">#}
{# <span>Statistics <span class="badge badge-warning">New</span></span>#}
{# <i class="fas fa-chart-simple"></i>#}
{# </a>#}
{# <a class="dropdown-item" href="{% url 'site_updates' %}">#}
{# News and updates#}
{# {% if user.requires_information_updates %}#}
{# <span class="badge badge-pill badge-warning">!</span>#}
{# {% endif %}#}
{# </a>#}
</div>
</div>
</div>
Expand Down
3 changes: 3 additions & 0 deletions assets/templates/base_no_navbar.html
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,9 @@
<script src="{% static 'admin/js/vendor/jquery/jquery.min.js' %}"></script>
</head>
<body>
{% if SITE_BANNER %}
<div class="w-100 bg-warning text-center p-1">{{ SITE_BANNER }}</div>
{% endif %}
{% block body %}{% endblock %}
{# Bootstrap JS bundle (jQuery is already loaded in the head). #}
<script src="https://cdn.jsdelivr.net/npm/bootstrap@4.6.2/dist/js/bootstrap.bundle.min.js"
Expand Down
77 changes: 0 additions & 77 deletions assets/templates/dining_lists/statistics.html

This file was deleted.

39 changes: 39 additions & 0 deletions assets/templates/reports/balance.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
{% extends 'reports/base.html' %}

{% block report %}
<h2>Balance report <small class="text-muted">{{ period }}</small></h2>

{% url 'reports:balance' as url %}{% include 'reports/snippets/controls.html' %}

<table class="table table-sm">
<thead>
<tr>
<th scope="col">Account</th>
<th scope="col" class="text-right">Start balance</th>
<th scope="col" class="text-right">Increase</th>
<th scope="col" class="text-right">Reduction</th>
<th scope="col" class="text-right">End balance</th>
</tr>
</thead>
<tbody>
{% for account, statement in rows %}
<tr class="{% if account.special %}table-primary{% elif account.association %}table-secondary{% else %}table-dark{% endif %}">
<td>
{% if account.special %}
{{ account.get_special_display }}
{% elif account.association %}
{{ account.association.get_short_name }}
{% else %}
User accounts<br>
<small class="text-muted">Sum of the balances of all user accounts.</small>
{% endif %}
</td>
<td class="text-right">{{ statement.start_balance|default_if_none:"" }}</td>
<td class="text-right">{{ statement.increase|default_if_none:"" }}</td>
<td class="text-right">{{ statement.reduction|default_if_none:"" }}</td>
<td class="text-right">{{ statement.end_balance|default_if_none:"" }}</td>
</tr>
{% endfor %}
</tbody>
</table>
{% endblock %}
6 changes: 6 additions & 0 deletions assets/templates/reports/base.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{% extends 'base.html' %}

{% block content %}
{% block nav %}<a href="{% url 'reports:index' %}">← View all reports</a>{% endblock %}
{% block report %}{% endblock %}
{% endblock %}
43 changes: 43 additions & 0 deletions assets/templates/reports/cashflow.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
{% extends 'reports/base.html' %}

{% block nav %}
<a href="{% url 'reports:cashflow_index' %}">← Choose account</a>
{% endblock %}

{% block report %}
<h2>
Cash flow
<small class="text-muted">{{ account }} / {{ period }}</small>
</h2>

{% url 'reports:cashflow' pk=account.pk as url %}{% include 'reports/snippets/controls.html' %}

<p class="lead">
Inflow is in the direction from the opposite account towards
the <strong>{{ account }}</strong> account. Outflow is in the other direction.
</p>

<table class="table table-sm">
<thead>
<tr>
<th scope="col">Opposite account</th>
<th scope="col" class="text-right w-25">Inflow</th>
<th scope="col" class="text-right w-25">Outflow</th>
</tr>
</thead>
<tbody>
{% for account, inflow, outflow in statements %}
<tr class="{% if account.special %}table-primary{% elif account.association %}table-secondary{% else %}table-dark{% endif %}">
<td>
{% if account %}{{ account }}
<a href="{% url 'reports:cashflow' pk=account.pk %}?view={{ period.view_name }}&period={{ period.url_param }}">»</a>
{% else %}User accounts
{% endif %}
</td>
<td class="text-right">{{ inflow|default:"–" }}</td>
<td class="text-right">{{ outflow|default:"–" }}</td>
</tr>
{% endfor %}
</tbody>
</table>
{% endblock %}
33 changes: 33 additions & 0 deletions assets/templates/reports/cashflow_index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
{% extends 'reports/base.html' %}

{% block report %}
<h2>Cash flow <small class="text-muted">Choose account</small></h2>
<h4 class="mt-3">Bookkeeping accounts</h4>
<div class="row">
<div class="col-md-6">
<div class="list-group">
{% for account in bookkeeping_accounts %}
<a href="{% url 'reports:cashflow' pk=account.pk %}"
class="list-group-item list-group-item-action">
{{ account }}
</a>
{% endfor %}
</div>
</div>
</div>

<h4 class="mt-3">Association accounts</h4>
<div class="row">
<div class="col-md-6">
<div class="list-group">
{% for account in association_accounts %}
<a href="{% url 'reports:cashflow' pk=account.pk %}"
class="list-group-item list-group-item-action">
{{ account }}
</a>
{% endfor %}
</div>
</div>
</div>

{% endblock %}
67 changes: 67 additions & 0 deletions assets/templates/reports/cashflow_matrix.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
{% extends 'reports/base.html' %}

{% block report %}
<h2>
Cash flow matrix
<small class="text-muted">{{ period }}</small>
</h2>

{% url 'reports:cashflow_matrix' as url %}{% include 'reports/snippets/controls.html' %}

<div class="table-responsive">
<table class="table table-sm">
<thead>
<tr>
<td colspan="2" class="border-0"></td>
<th colspan="{{ accounts|length }}" class="text-center">To</th>
</tr>
<tr>
<td colspan="2" class="border-0"></td>
{% for account in accounts %}
<th scope="col"
style="width: 4.5rem;"
class="text-center {% if account.special %}table-primary{% elif account.association %}
table-secondary{% else %}table-dark{% endif %}">
{% if account.special %}
{{ account.get_special_display|truncatechars:6 }}
{% elif account.association %}
{{ account.association.get_short_name|truncatechars:6 }}
{% else %}
Users
{% endif %}
</th>
{% endfor %}
</tr>
</thead>
<tbody>
{% for account_from, row in table %}
<tr>
{% if forloop.first %}
<th scope="row"
class="align-middle"
rowspan="{{ accounts|length }}">From
</th>
{% endif %}
<th scope="row"
class="{% if account_from.special %}bg-primary{% elif account_from.association %}bg-secondary{% else %}bg-dark{% endif %}">
{% if account_from.special %}
{{ account_from.get_special_display }}
{% elif account_from.association %}
{{ account_from.association.get_short_name }}
{% else %}
Users
{% endif %}
</th>
{% for account_to, amount in row %}
{% if account_from == account_to %}
<td class="text-center">×</td>
{% else %}
<td class="text-right">{{ amount|default:"" }}</td>
{% endif %}
{% endfor %}
</tr>
{% endfor %}
</tbody>
</table>
</div>
{% endblock %}
Loading