feat(finance/excursion): implement org. fee for people over 27

pull/149/head
mariusrklein 9 months ago
parent fd4770d295
commit 42b6f7590b

@ -302,6 +302,16 @@ msgstr "Übernachtungs- und Fahrtkosten für %(excu)s"
msgid "LJP-Contribution %(excu)s" msgid "LJP-Contribution %(excu)s"
msgstr "LJP-Zuschuss %(excu)s" msgstr "LJP-Zuschuss %(excu)s"
#: finance/models.py
#: finance/models.py
msgid "reduced by org fee"
msgstr "reduziert um Org-Beitrag"
#: finance/models.py
#, python-format
msgid "Night and travel costs for %(excu)s, reduced by org fee"
msgstr "Übernachtungs- und Fahrtkosten für %(excu)s, reduziert um Org-Beitrag"
#: finance/models.py #: finance/models.py
msgid "Total" msgid "Total"
msgstr "Gesamtbetrag" msgstr "Gesamtbetrag"
@ -528,11 +538,12 @@ msgstr ""
#: finance/templates/admin/overview_submitted_statement.html #: finance/templates/admin/overview_submitted_statement.html
#, python-format #, python-format
msgid "" msgid ""
"The subsidies for night and transportation costs of %(total_subsidies)s€ " "The subsidies for night and transportation costs of "
"should be paid to:" "%(total_subsidies_theoretical)s€ should be paid to:"
msgstr "" msgstr ""
"Die Zuschüsse für Übernachtungs- und Fahrtkosten von %(total_subsidies)s€ " "Die Zuschüsse für Übernachtungs- und Fahrtkosten von "
"für alle Jugendleiter*innen sollen ausgezahlt werden an:" "%(total_subsidies_theoretical)s€ für alle Jugendleiter*innen sollen "
"ausgezahlt werden an:"
#: finance/templates/admin/overview_submitted_statement.html #: finance/templates/admin/overview_submitted_statement.html
msgid "" msgid ""
@ -541,6 +552,23 @@ msgstr ""
"Keine Empfänger*innen für Sektionszuschüsse angegeben. Es werden daher keine " "Keine Empfänger*innen für Sektionszuschüsse angegeben. Es werden daher keine "
"Sektionszuschüsse ausbezahlt." "Sektionszuschüsse ausbezahlt."
#: finance/templates/admin/overview_submitted_statement.html
#, python-format
msgid ""
"Since overaged people where part of the excursion, an organisational fee of "
"10,00€ per person per day has to be paid. This totals to "
"%(total_org_fee_theoretical)s€. This organisational fee will be accounted "
"against allowances and subsidies."
msgstr ""
"Da Personen über 27 an der Ausfahrt teilnehommen haben, wird ein "
"Organisationsbeitrag von 10,00€ pro Person und Tag fällig. Der Gesamtbetrag "
"von %(total_org_fee_theoretical)s€ wird mit Zuschüssen und "
"Aufwandsentschädigungen verrechnet."
#: finance/templates/admin/overview_submitted_statement.html
msgid "Organisation fees"
msgstr "Org-Beitrag"
#: finance/templates/admin/overview_submitted_statement.html #: finance/templates/admin/overview_submitted_statement.html
#, python-format #, python-format
msgid "" msgid ""

@ -135,6 +135,10 @@ class Statement(CommonModel):
needed_paiments.extend([(yl, self.allowance_per_yl) for yl in self.allowance_to.all()]) needed_paiments.extend([(yl, self.allowance_per_yl) for yl in self.allowance_to.all()])
if self.subsidy_to: if self.subsidy_to:
needed_paiments.append((self.subsidy_to, self.total_subsidies)) needed_paiments.append((self.subsidy_to, self.total_subsidies))
# only include org fee if either allowance or subsidy is claimed (part of the property)
elif self.total_org_fee:
needed_paiments.append((self.allowance_to.all()[0], self.total_subsidies))
if self.ljp_to: if self.ljp_to:
needed_paiments.append((self.ljp_to, self.paid_ljp_contributions)) needed_paiments.append((self.ljp_to, self.paid_ljp_contributions))
@ -247,13 +251,23 @@ class Statement(CommonModel):
Transaction(statement=self, member=yl, amount=self.allowance_per_yl, confirmed=False, reference=ref).save() Transaction(statement=self, member=yl, amount=self.allowance_per_yl, confirmed=False, reference=ref).save()
# subsidies (i.e. night and transportation costs) # subsidies (i.e. night and transportation costs)
if self.subsidy_to: if self.subsidy_to or self.total_org_fee:
ref = _("Night and travel costs for %(excu)s") % {'excu': self.excursion.name} if self.total_org_fee == 0:
Transaction(statement=self, member=self.subsidy_to, amount=self.total_subsidies, confirmed=False, reference=ref).save() ref = _("Night and travel costs for %(excu)s") % {'excu': self.excursion.name}
elif not self.subsidy_to:
ref = _("reduced by org fee")
else:
ref = _("Night and travel costs for %(excu)s, reduced by org fee") % {'excu': self.excursion.name}
# if no subsidy receiver is given but org fees have to be paid. Just pick on of allowance receivers
member = self.subsidy_to if self.subsidy_to else self.allowance_to.all()[0]
Transaction(statement=self, member=member, amount=self.total_subsidies, confirmed=False, reference=ref).save()
if self.ljp_to: if self.ljp_to:
ref = _("LJP-Contribution %(excu)s") % {'excu': self.excursion.name} ref = _("LJP-Contribution %(excu)s") % {'excu': self.excursion.name}
Transaction(statement=self, member=self.ljp_to, amount=self.paid_ljp_contributions, confirmed=False, reference=ref).save() Transaction(statement=self, member=self.ljp_to, amount=self.paid_ljp_contributions, confirmed=False, reference=ref).save()
return True return True
@ -369,7 +383,21 @@ class Statement(CommonModel):
return cvt_to_decimal(self.total_staff / self.excursion.staff_count) return cvt_to_decimal(self.total_staff / self.excursion.staff_count)
@property @property
def total_subsidies(self): def total_org_fee_theoretical(self):
"""participants older than 26.99 years need to pay a fee of 10€ per person per day."""
if self.excursion is None:
return 0
return cvt_to_decimal(10 * self.excursion.duration * self.excursion.old_participant_count)
@property
def total_org_fee(self):
"""only calculate org fee if subsidies or allowances are claimed."""
if self.subsidy_to or self.allowances_paid > 0:
return self.total_org_fee_theoretical
return cvt_to_decimal(0)
@property
def total_subsidies_theoretical(self):
""" """
The total amount of subsidies excluding the allowance, i.e. the transportation The total amount of subsidies excluding the allowance, i.e. the transportation
and night costs per youth leader multiplied with the real number of youth leaders. and night costs per youth leader multiplied with the real number of youth leaders.
@ -378,6 +406,10 @@ class Statement(CommonModel):
return (self.transportation_per_yl + self.nights_per_yl) * self.real_staff_count return (self.transportation_per_yl + self.nights_per_yl) * self.real_staff_count
else: else:
return cvt_to_decimal(0) return cvt_to_decimal(0)
@property
def total_subsidies(self):
return self.total_subsidies_theoretical - self.total_org_fee
@property @property
def theoretical_total_staff(self): def theoretical_total_staff(self):
@ -460,6 +492,7 @@ class Statement(CommonModel):
'allowances_paid': self.allowances_paid, 'allowances_paid': self.allowances_paid,
'nights_per_yl': self.nights_per_yl, 'nights_per_yl': self.nights_per_yl,
'allowance_per_yl': self.allowance_per_yl, 'allowance_per_yl': self.allowance_per_yl,
'total_allowance': self.total_allowance,
'transportation_per_yl': self.transportation_per_yl, 'transportation_per_yl': self.transportation_per_yl,
'total_per_yl': self.total_per_yl, 'total_per_yl': self.total_per_yl,
'total_staff': self.total_staff, 'total_staff': self.total_staff,
@ -475,6 +508,10 @@ class Statement(CommonModel):
'participant_count': self.excursion.participant_count, 'participant_count': self.excursion.participant_count,
'total_seminar_days': self.excursion.total_seminar_days, 'total_seminar_days': self.excursion.total_seminar_days,
'ljp_tax': settings.LJP_TAX * 100, 'ljp_tax': settings.LJP_TAX * 100,
'total_subsidies_theoretical': self.total_subsidies_theoretical,
'total_org_fee_theoretical': self.total_org_fee_theoretical,
'total_org_fee': self.total_org_fee,
'old_participant_count': self.excursion.old_participant_count,
} }
return dict(context, **excursion_context) return dict(context, **excursion_context)
else: else:

@ -98,7 +98,7 @@
{% endif %} {% endif %}
{% if statement.subsidy_to %} {% if statement.subsidy_to %}
<p> <p>
{% blocktrans %}The subsidies for night and transportation costs of {{ total_subsidies }}€ should be paid to:{% endblocktrans %} {% blocktrans %}The subsidies for night and transportation costs of {{ total_subsidies_theoretical }}€ should be paid to:{% endblocktrans %}
<table> <table>
<th> <th>
<td>{% trans "IBAN valid" %}</td> <td>{% trans "IBAN valid" %}</td>
@ -109,10 +109,17 @@
</tr> </tr>
</table> </table>
</p> </p>
{% else %} {% else %}
<p>{% blocktrans %}No receivers of the subsidies were provided. Subsidies will not be used.{% endblocktrans %}</p> <p>{% blocktrans %}No receivers of the subsidies were provided. Subsidies will not be used.{% endblocktrans %}</p>
{% endif %} {% endif %}
{% if total_org_fee %}
{% blocktrans %}Since overaged people where part of the excursion, an organisational fee of 10,00€ per person per day has to be paid. This totals to {{ total_org_fee_theoretical }}€. This organisational fee will be accounted against allowances and subsidies.{% endblocktrans %}
{% endif %}
{% if statement.ljp_to %} {% if statement.ljp_to %}
<p> <p>
{% blocktrans %} The youth leaders have documented interventions worth of {{ total_seminar_days }} seminar {% blocktrans %} The youth leaders have documented interventions worth of {{ total_seminar_days }} seminar
@ -163,6 +170,14 @@ Once their proposal was approved, the ljp contributions of should be paid to:{%
{{ total_subsidies }}€ {{ total_subsidies }}€
</td> </td>
</tr> </tr>
<tr>
<td>
{% trans "Organisation fees" %}
</td>
<td>
-{{ total_org_fee }}€
</td>
</tr>
<tr> <tr>
<td> <td>
{% trans "ljp contributions" %} {% trans "ljp contributions" %}

@ -1366,11 +1366,12 @@ msgstr ""
#: members/templates/admin/freizeit_finance_overview.html #: members/templates/admin/freizeit_finance_overview.html
#, python-format #, python-format
msgid "" msgid ""
"The subsidies for night and transportation costs of %(total_subsidies)s€ is " "The subsidies for night and transportation costs of "
"configured to be paid to:" "%(total_subsidies_theoretical)s€ is configured to be paid to:"
msgstr "" msgstr ""
"Die Zuschüsse für Übernachtungs- und Fahrtkosten von %(total_subsidies)s€ " "Die Zuschüsse für Übernachtungs- und Fahrtkosten von "
"für alle Jugendleiter*innen werden ausgezahlt an:" "%(total_subsidies_theoretical)s€ für alle Jugendleiter*innen werden "
"ausgezahlt an:"
#: members/templates/admin/freizeit_finance_overview.html #: members/templates/admin/freizeit_finance_overview.html
msgid "" msgid ""
@ -1379,6 +1380,20 @@ msgstr ""
"Keine Empfänger*innen für Sektionszuschüsse angegeben. Es werden daher keine " "Keine Empfänger*innen für Sektionszuschüsse angegeben. Es werden daher keine "
"Sektionszuschüsse ausbezahlt." "Sektionszuschüsse ausbezahlt."
#: members/templates/admin/freizeit_finance_overview.html
#, python-format
msgid ""
"Warning: %(old_participant_count)s participant(s) of the excursion are 27 or "
"older. For each of them, an organisation fee of 10,00 € per day has to be "
"paid to the account. A total of %(total_org_fee_theoretical)s € is charged "
"against the other transactions."
msgstr ""
"Achtung: %(old_participant_count)s Teilnehmende der Ausfahrt sind 27 oder "
"älter. Für diese Teilnehmende ist ein Org-Beitrag von 10,00 € pro Tag "
"fällig. Daher werden insgesamt %(total_org_fee_theoretical)s € mit den "
"Zuschüssen und Aufwandsentschädigungen verrechnet, sofern diese in Anspruch "
"genommen werden."
#: members/templates/admin/freizeit_finance_overview.html #: members/templates/admin/freizeit_finance_overview.html
msgid "" msgid ""
"Warning: The configured recipients of the allowance don't match the " "Warning: The configured recipients of the allowance don't match the "
@ -1442,6 +1457,10 @@ msgstr "Zusammenfassung"
msgid "This is the estimated cost and contribution summary:" msgid "This is the estimated cost and contribution summary:"
msgstr "Das ist die geschätzte Kosten- und Zuschussübersicht." msgstr "Das ist die geschätzte Kosten- und Zuschussübersicht."
#: members/templates/admin/freizeit_finance_overview.html
msgid "Organisation fees"
msgstr "Org-Beitrag"
#: members/templates/admin/freizeit_finance_overview.html #: members/templates/admin/freizeit_finance_overview.html
msgid "Potential LJP contributions" msgid "Potential LJP contributions"
msgstr "Mögliche LJP Zuschüsse" msgstr "Mögliche LJP Zuschüsse"

@ -1328,10 +1328,19 @@ class Freizeit(CommonModel):
@property @property
def participant_count(self): def participant_count(self):
return len(self.participants)
@property
def participants(self):
ps = set(map(lambda x: x.member, self.membersonlist.distinct())) ps = set(map(lambda x: x.member, self.membersonlist.distinct()))
jls = set(self.jugendleiter.distinct()) jls = set(self.jugendleiter.distinct())
return len(ps - jls) return list(ps - jls)
@property
def old_participant_count(self):
old_ps = [m for m in self.participants if m.age() >= 27]
return len(old_ps)
@property @property
def head_count(self): def head_count(self):
return self.staff_on_memberlist_count + self.participant_count return self.staff_on_memberlist_count + self.participant_count

@ -109,7 +109,7 @@ cost plan!
{% endif %} {% endif %}
{% if memberlist.statement.subsidy_to %} {% if memberlist.statement.subsidy_to %}
<p> <p>
{% blocktrans %}The subsidies for night and transportation costs of {{ total_subsidies }}€ is configured to be paid to:{% endblocktrans %} {% blocktrans %}The subsidies for night and transportation costs of {{ total_subsidies_theoretical }}€ is configured to be paid to:{% endblocktrans %}
<table> <table>
<th> <th>
<td>{% trans "IBAN valid" %}</td> <td>{% trans "IBAN valid" %}</td>
@ -122,8 +122,14 @@ cost plan!
</p> </p>
{% else %} {% else %}
<p>{% blocktrans %}No receivers of the subsidies were provided. Subsidies will not be used.{% endblocktrans %}</p> <p>{% blocktrans %}No receivers of the subsidies were provided. Subsidies will not be used.{% endblocktrans %}</p>
{% endif %}
{% if total_org_fee %}
<p>
{% blocktrans %}Warning: {{ old_participant_count }} participant(s) of the excursion are 27 or older. For each of them, an organisation fee of 10,00 € per day has to be paid to the account. A total of {{ total_org_fee_theoretical }} € is charged against the other transactions.{% endblocktrans %}
</p>
{% endif %} {% endif %}
{% if not memberlist.statement.allowance_to_valid %} {% if not memberlist.statement.allowance_to_valid %}
<p> <p>
{% blocktrans %}Warning: The configured recipients of the allowance don't match the regulations. This might be because the number of recipients is bigger then the number of admissable youth leaders for this excursion.{% endblocktrans %} {% blocktrans %}Warning: The configured recipients of the allowance don't match the regulations. This might be because the number of recipients is bigger then the number of admissable youth leaders for this excursion.{% endblocktrans %}
@ -178,12 +184,20 @@ you may obtain up to 25€ times {{ duration }} days for {{ participant_count }}
{{ total_bills_theoretic }}€ {{ total_bills_theoretic }}€
</td> </td>
</tr> </tr>
<tr>
<td>
{% trans "Organisation fees" %}
</td>
<td>
{{ total_org_fee }}€
</td>
</tr>
<tr> <tr>
<td> <td>
{% trans "Contributions by the association" %} {% trans "Contributions by the association" %}
</td> </td>
<td> <td>
-{{ total_subsidies }}€ -{{ total_subsidies_theoretical }}€
</td> </td>
</tr> </tr>
<tr> <tr>

Loading…
Cancel
Save