From 15c71ad31a736eaf4e2204a2a05e28c1dcf6fa83 Mon Sep 17 00:00:00 2001 From: Hugo Date: Thu, 5 Oct 2023 16:54:45 +0200 Subject: [PATCH] treasury summary --- .../note/mails/summary_notes_report.html | 65 ++++++++++ .../note/mails/summary_notes_report.txt | 33 +++++ apps/scripts | 2 +- apps/treasury/models.py | 114 ++++++++++++++++++ note.cron | 2 + 5 files changed, 215 insertions(+), 1 deletion(-) create mode 100644 apps/note/templates/note/mails/summary_notes_report.html create mode 100644 apps/note/templates/note/mails/summary_notes_report.txt diff --git a/apps/note/templates/note/mails/summary_notes_report.html b/apps/note/templates/note/mails/summary_notes_report.html new file mode 100644 index 00000000..be15f7d5 --- /dev/null +++ b/apps/note/templates/note/mails/summary_notes_report.html @@ -0,0 +1,65 @@ +{% load pretty_money %} +{% load i18n %} + + + + + + [Note Kfet] Récapitulatif de trésorerie + + +

+ Récapitulatif de trésorerie au {{ summary.date|date:"d/m/Y" }} à {{ summary.date|date:"H:i:s" }} : +

+ +

+ Tous les utilisateurs : +

+ + +

+ Les adhérents BDE : +

+ + +

+ Clubs : +

+ + +

+ Clubs hors BDE / Kfet et club dont le nom fini par "- BDE" : +

+ + +

+ Progression: +

+ + +-- +

+ Le BDE
+ {% trans "Mail generated by the Note Kfet on the" %} {% now "j F Y à H:i:s" %} +

+ + diff --git a/apps/note/templates/note/mails/summary_notes_report.txt b/apps/note/templates/note/mails/summary_notes_report.txt new file mode 100644 index 00000000..5196450d --- /dev/null +++ b/apps/note/templates/note/mails/summary_notes_report.txt @@ -0,0 +1,33 @@ +{% load pretty_money %} +{% load i18n %} + +Récapitulatif de trésorerie au {{ summary.date|date:"d/m/Y" }} à {{ summary.date|date:"H:i:s" }} : + +Tous les utilisateurs : + - Positifs : {{ summary.total_positive_user }} soit {{ summary.balance_positive_user }} euros + - Neutres : {{ summary.total_zero_user }} + - Négatifs : {{ summary.total_negative_user }} soit {{ summary.balance_negative_user }} euros + +Les adhérents BDE : + - Positifs : {{ summary.total_positive_user_bde }} soit {{ summary.balance_positive_user_bde }} euros + - Neutres : {{ summary.total_zero_user_bde }} + - Négatifs : {{ summary.total_negative_user_bde }} soit {{ summary.balance_negative_user_bde }} euros + +Clubs : + - Positifs : {{ summary.total_positive_club }} soit {{ summary.balance_positive_club }} euros + - Neutres : {{ summary.total_zero_club }} + - Négatifs : {{ summary.total_negative_club }} soit {{ summary.balance_negative_club }} euros + +Clubs hors BDE / Kfet et club dont le nom fini par "- BDE" : + - Positifs : {{ summary.total_positive_club_nbde }} soit {{ summary.balance_positive_club_nbde }} euros + - Neutres : {{ summary.total_zero_club_nbde }} + - Négatifs : {{ summary.total_negative_club_nbde }} soit {{ summary.balance_negative_club_nbde }} euros + +Progression: + - Ceci correspond à une différence de {{ balance_difference_user }} euros pour les utilisateurs + - Ceci correspond à une différence de {{ balance_difference_club }} euros pour les clubs + +-- +Le BDE + +{% trans "Mail generated by the Note Kfet on the" %} {% now "j F Y à H:i:s" %} diff --git a/apps/scripts b/apps/scripts index f580f9b9..f76acb32 160000 --- a/apps/scripts +++ b/apps/scripts @@ -1 +1 @@ -Subproject commit f580f9b9e9beee76605975fdbc3a2014769e3c61 +Subproject commit f76acb32487635fe28907b637955e110a37b06cc diff --git a/apps/treasury/models.py b/apps/treasury/models.py index 69fc6e6b..26662336 100644 --- a/apps/treasury/models.py +++ b/apps/treasury/models.py @@ -460,3 +460,117 @@ class SogeCredit(models.Model): self.credit_transaction._force_save = True self.credit_transaction.save() super().delete(**kwargs) + + +class NoteSummary(models.Model): + """ + Summary of every notes + """ + + date = models.DateField( + default=date.today, + verbose_name=_("Date"), + ) + + total_positive_user = models.PositiveIntegerField( + verbose_name=_("Total positive user"), + ) + + balance_positive_user = models.PositiveIntegerField( + verbose_name=_("Balance positive user"), + ) + + total_positive_user_bde = models.PositiveIntegerField( + verbose_name=_("Total positive user BDE"), + ) + + balance_positive_user_bde = models.PositiveIntegerField( + verbose_name=_("Balance positive user BDE"), + ) + + total_zero_user = models.PositiveIntegerField( + verbose_name=_("Total zero user"), + ) + + total_zero_user_bde = models.PositiveIntegerField( + verbose_name=_("Total zero user BDE"), + ) + + total_negative_user = models.PositiveIntegerField( + verbose_name=_("Total negative user"), + ) + + balance_negative_user = models.PositiveIntegerField( + verbose_name=_("Balance negative user"), + ) + + total_negative_user_bde = models.PositiveIntegerField( + verbose_name=_("Total negative user BDE"), + ) + + balance_negative_user_bde = models.PositiveIntegerField( + verbose_name=_("Balance negative user BDE"), + ) + + total_vnegative_user = models.PositiveIntegerField( + verbose_name=_("Total very negative user"), + ) + + balance_vnegative_user = models.PositiveIntegerField( + verbose_name=_("Balance very negative user"), + ) + + total_vnegative_user_bde = models.PositiveIntegerField( + verbose_name=_("Total very negative user BDE"), + ) + + balance_vnegative_user_bde = models.PositiveIntegerField( + verbose_name=_("Balance very negative user BDE"), + ) + + total_positive_club = models.PositiveIntegerField( + verbose_name=_("Total positive club"), + ) + + balance_positive_club = models.PositiveIntegerField( + verbose_name=_("Balance positive club"), + ) + + total_positive_club_nbde = models.PositiveIntegerField( + verbose_name=_("Total positive club nbde"), + ) + + balance_positive_club_nbde = models.PositiveIntegerField( + verbose_name=_("Balance positive club nbde"), + ) + + total_zero_club = models.PositiveIntegerField( + verbose_name=_("Total zero club"), + ) + + total_zero_club_nbde = models.PositiveIntegerField( + verbose_name=_("Total zero club nbde"), + ) + + total_negative_club = models.PositiveIntegerField( + verbose_name=_("Total negative club"), + ) + + balance_negative_club = models.PositiveIntegerField( + verbose_name=_("Balance negative club"), + ) + + total_negative_club_nbde = models.PositiveIntegerField( + verbose_name=_("Total negative club nbde"), + ) + + balance_negative_club_nbde = models.PositiveIntegerField( + verbose_name=_("Balance negative club nbde"), + ) + + class Meta: + verbose_name = _("Summary") + verbose_name_plural = _("Summaries") + + def __str__(self): + return "Note summary of {date}".format(date=self.date) diff --git a/note.cron b/note.cron index a54ad031..3f6aa06d 100644 --- a/note.cron +++ b/note.cron @@ -19,6 +19,8 @@ MAILTO=notekfet2020@lists.crans.org 00 5 * * 2 root cd /var/www/note_kfet && env/bin/python manage.py send_mail_to_negative_balances --spam --negative-amount 1 -v 0 # Envoyer le rapport mensuel aux trésoriers et respos info 00 8 * * 5 root cd /var/www/note_kfet && env/bin/python manage.py send_mail_to_negative_balances --report --add-years 1 -v 0 +# Envoyer le recap de tresorerie + 00 8 * * 5 root cd /var/www/note_kfet && env/bin/python manage.py send_summary_notes_report --negative-amount 2000 # Envoyer les rapports aux gens 55 6 * * * root cd /var/www/note_kfet && env/bin/python manage.py send_reports -v 0 # Mettre à jour les boutons mis en avant