diff --git a/src/pretix/base/services/stats.py b/src/pretix/base/services/stats.py index 96d0ca6acb..563df0ce05 100644 --- a/src/pretix/base/services/stats.py +++ b/src/pretix/base/services/stats.py @@ -127,6 +127,7 @@ def order_overview( order__event=event ).annotate( status=Case( + When(order__status='n', order__require_approval=True, then=Value('unapproved')), When(canceled=True, then=Value('c')), default=F('order__status') ) @@ -135,6 +136,7 @@ def order_overview( ).annotate(cnt=Count('id'), price=Sum('price'), tax_value=Sum('tax_value')).order_by() states = { + 'unapproved': 'unapproved', 'canceled': Order.STATUS_CANCELED, 'paid': Order.STATUS_PAID, 'pending': Order.STATUS_PENDING, @@ -198,6 +200,7 @@ def order_overview( order__event=event ).annotate( status=Case( + When(order__status='n', order__require_approval=True, then=Value('unapproved')), When(canceled=True, then=Value('c')), default=F('order__status') ) diff --git a/src/pretix/control/templates/pretixcontrol/orders/overview.html b/src/pretix/control/templates/pretixcontrol/orders/overview.html index 158af93235..feca95a7a4 100644 --- a/src/pretix/control/templates/pretixcontrol/orders/overview.html +++ b/src/pretix/control/templates/pretixcontrol/orders/overview.html @@ -12,7 +12,14 @@ -

{% trans "Order overview" %}

+

+ {% trans "Order overview" %} + + + {% trans "PDF" %} + +

{% if request.event.has_subevents %} @@ -58,12 +65,14 @@ {% trans "Product" %} {% trans "Canceled" %}ยน {% trans "Expired" %} + {% trans "Approval pending" %} {% trans "Purchased" %} + {% trans "Pending" %} {% trans "Paid" %} {% trans "Total" %} @@ -76,6 +85,7 @@ {{ tup.0 }} {{ tup.0.num.canceled|togglesum:request.event.currency }} {{ tup.0.num.expired|togglesum:request.event.currency }} + {{ tup.0.num.unapproved|togglesum:request.event.currency }} {{ tup.0.num.pending|togglesum:request.event.currency }} {{ tup.0.num.paid|togglesum:request.event.currency }} {{ tup.0.num.total|togglesum:request.event.currency }} @@ -94,6 +104,11 @@ {{ item.num.expired|togglesum:request.event.currency }} + + + {{ item.num.unapproved|togglesum:request.event.currency }} + + {{ item.num.pending|togglesum:request.event.currency }} @@ -122,6 +137,11 @@ {{ var.num.expired|togglesum:request.event.currency }} + + + {{ var.num.unapproved|togglesum:request.event.currency }} + + {{ var.num.pending|togglesum:request.event.currency }} @@ -146,6 +166,7 @@ {% trans "Total" %} {{ total.num.canceled|togglesum:request.event.currency }} {{ total.num.expired|togglesum:request.event.currency }} + {{ total.num.unapproved|togglesum:request.event.currency }} {{ total.num.pending|togglesum:request.event.currency }} {{ total.num.paid|togglesum:request.event.currency }} {{ total.num.total|togglesum:request.event.currency }} diff --git a/src/pretix/plugins/reports/exporters.py b/src/pretix/plugins/reports/exporters.py index dc4e250432..fd23ad8551 100644 --- a/src/pretix/plugins/reports/exporters.py +++ b/src/pretix/plugins/reports/exporters.py @@ -1,3 +1,4 @@ +import copy import tempfile from collections import OrderedDict, defaultdict from decimal import Decimal @@ -14,6 +15,7 @@ from django.utils.formats import date_format, localize from django.utils.timezone import get_current_timezone, now from django.utils.translation import gettext as _, gettext_lazy, pgettext from reportlab.lib import colors +from reportlab.lib.enums import TA_CENTER from reportlab.platypus import PageBreak from pretix.base.decimal import round_decimal @@ -183,27 +185,44 @@ class OverviewReport(Report): headlinestyle.fontSize = 15 headlinestyle.fontName = 'OpenSansBd' colwidths = [ - a * doc.width for a in (.33, 0.05, .075, 0.05, .075, 0.05, .075, 0.05, .075, 0.05, .075) + a * doc.width for a in ( + 1 - (0.05 + 0.075) * 6, + 0.05, .075, + 0.05, .075, + 0.05, .075, + 0.05, .075, + 0.05, .075, + 0.05, .075 + ) ] tstyledata = [ ('SPAN', (1, 0), (2, 0)), ('SPAN', (3, 0), (4, 0)), - ('SPAN', (5, 0), (-1, 0)), - ('SPAN', (5, 1), (6, 1)), + ('SPAN', (5, 0), (6, 1)), + ('SPAN', (7, 0), (-1, 0)), ('SPAN', (7, 1), (8, 1)), ('SPAN', (9, 1), (10, 1)), + ('SPAN', (11, 1), (12, 1)), ('ALIGN', (0, 0), (-1, 1), 'CENTER'), ('ALIGN', (1, 2), (-1, -1), 'RIGHT'), ('VALIGN', (0, 0), (-1, -1), 'MIDDLE'), ('FONTNAME', (0, 0), (-1, 1), 'OpenSansBd'), ('FONTNAME', (0, -1), (-1, -1), 'OpenSansBd'), - ('FONTSIZE', (0, 0), (-1, -1), 9), + ('FONTSIZE', (0, 0), (-1, -1), 8), ('LINEBEFORE', (1, 0), (1, -1), 1, colors.lightgrey), ('LINEBEFORE', (3, 0), (3, -1), 1, colors.lightgrey), ('LINEBEFORE', (5, 0), (5, -1), 1, colors.lightgrey), - ('LINEBEFORE', (7, 1), (7, -1), 1, colors.lightgrey), + ('LINEBEFORE', (7, 0), (7, -1), 1, colors.lightgrey), ('LINEBEFORE', (9, 1), (9, -1), 1, colors.lightgrey), + ('LINEBEFORE', (11, 1), (11, -1), 1, colors.lightgrey), ] + tstyle = copy.copy(self.get_style()) + tstyle.fontSize = 8 + tstyle_bold = copy.copy(tstyle) + tstyle_bold.fontSize = 8 + tstyle_bold.fontName = 'OpenSansBd' + tstyle_th = copy.copy(tstyle_bold) + tstyle_th.alignment = TA_CENTER story = [ Paragraph(_('Orders by product') + ' ' + (_('(excl. taxes)') if net else _('(incl. taxes)')), headlinestyle), Spacer(1, 5 * mm) @@ -227,11 +246,18 @@ class OverviewReport(Report): story.append(Spacer(1, 5 * mm)) tdata = [ [ - _('Product'), _('Canceled'), '', _('Expired'), '', _('Purchased'), + _('Product'), + Paragraph(_('Canceled'), tstyle_th), + '', + Paragraph(_('Expired'), tstyle_th), + '', + Paragraph(_('Approval pending'), tstyle_th), + '', + Paragraph(_('Purchased'), tstyle_th), '', '', '', '', '' ], [ - '', '', '', '', '', _('Pending'), '', _('Paid'), '', _('Total'), '' + '', '', '', '', '', '', '', _('Pending'), '', _('Paid'), '', _('Total'), '' ], [ '', @@ -240,6 +266,7 @@ class OverviewReport(Report): _('#'), self.event.currency, _('#'), self.event.currency, _('#'), self.event.currency, + _('#'), self.event.currency, ], ] @@ -255,6 +282,7 @@ class OverviewReport(Report): states = ( ('canceled', Order.STATUS_CANCELED), ('expired', Order.STATUS_EXPIRED), + ('unapproved', 'unapproved'), ('pending', Order.STATUS_PENDING), ('paid', Order.STATUS_PAID), ('total', None), @@ -262,9 +290,8 @@ class OverviewReport(Report): for tup in items_by_category: if tup[0]: - tstyledata.append(('FONTNAME', (0, len(tdata)), (-1, len(tdata)), 'OpenSansBd')) tdata.append([ - tup[0].name, + Paragraph(tup[0].name, tstyle_bold) ]) for l, s in states: tdata[-1].append(str(tup[0].num[l][0])) @@ -279,7 +306,7 @@ class OverviewReport(Report): if item.has_variations: for var in item.all_variations: tdata.append([ - " " + str(var), + Paragraph(" " + str(var), tstyle) ]) for l, s in states: tdata[-1].append(str(var.num[l][0])) diff --git a/src/pretix/static/pretixcontrol/scss/_orders.scss b/src/pretix/static/pretixcontrol/scss/_orders.scss index 05e08e16c3..c57725055e 100644 --- a/src/pretix/static/pretixcontrol/scss/_orders.scss +++ b/src/pretix/static/pretixcontrol/scss/_orders.scss @@ -14,7 +14,7 @@ padding-left: 40px; } td:not(:first-child), - th:not(:first-child):not(.text-center) { + th:not(:first-child) { border-left: 1px solid #ddd; padding-right: 10px !important; padding-left: 10px !important; @@ -34,7 +34,7 @@ .table-product-overview { td:not(:first-child), th:not(:first-child):not(.text-center) { - width: 150px; + width: 120px; } } }