diff --git a/alexia/apps/billing/views.py b/alexia/apps/billing/views.py index 70e02cd..7053bef 100644 --- a/alexia/apps/billing/views.py +++ b/alexia/apps/billing/views.py @@ -2,7 +2,7 @@ from django.contrib.auth.mixins import LoginRequiredMixin from django.core.exceptions import PermissionDenied from django.core import serializers -from django.db.models import Count, Sum +from django.db.models import Count, Sum, Q from django.db.models.functions import ExtractYear, TruncMonth from django.http import Http404, JsonResponse, HttpResponseRedirect from django.shortcuts import get_object_or_404, render @@ -102,10 +102,11 @@ def get_queryset(self): return Event.objects.filter(organizer=self.request.organization) \ .annotate( order_count=Count('orders'), + writeoff_order_count=Count('writeoff_orders'), revenue=Sum('orders__amount'), visitors=Count('orders__authorization', distinct=True), ) \ - .filter(order_count__gt=0, ) \ + .filter(Q(order_count__gt=0) | Q(writeoff_order_count__gt=0)) \ .order_by('-starts_at') \ .select_related('pricegroup') diff --git a/locale/nl/LC_MESSAGES/django.mo b/locale/nl/LC_MESSAGES/django.mo index ed4cd6c..1acb39d 100644 Binary files a/locale/nl/LC_MESSAGES/django.mo and b/locale/nl/LC_MESSAGES/django.mo differ diff --git a/locale/nl/LC_MESSAGES/django.po b/locale/nl/LC_MESSAGES/django.po index 2ac973d..1c5946c 100644 --- a/locale/nl/LC_MESSAGES/django.po +++ b/locale/nl/LC_MESSAGES/django.po @@ -6,8 +6,8 @@ msgid "" msgstr "" "Project-Id-Version: alexia\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-10-11 13:14+0200\n" -"PO-Revision-Date: 2024-10-11 13:14+0018\n" +"POT-Creation-Date: 2024-10-11 13:42+0200\n" +"PO-Revision-Date: 2024-10-11 13:42+0018\n" "Last-Translator: b'Kevin Alberts '\n" "Language-Team: WWW-commissie \n" "Language: nl\n" @@ -776,7 +776,6 @@ msgid "availability" msgstr "beschikbaarheid" #: alexia/apps/scheduling/models.py:249 -#| msgid "comments" msgid "comment" msgstr "commentaar" @@ -1058,11 +1057,16 @@ msgstr "Statistieken" msgid "The amount of unique debtors this event" msgstr "Het aantal unieke debiteuren deze activiteit" -#: templates/billing/order_list.html:51 templates/billing/order_month.html:18 templates/billing/pricegroup_confirm_delete.html:3 templates/billing/pricegroup_detail.html:3 templates/billing/pricegroup_detail.html:8 templates/billing/productgroup_detail.html:29 templates/billing/productgroup_detail.html:71 templates/billing/sellingprice_list.html:14 +#: templates/billing/order_list.html:51 +#| msgid "Write off" +msgid "Write-offs" +msgstr "Afschrijvingen" + +#: templates/billing/order_list.html:52 templates/billing/order_month.html:18 templates/billing/pricegroup_confirm_delete.html:3 templates/billing/pricegroup_detail.html:3 templates/billing/pricegroup_detail.html:8 templates/billing/productgroup_detail.html:29 templates/billing/productgroup_detail.html:71 templates/billing/sellingprice_list.html:14 msgid "Price group" msgstr "Prijsgroep" -#: templates/billing/order_list.html:66 +#: templates/billing/order_list.html:68 #, python-format msgid "%(organization)s hasn't used Alexia Billing yet!" msgstr "%(organization)s heeft Alexia Financieel nog niet in gebruik!" @@ -2024,7 +2028,6 @@ msgid "Unknown" msgstr "Onbekend" #: templates/scheduling/event_detail.html:148 -#| msgid "bartender" msgid "Comment by bartender" msgstr "Commentaar van tapper" diff --git a/templates/billing/order_list.html b/templates/billing/order_list.html index 6e4e8ca..fc8826f 100644 --- a/templates/billing/order_list.html +++ b/templates/billing/order_list.html @@ -48,6 +48,7 @@

{% trans 'Visitors' %} {% trans 'Transactions' %} {% trans 'Revenue' %} + {% if request.organization.writeoff_enabled %}{% trans 'Write-offs' %}{% endif %} {% trans 'Price group' %} @@ -58,7 +59,8 @@

{{ event.name }} {{ event.visitors }} {{ event.order_count }} - € {{ event.revenue|floatformat:2 }} + € {{ event.revenue|floatformat:2|default:"—" }} + {% if request.organization.writeoff_enabled %}{{ event.writeoff_order_count }}{% endif %} {{ event.pricegroup }} {% empty %}