diff --git a/scipost_django/finances/templates/finances/_hx_country_level_data.html b/scipost_django/finances/templates/finances/_hx_country_level_data.html index 5551ea2cc71b13c150c54cb8e274fe880943c9c6..66b83b91faa4ef30e46dd8dd3df2f28ab2219502 100644 --- a/scipost_django/finances/templates/finances/_hx_country_level_data.html +++ b/scipost_django/finances/templates/finances/_hx_country_level_data.html @@ -7,7 +7,7 @@ <thead> <tr> <th></th> - <th style="text-align: right;">Contribution</th> + <th style="text-align: right;">Subsidy income</th> <th style="text-align: right;">Expenditures</th> <th style="text-align: right;">Balance</th> </tr> @@ -15,14 +15,14 @@ <tbody> <tr class="bg-light"> <td>Cumulative</td> - <td style="text-align: right;">{{ cumulative.contribution }}</td> + <td style="text-align: right;">{{ cumulative.subsidy_income }}</td> <td style="text-align: right;">{{ cumulative.expenditures }}</td> <td style="text-align: right;">{{ cumulative.balance }}</td> </tr> {% for year, val in per_year.items %} <tr> <td>{{ year }}</td> - <td style="text-align: right;">{{ val.contribution }}</td> + <td style="text-align: right;">{{ val.subsidy_income }}</td> <td style="text-align: right;">{{ val.expenditures }}</td> <td style="text-align: right;">{{ val.balance }}</td> </tr> @@ -30,37 +30,43 @@ </tbody> </table> +{% if 'finadmin' in user_roles %} -<h2 class="highlight mt-5">Cumulative, per Organization</h2> + <div class="border border-danger p-2"> + <p><strong>[FinAdmin]</strong></p> -<table class="table"> - <thead> - <tr> - <th></th> - <th></th> - <th style="text-align: right;">Contribution</th> - <th style="text-align: right;">Expenditures</th> - <th style="text-align: right;">Balance</th> - </tr> - </thead> - <tbody> - <tr class="bg-light"> - <td>Total</td> - <td></td> - <td style="text-align: right;">{{ cumulative.contribution }}</td> - <td style="text-align: right;">{{ cumulative.expenditures }}</td> - <td style="text-align: right;">{{ cumulative.balance }}</td> - </tr> - {% for organization in organizations %} - {% if organization.cf_balance_info.cumulative.contribution > 0 or organization.cf_balance_info.cumulative.expenditures > 0 %} + <h2 class="highlight mt-5">Cumulative, per Organization</h2> + + <table class="table"> + <thead> <tr> - <td><a href="https://{{ request.get_host }}{{ organization.get_absolute_url }}">{{ organization }}</a></td> - <td>{{ organization.get_orgtype_display }}</td> - <td style="text-align: right;">{{ organization.cf_balance_info.cumulative.contribution }}</td> - <td style="text-align: right;">{{ organization.cf_balance_info.cumulative.expenditures }}</td> - <td style="text-align: right;">{{ organization.cf_balance_info.cumulative.balance }}</td> + <th></th> + <th></th> + <th style="text-align: right;">Subsidy Income</th> + <th style="text-align: right;">Expenditures</th> + <th style="text-align: right;">Balance</th> </tr> - {% endif %} - {% endfor %} - </tbody> -</table> + </thead> + <tbody> + <tr class="bg-light"> + <td>Total</td> + <td></td> + <td style="text-align: right;">{{ cumulative.subsidy_income }}</td> + <td style="text-align: right;">{{ cumulative.expenditures }}</td> + <td style="text-align: right;">{{ cumulative.balance }}</td> + </tr> + {% for organization in organizations %} + {% if organization.cf_balance_info.cumulative.subsidy_income > 0 or organization.cf_balance_info.cumulative.expenditures > 0 %} + <tr> + <td><a href="https://{{ request.get_host }}{{ organization.get_absolute_url }}">{{ organization }}</a></td> + <td>{{ organization.get_orgtype_display }}</td> + <td style="text-align: right;">{{ organization.cf_balance_info.cumulative.subsidy_income }}</td> + <td style="text-align: right;">{{ organization.cf_balance_info.cumulative.expenditures }}</td> + <td style="text-align: right;">{{ organization.cf_balance_info.cumulative.balance }}</td> + </tr> + {% endif %} + {% endfor %} + </tbody> + </table> + +{% endif %} diff --git a/scipost_django/finances/templates/finances/finances.html b/scipost_django/finances/templates/finances/finances.html index 3906f88b74307746565c04405612f50ddcac700f..9d039d657762d9f3bbc1ce4b828c1c0a9c898e6f 100644 --- a/scipost_django/finances/templates/finances/finances.html +++ b/scipost_django/finances/templates/finances/finances.html @@ -43,6 +43,8 @@ <img src="data:image/png;base64,{{ subsidies_plot }}"> + <p>You are also encouraged to consult our <a href="{% url 'finances:country_level_data' %}">country-level financial info pages</a> to see a per-country breakdown of our expenditures and subsidy income.</p> + <h3 class="highlight">Current Resources & Sustainability Level</h3> <div class="container"> <table class="table mb-4"> diff --git a/scipost_django/finances/views.py b/scipost_django/finances/views.py index d916ac7f841e5c459a02a6d821daed9dfd6378fc..fd6270a584c028984414626e11afa7d6d36e4e8a 100644 --- a/scipost_django/finances/views.py +++ b/scipost_django/finances/views.py @@ -231,27 +231,27 @@ def _hx_country_level_data(request, country): context = { "country": country, "organizations": organizations, - "cumulative": {"contribution": 0, "expenditures": 0, "balance": 0}, + "cumulative": {"subsidy_income": 0, "expenditures": 0, "balance": 0}, "per_year": {}, } for year in pubyears: context["per_year"][year] = { - "contribution": 0, + "subsidy_income": 0, "expenditures": 0, "balance": 0, } for organization in organizations.all(): - for key in ("contribution", "expenditures", "balance"): + for key in ("subsidy_income", "expenditures", "balance"): context["cumulative"][key] += organization.cf_balance_info["cumulative"][ key ] for year in pubyears: - context["per_year"][year]["contribution"] += organization.cf_balance_info[ + context["per_year"][year]["subsidy_income"] += organization.cf_balance_info[ year - ]["contribution"] + ]["subsidy_income"] context["per_year"][year]["expenditures"] += organization.cf_balance_info[ year - ]["expenditures"]["total"] + ]["expenditures"]["total"]["expenditures"] context["per_year"][year]["balance"] += organization.cf_balance_info[year][ "balance" ]