use stored payments in finance view and improve design
This commit is contained in:
@@ -105,6 +105,8 @@ table {
|
|||||||
margin-top: 12px;
|
margin-top: 12px;
|
||||||
margin-bottom: 12px;
|
margin-bottom: 12px;
|
||||||
border-spacing: 0;
|
border-spacing: 0;
|
||||||
|
border-right: 1px solid #664422;
|
||||||
|
border-bottom: 1px solid #664422;
|
||||||
}
|
}
|
||||||
|
|
||||||
td {
|
td {
|
||||||
@@ -112,8 +114,8 @@ td {
|
|||||||
text-align: right;
|
text-align: right;
|
||||||
font-size: 0.9rem;
|
font-size: 0.9rem;
|
||||||
border-top: 1px solid #664422;
|
border-top: 1px solid #664422;
|
||||||
border-left: 1px solid #664422;;
|
border-left: 1px solid #664422;
|
||||||
padding: 2px 4px;
|
padding: 3px 6px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.bandbox {
|
.bandbox {
|
||||||
|
|||||||
@@ -16,41 +16,39 @@
|
|||||||
|
|
||||||
<h2>aktueller Stand</h2>
|
<h2>aktueller Stand</h2>
|
||||||
|
|
||||||
<h3>Ausgaben</h3>
|
|
||||||
<ul>
|
<ul>
|
||||||
<li>27.05., Rasen, 10€</li>
|
{% for topic, amount in balance_dict.items %}
|
||||||
|
<li>{{ amount }}€ {{ topic }}</li>
|
||||||
|
{% endfor %}
|
||||||
</ul>
|
</ul>
|
||||||
<p>Summe: 10€</p>
|
<p><b>Summe: {{ overall_sum }}€</b></p>
|
||||||
|
|
||||||
<h3>Einnahmen</h3>
|
<h3>Details</h3>
|
||||||
<ul>
|
|
||||||
<li>22.04., Feierkredit, 50€</li>
|
|
||||||
<li>29.04., Feierkredit, 30€</li>
|
|
||||||
<li>09.05., Feierkredit, 15€</li>
|
|
||||||
</ul>
|
|
||||||
<p>Summe: 95€</p>
|
|
||||||
|
|
||||||
<p><b>Gesamt: +85€</b></p>
|
{% for topic, payments in detailed_payments.items %}
|
||||||
|
<p>{{ topic }}:</p>
|
||||||
|
<table>
|
||||||
|
{% for payment in payments %}
|
||||||
|
<tr>
|
||||||
|
<td>{{ payment.date|date:"d.m." }}</td>
|
||||||
|
<td>{{ payment.amount }}€</td>
|
||||||
|
<td>{{ payment.other_party }}</td>
|
||||||
|
<td>{{ payment.note }}</td>
|
||||||
|
</tr>
|
||||||
|
{% endfor %}
|
||||||
|
</table>
|
||||||
|
{% endfor %}
|
||||||
|
|
||||||
<h2>Geplantes</h2>
|
<h2>Geplantes</h2>
|
||||||
|
|
||||||
<h3>Ausgaben</h3>
|
<h3>Ausgaben</h3>
|
||||||
<ul>
|
<ul>
|
||||||
<li>Getränke, 500 - 800€</li>
|
<li>Getränke, 500 - 800€</li>
|
||||||
<li>Dixis, 20 - 220€</li>
|
<li>Dixis, 180 - 250€</li>
|
||||||
<li>Baumarkt (Lack, Lichter, Pavillons, Strom), 100 - 250€</li>
|
<li>Baumarkt (Lack, Lichter, Pavillons, Strom), 100 - 250€</li>
|
||||||
<li>Band-Gage, 300 - 500€</li>
|
<li>Band-Gage, 300 - 500€</li>
|
||||||
</ul>
|
</ul>
|
||||||
<p>Summe: 920 - 1.770€</p>
|
<p>Summe: 1.080 - 1.800€</p>
|
||||||
|
|
||||||
<h3>Einnahmen</h3>
|
|
||||||
<ul>
|
|
||||||
<li>Feierkredit (Zahlungen im Voraus)</li>
|
|
||||||
<li>Eintritt</li>
|
|
||||||
<li>Getränkeverkauf</li>
|
|
||||||
<li>Essensverkauf</li>
|
|
||||||
<li>Spenden</li>
|
|
||||||
</ul>
|
|
||||||
|
|
||||||
<h3>Getränke</h3>
|
<h3>Getränke</h3>
|
||||||
<p>Wir haben hier mal mit der Erfahrung des letzten Jahres grob überschlagen:</p>
|
<p>Wir haben hier mal mit der Erfahrung des letzten Jahres grob überschlagen:</p>
|
||||||
|
|||||||
@@ -1,7 +1,11 @@
|
|||||||
from datetime import date
|
from collections import defaultdict
|
||||||
|
from datetime import date, timezone
|
||||||
|
|
||||||
|
from django.utils import timezone
|
||||||
from django.views.generic import TemplateView
|
from django.views.generic import TemplateView
|
||||||
|
|
||||||
|
from gaehsnitz.models import Payment
|
||||||
|
|
||||||
festival_start_date, festival_end_date = date(2022, 8, 25), date(2022, 8, 28)
|
festival_start_date, festival_end_date = date(2022, 8, 25), date(2022, 8, 28)
|
||||||
|
|
||||||
|
|
||||||
@@ -31,6 +35,28 @@ class ProgramView(GaehsnitzTemplateView):
|
|||||||
class FinanceView(GaehsnitzTemplateView):
|
class FinanceView(GaehsnitzTemplateView):
|
||||||
template_name = "gaehsnitz/finance.html"
|
template_name = "gaehsnitz/finance.html"
|
||||||
|
|
||||||
|
def get_context_data(self, **kwargs):
|
||||||
|
context = super().get_context_data(**kwargs)
|
||||||
|
|
||||||
|
balance_dict = defaultdict(int)
|
||||||
|
detailed_payments = defaultdict(list)
|
||||||
|
overall_sum = 0
|
||||||
|
for payment in Payment.objects.filter(date__year=timezone.now().year).order_by("topic", "date"):
|
||||||
|
topic_name = Payment.Topic(payment.topic).label
|
||||||
|
sign = 1 if payment.is_incoming() else -1
|
||||||
|
balance_dict[topic_name] += sign * payment.amount
|
||||||
|
overall_sum += sign * payment.amount
|
||||||
|
if payment.is_outgoing() and payment.topic != Payment.Topic.bands:
|
||||||
|
detailed_payments[topic_name].append(payment)
|
||||||
|
|
||||||
|
context.update({
|
||||||
|
# apparently defaultdicts do not work
|
||||||
|
"balance_dict": dict(balance_dict),
|
||||||
|
"overall_sum": overall_sum,
|
||||||
|
"detailed_payments": dict(detailed_payments),
|
||||||
|
})
|
||||||
|
return context
|
||||||
|
|
||||||
|
|
||||||
class ForBandsView(GaehsnitzTemplateView):
|
class ForBandsView(GaehsnitzTemplateView):
|
||||||
template_name = "gaehsnitz/for-bands.html"
|
template_name = "gaehsnitz/for-bands.html"
|
||||||
|
|||||||
Reference in New Issue
Block a user