Skip to content

Commit

Permalink
Show drinks with writeoffs in transaction list
Browse files Browse the repository at this point in the history
  • Loading branch information
Kurocon committed Oct 11, 2024
1 parent 6d3feb0 commit f76baf4
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 9 deletions.
5 changes: 3 additions & 2 deletions alexia/apps/billing/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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')

Expand Down
Binary file modified locale/nl/LC_MESSAGES/django.mo
Binary file not shown.
15 changes: 9 additions & 6 deletions locale/nl/LC_MESSAGES/django.po
Original file line number Diff line number Diff line change
Expand Up @@ -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 <[email protected]>'\n"
"Language-Team: WWW-commissie <[email protected]>\n"
"Language: nl\n"
Expand Down Expand Up @@ -776,7 +776,6 @@ msgid "availability"
msgstr "beschikbaarheid"

#: alexia/apps/scheduling/models.py:249
#| msgid "comments"
msgid "comment"
msgstr "commentaar"

Expand Down Expand Up @@ -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!"
Expand Down Expand Up @@ -2024,7 +2028,6 @@ msgid "Unknown"
msgstr "Onbekend"

#: templates/scheduling/event_detail.html:148
#| msgid "bartender"
msgid "Comment by bartender"
msgstr "Commentaar van tapper"

Expand Down
4 changes: 3 additions & 1 deletion templates/billing/order_list.html
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ <h1>
<th class="col-xs-1"><abbr title="{% trans 'The amount of unique debtors this event' %}">{% trans 'Visitors' %}</abbr></th>
<th class="col-xs-1">{% trans 'Transactions' %}</th>
<th class="col-xs-1">{% trans 'Revenue' %}</th>
{% if request.organization.writeoff_enabled %}<th>{% trans 'Write-offs' %}</th>{% endif %}
<th class="col-xs-2">{% trans 'Price group' %}</th>
</tr>
</thead>
Expand All @@ -58,7 +59,8 @@ <h1>
<td><a href="{% url 'event-orders' event.pk %}">{{ event.name }}</a></td>
<td>{{ event.visitors }}</td>
<td>{{ event.order_count }}</td>
<td>&euro; {{ event.revenue|floatformat:2 }}</td>
<td>&euro; {{ event.revenue|floatformat:2|default:"&mdash;" }}</td>
{% if request.organization.writeoff_enabled %}<td>{{ event.writeoff_order_count }}</td>{% endif %}
<td>{{ event.pricegroup }}</td>
</tr>
{% empty %}
Expand Down

0 comments on commit f76baf4

Please sign in to comment.