From 4ad5b074755d581dcb63983daea5cd7ee76e086e Mon Sep 17 00:00:00 2001 From: mariusrklein <47218379+mariusrklein@users.noreply.github.com> Date: Tue, 15 Apr 2025 22:01:27 +0200 Subject: [PATCH] fix: simplified logic and increased verbosity --- .../finance/locale/de/LC_MESSAGES/django.po | 35 +++++----------- jdav_web/finance/models.py | 42 +++++++++++-------- .../admin/overview_submitted_statement.html | 6 ++- .../templates/finance/statement_summary.tex | 8 +++- .../members/locale/de/LC_MESSAGES/django.po | 15 ++++--- .../admin/freizeit_finance_overview.html | 4 +- 6 files changed, 55 insertions(+), 55 deletions(-) diff --git a/jdav_web/finance/locale/de/LC_MESSAGES/django.po b/jdav_web/finance/locale/de/LC_MESSAGES/django.po index cff36a5..c875643 100644 --- a/jdav_web/finance/locale/de/LC_MESSAGES/django.po +++ b/jdav_web/finance/locale/de/LC_MESSAGES/django.po @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2025-04-06 18:46+0200\n" +"POT-Creation-Date: 2025-04-15 21:12+0200\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" @@ -301,27 +301,11 @@ msgstr "Übernachtungs- und Fahrtkosten für %(excu)s" msgid "reduced by org fee" msgstr "reduziert um Org-Beitrag" -#: finance/models.py -#, fuzzy, python-format -#| msgid "Night and travel costs for %(excu)s" -msgid "Night and travel costs for %(excu)s, reduced by org fee" -msgstr "Übernachtungs- und Fahrtkosten für %(excu)s" - #: finance/models.py #, python-format msgid "LJP-Contribution %(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 msgid "Total" msgstr "Gesamtbetrag" @@ -548,12 +532,11 @@ msgstr "" #: finance/templates/admin/overview_submitted_statement.html #, python-format msgid "" -"The subsidies for night and transportation costs of " -"%(total_subsidies_theoretical)s€ should be paid to:" +"The subsidies for night and transportation costs of %(total_subsidies)s€ " +"should be paid to:" msgstr "" -"Die Zuschüsse für Übernachtungs- und Fahrtkosten von " -"%(total_subsidies_theoretical)s€ für alle Jugendleiter*innen sollen " -"ausgezahlt werden an:" +"Die Zuschüsse für Übernachtungs- und Fahrtkosten von %(total_subsidies)s€ " +"für alle Jugendleiter*innen sollen ausgezahlt werden an:" #: finance/templates/admin/overview_submitted_statement.html msgid "" @@ -562,6 +545,10 @@ msgstr "" "Keine Empfänger*innen für Sektionszuschüsse angegeben. Es werden daher keine " "Sektionszuschüsse ausbezahlt." +#: finance/templates/admin/overview_submitted_statement.html +msgid "Org fee" +msgstr "Organisationsbeitrag" + #: finance/templates/admin/overview_submitted_statement.html #, python-format msgid "" @@ -576,8 +563,8 @@ msgstr "" "Aufwandsentschädigungen verrechnet." #: finance/templates/admin/overview_submitted_statement.html -msgid "Organisation fees" -msgstr "Org-Beitrag" +msgid "LJP contributions" +msgstr "LJP-Zuschüsse" #: finance/templates/admin/overview_submitted_statement.html #, python-format diff --git a/jdav_web/finance/models.py b/jdav_web/finance/models.py index e37f79e..51ea118 100644 --- a/jdav_web/finance/models.py +++ b/jdav_web/finance/models.py @@ -135,9 +135,10 @@ class Statement(CommonModel): needed_paiments.extend([(yl, self.allowance_per_yl) for yl in self.allowance_to.all()]) if self.subsidy_to: 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.total_org_fee: + needed_paiments.append((self.org_fee_payant, -self.total_org_fee)) if self.ljp_to: needed_paiments.append((self.ljp_to, self.paid_ljp_contributions)) @@ -251,18 +252,14 @@ class Statement(CommonModel): Transaction(statement=self, member=yl, amount=self.allowance_per_yl, confirmed=False, reference=ref).save() # subsidies (i.e. night and transportation costs) - if self.subsidy_to or self.total_org_fee: - if self.total_org_fee == 0: - 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 self.subsidy_to: + ref = _("Night and travel costs for %(excu)s") % {'excu': self.excursion.name} + Transaction(statement=self, member=self.subsidy_to, amount=self.total_subsidies, confirmed=False, reference=ref).save() + + if self.total_org_fee: # 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() + ref = _("reduced by org fee") + Transaction(statement=self, member=self.org_fee_payant, amount=-self.total_org_fee, confirmed=False, reference=ref).save() if self.ljp_to: ref = _("LJP-Contribution %(excu)s") % {'excu': self.excursion.name} @@ -396,7 +393,11 @@ class Statement(CommonModel): return cvt_to_decimal(0) @property - def total_subsidies_theoretical(self): + def org_fee_payant(self): + return self.subsidy_to if self.subsidy_to else self.allowance_to.all()[0] + + @property + def total_subsidies(self): """ 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. @@ -407,8 +408,8 @@ class Statement(CommonModel): return cvt_to_decimal(0) @property - def total_subsidies(self): - return self.total_subsidies_theoretical - self.total_org_fee + def subsidies_paid(self): + return self.total_subsidies - self.total_org_fee @property def theoretical_total_staff(self): @@ -423,6 +424,11 @@ class Statement(CommonModel): the sum of subsidies and allowances that youth leaders are actually collecting """ return self.total_allowance + self.total_subsidies + + @property + def total_staff_paid(self): + return self.total_staff - self.total_org_fee + @property def real_staff_count(self): @@ -455,7 +461,7 @@ class Statement(CommonModel): @property def total(self): - return self.total_bills + self.total_staff + self.paid_ljp_contributions + return self.total_bills + self.total_staff_paid + self.paid_ljp_contributions @property def total_theoretic(self): @@ -507,10 +513,10 @@ class Statement(CommonModel): 'participant_count': self.excursion.participant_count, 'total_seminar_days': self.excursion.total_seminar_days, '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, + 'total_staff_paid': self.total_staff_paid, } return dict(context, **excursion_context) else: diff --git a/jdav_web/finance/templates/admin/overview_submitted_statement.html b/jdav_web/finance/templates/admin/overview_submitted_statement.html index cdd4d09..c93cc08 100644 --- a/jdav_web/finance/templates/admin/overview_submitted_statement.html +++ b/jdav_web/finance/templates/admin/overview_submitted_statement.html @@ -98,7 +98,7 @@ {% endif %} {% if statement.subsidy_to %}

-{% blocktrans %}The subsidies for night and transportation costs of {{ total_subsidies_theoretical }}€ should be paid to:{% endblocktrans %} +{% blocktrans %}The subsidies for night and transportation costs of {{ total_subsidies }}€ should be paid to:{% endblocktrans %} @@ -115,12 +115,14 @@ {% endif %} {% if total_org_fee %} +

{% trans "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 %} +

{% trans "LJP contributions" %}

{% blocktrans %} The youth leaders have documented interventions worth of {{ total_seminar_days }} seminar days for {{ participant_count }} eligible participants. Taking into account the maximum contribution quota @@ -172,7 +174,7 @@ Once their proposal was approved, the ljp contributions of should be paid to:{%

{% trans "IBAN valid" %}
- {% trans "Organisation fees" %} + {% trans "Org fee" %} -{{ total_org_fee }}€ diff --git a/jdav_web/finance/templates/finance/statement_summary.tex b/jdav_web/finance/templates/finance/statement_summary.tex index 55f26a3..d9b3678 100644 --- a/jdav_web/finance/templates/finance/statement_summary.tex +++ b/jdav_web/finance/templates/finance/statement_summary.tex @@ -82,6 +82,12 @@ in der Ausgabenübersicht gesondert aufgeführt. {% endif %} +{% if statement.total_org_fee %} +\noindent\textbf{Organisationsbeitrag} + +\noindent An der Ausfahrt haben {{ statement.old_participant_count }} Personen teilgenommen, die 27 Jahre alt oder älter sind. Für sie wird pro Tag ein Organisationsbeitrag von 10,00 € erhoben und mit den bezahlten Zuschüssen und Aufwandsentschädigungen verrechnet. +{% endif %} + {% else %} \vspace{110pt} {% endif %} @@ -119,7 +125,7 @@ in der Ausgabenübersicht gesondert aufgeführt. \multicolumn{2}{l}{abzüglich Organisationsbeitrag für {{ old_participant_count }} Teilnehmende über 27 } & & -{{ statement.total_org_fee }} €\\ {% endif %} \midrule - \multicolumn{3}{l}{\textbf{Summe Zuschüsse und Aufwandsentschädigung Jugendleitende}} & \textbf{ {{ statement.total_staff }} }€\\ + \multicolumn{3}{l}{\textbf{Summe Zuschüsse und Aufwandsentschädigung Jugendleitende}} & \textbf{ {{ statement.total_staff_paid }} }€\\ {%endif %} {% if statement.ljp_to %} \midrule diff --git a/jdav_web/members/locale/de/LC_MESSAGES/django.po b/jdav_web/members/locale/de/LC_MESSAGES/django.po index 381d19f..cd4e1e8 100644 --- a/jdav_web/members/locale/de/LC_MESSAGES/django.po +++ b/jdav_web/members/locale/de/LC_MESSAGES/django.po @@ -1366,12 +1366,11 @@ msgstr "" #: members/templates/admin/freizeit_finance_overview.html #, python-format msgid "" -"The subsidies for night and transportation costs of " -"%(total_subsidies_theoretical)s€ is configured to be paid to:" +"The subsidies for night and transportation costs of %(total_subsidies)s€ is " +"configured to be paid to:" msgstr "" -"Die Zuschüsse für Übernachtungs- und Fahrtkosten von " -"%(total_subsidies_theoretical)s€ für alle Jugendleiter*innen werden " -"ausgezahlt an:" +"Die Zuschüsse für Übernachtungs- und Fahrtkosten von %(total_subsidies)s€ " +"für alle Jugendleiter*innen werden ausgezahlt an:" #: members/templates/admin/freizeit_finance_overview.html msgid "" @@ -1394,9 +1393,9 @@ msgid "" msgstr "" "Achtung: %(old_participant_count)s Teilnehmende der Ausfahrt sind 27 oder " "älter. Für diese Teilnehmende(n) ist ein Org-Beitrag von 10,00 € pro Tag " -"fällig. Durch die Länge der Ausfahrt von %(duration)s Tagen werden insgesamt %(total_org_fee_theoretical)s € mit den " -"Zuschüssen und Aufwandsentschädigungen verrechnet, sofern diese in Anspruch " -"genommen werden." +"fällig. Durch die Länge der Ausfahrt von %(duration)s Tagen 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 msgid "" diff --git a/jdav_web/members/templates/admin/freizeit_finance_overview.html b/jdav_web/members/templates/admin/freizeit_finance_overview.html index bd50ae5..ee9b311 100644 --- a/jdav_web/members/templates/admin/freizeit_finance_overview.html +++ b/jdav_web/members/templates/admin/freizeit_finance_overview.html @@ -109,7 +109,7 @@ cost plan! {% endif %} {% if memberlist.statement.subsidy_to %}

-{% blocktrans %}The subsidies for night and transportation costs of {{ total_subsidies_theoretical }}€ is configured to be paid to:{% endblocktrans %} +{% blocktrans %}The subsidies for night and transportation costs of {{ total_subsidies }}€ is configured to be paid to:{% endblocktrans %} @@ -186,7 +186,7 @@ you may obtain up to 25€ times {{ duration }} days for {{ participant_count }} {% trans "Contributions by the association" %}
{% trans "IBAN valid" %} - -{{ total_subsidies_theoretical }}€ + -{{ total_subsidies }}€