Fix quarterly payment schedule to correct advance payment dates
- Q1: Due December 15 (previous year) - Q2: Due March 15 - Q3: Due June 15 - Q4: Due September 15 Added new management command fix_quarterly_payment_schedule to update existing payments
This commit is contained in:
@@ -0,0 +1,22 @@
|
||||
Vorname;Nachname;E-Mail;Telefon;IBAN;Straße;PLZ;Ort;Personentyp;Geburtsdatum;Pachtnummer;Pachtbeginn_Erste;Pachtende_Letzte;Pachtzins_Aktuell;Landwirtschaftliche_Ausbildung;Berufserfahrung_Jahre;Spezialisierung;Notizen;Aktiv
|
||||
N/A;Groiner Milch KG;;;;Groiner Allee 18;46459;Rees;Gesellschaft;;;;;;;;;;WAHR
|
||||
N/A;M u D Becker GbR;;;;Helweg 76;46348;Raesfeld;Gesellschaft;;;;;;;;;;WAHR
|
||||
Walter;Buchmann;;;;Büskes Heide 11;46499;Hamminkeln-Brünen;Herrn;;;;;;;;;;WAHR
|
||||
Andreas;Elbers;;;;Grietherbusch Nr. 15;46459;Rees;Herrn;;;;;;;;;;WAHR
|
||||
N/A;Fischer GbR;;;;Werricher Strasse 1;46487;Wesel;Gesellschaft;;;;;;;;;;WAHR
|
||||
Michael;Ingenbleek;;;;Achterhoeker Schulweg 39 a;47626;Kevelaer;Herrn;;;;;;;;;;WAHR
|
||||
N/A;Bröcheler KG;;;;Kervenheimer Str. 30;47626;Kevelaer;Gesellschaft;;;;;;;;;;WAHR
|
||||
Jens;Bodden;;;;Moelscher Weg 16;47574;Goch;Herrn;;;;;;;;;;WAHR
|
||||
Marcel;Müller;;;;Weysche Strasse 55;47546;Kalkar-Hanselaer;Herrn;;;;;;;;;;WAHR
|
||||
Ludger;Paeßens;;;;Bergerfurther Strasse 4;46499;Hamminkeln;Herrn;;;;;;;;;;WAHR
|
||||
N/A;Sander GbR;;;;Hardtbergweg 21;46569;Hünxe;Gesellschaft;;;;;;;;;;WAHR
|
||||
Dirk;Schmäh;;;;Schlümersweg 7 A;46499;Hamminkeln-Brünen;Herrn;;;;;;;;;;WAHR
|
||||
Wolfgang;Schmitz;;;;Höst-Vornicker-Weg 1;47652;Weeze;Herrn;;;;;;;;;;WAHR
|
||||
Sebastian;Scholten;;;;Underbergsheide 46;46485;Wesel-Obrighoven;Herrn;;;;;;;;;;WAHR
|
||||
N/A;Ulmenhorst GbR;;;;Schlootweg 10;46499;Hamminkeln;Gesellschaft;;;;;;;;;;WAHR
|
||||
Simone;Gerten;;;;Obrighovener Str. 107;46485;Wesel;Frau;;;;;;;;;;WAHR
|
||||
Günther;Engelmann;;;;Loher Weg 42;46484;Wesel;Herrn;;;;;;;;;;WAHR
|
||||
N/A;Lühlshof KG;;;;Auf dem Heidchen 27;46485;Wesel;Gesellschaft;;;;;;;;;;WAHR
|
||||
Walter;Schmidt;;;;Ilserheider Str. 4;32469;Petershagen;Herrn;;;;;;;;;;WAHR
|
||||
N/A;Inge und Tom Rose GbR;;;;Kohlbreite 22;34414;Warburg-Calenberg;Gesellschaft;;;;;;;;;;WAHR
|
||||
N/A;Stiftung;;;;Schwarzensteiner Weg 75;46569;Hünxe;;;;;;;;;;;WAHR
|
||||
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
Binary file not shown.
11
app/static.backup.20250930_171758/README.md
Normal file
11
app/static.backup.20250930_171758/README.md
Normal file
@@ -0,0 +1,11 @@
|
||||
# Static Files Directory
|
||||
|
||||
This directory contains static files for the Django application.
|
||||
|
||||
## Structure:
|
||||
- `css/` - Custom CSS files
|
||||
- `js/` - Custom JavaScript files
|
||||
- `img/` - Image assets
|
||||
- `fonts/` - Font files
|
||||
|
||||
Static files are collected to `staticfiles/` directory during deployment via `python manage.py collectstatic`.
|
||||
@@ -0,0 +1,107 @@
|
||||
from django.core.management.base import BaseCommand
|
||||
from django.db.models import Q
|
||||
from datetime import date
|
||||
from stiftung.models import DestinataerUnterstuetzung
|
||||
|
||||
|
||||
class Command(BaseCommand):
|
||||
help = 'Fix quarterly payment due dates to correct advance payment schedule'
|
||||
|
||||
def add_arguments(self, parser):
|
||||
parser.add_argument(
|
||||
'--dry-run',
|
||||
action='store_true',
|
||||
help='Show what would be changed without making actual changes',
|
||||
)
|
||||
|
||||
def handle(self, *args, **options):
|
||||
dry_run = options['dry_run']
|
||||
|
||||
if dry_run:
|
||||
self.stdout.write(
|
||||
self.style.WARNING('DRY RUN MODE - No changes will be made')
|
||||
)
|
||||
|
||||
# Find all quarterly support payments that need fixing
|
||||
payments_to_fix = DestinataerUnterstuetzung.objects.filter(
|
||||
beschreibung__contains="Vierteljährliche Unterstützung"
|
||||
).exclude(
|
||||
beschreibung__contains="Korrektur" # Avoid fixing already corrected payments
|
||||
)
|
||||
|
||||
total_fixed = 0
|
||||
|
||||
for payment in payments_to_fix:
|
||||
# Extract quarter and year from description
|
||||
desc = payment.beschreibung
|
||||
try:
|
||||
# Look for pattern like "Q1/2025", "Q2/2025", etc.
|
||||
import re
|
||||
match = re.search(r'Q(\d)/(\d{4})', desc)
|
||||
if not match:
|
||||
continue
|
||||
|
||||
quartal = int(match.group(1))
|
||||
jahr = int(match.group(2))
|
||||
|
||||
# Calculate correct due date based on advance payment schedule
|
||||
if quartal == 1: # Q1 payment due December 15 of previous year
|
||||
correct_due_date = date(jahr - 1, 12, 15)
|
||||
elif quartal == 2: # Q2 payment due March 15
|
||||
correct_due_date = date(jahr, 3, 15)
|
||||
elif quartal == 3: # Q3 payment due June 15
|
||||
correct_due_date = date(jahr, 6, 15)
|
||||
elif quartal == 4: # Q4 payment due September 15
|
||||
correct_due_date = date(jahr, 9, 15)
|
||||
else:
|
||||
continue
|
||||
|
||||
# Check if this payment needs updating
|
||||
if payment.faellig_am != correct_due_date:
|
||||
old_date = payment.faellig_am
|
||||
|
||||
if dry_run:
|
||||
self.stdout.write(
|
||||
f"Would update {payment.destinataer.get_full_name()} "
|
||||
f"Q{quartal}/{jahr} payment: {old_date} -> {correct_due_date}"
|
||||
)
|
||||
else:
|
||||
payment.faellig_am = correct_due_date
|
||||
payment.save()
|
||||
|
||||
self.stdout.write(
|
||||
self.style.SUCCESS(
|
||||
f"Updated {payment.destinataer.get_full_name()} "
|
||||
f"Q{quartal}/{jahr} payment: {old_date} -> {correct_due_date}"
|
||||
)
|
||||
)
|
||||
|
||||
total_fixed += 1
|
||||
|
||||
except (ValueError, AttributeError) as e:
|
||||
self.stdout.write(
|
||||
self.style.WARNING(
|
||||
f"Could not parse quarter/year from: {desc} - {e}"
|
||||
)
|
||||
)
|
||||
continue
|
||||
|
||||
if dry_run:
|
||||
self.stdout.write(
|
||||
self.style.WARNING(
|
||||
f"Would fix {total_fixed} payment due dates"
|
||||
)
|
||||
)
|
||||
else:
|
||||
self.stdout.write(
|
||||
self.style.SUCCESS(
|
||||
f"Successfully fixed {total_fixed} payment due dates"
|
||||
)
|
||||
)
|
||||
|
||||
# Show the expected schedule
|
||||
self.stdout.write("\nCorrect advance payment schedule:")
|
||||
self.stdout.write("Q1: Due December 15 (previous year)")
|
||||
self.stdout.write("Q2: Due March 15")
|
||||
self.stdout.write("Q3: Due June 15")
|
||||
self.stdout.write("Q4: Due September 15")
|
||||
@@ -7533,16 +7533,16 @@ def create_quarterly_support_payment(nachweis):
|
||||
if not default_konto:
|
||||
return None
|
||||
|
||||
# Calculate payment due date (quarterly payments with Q4 aligned to semester)
|
||||
# Q1: March 15, Q2: June 15, Q3: September 15, Q4: September 15
|
||||
# Calculate payment due date (advance payments 3 months before quarter)
|
||||
# Q1: December 15 (previous year), Q2: March 15, Q3: June 15, Q4: September 15
|
||||
|
||||
if nachweis.quartal == 1: # Q1 payment due March 15
|
||||
if nachweis.quartal == 1: # Q1 payment due December 15 of previous year
|
||||
payment_due_date = date(nachweis.jahr - 1, 12, 15)
|
||||
elif nachweis.quartal == 2: # Q2 payment due March 15
|
||||
payment_due_date = date(nachweis.jahr, 3, 15)
|
||||
elif nachweis.quartal == 2: # Q2 payment due June 15
|
||||
elif nachweis.quartal == 3: # Q3 payment due June 15
|
||||
payment_due_date = date(nachweis.jahr, 6, 15)
|
||||
elif nachweis.quartal == 3: # Q3 payment due September 15
|
||||
payment_due_date = date(nachweis.jahr, 9, 15)
|
||||
else: # Q4 payment due September 15 (same as Q3 for semester alignment)
|
||||
else: # Q4 payment due September 15
|
||||
payment_due_date = date(nachweis.jahr, 9, 15)
|
||||
|
||||
# Create the support payment
|
||||
|
||||
Reference in New Issue
Block a user