feat(booking): Restzahlung bar oder per Überweisung mit Zahlungserinnerung und Verfügbarkeitsampel
- Buchung: neues Feld balance_method (cash|transfer) inkl. Migration 019, Formularfeld, Validierung (Konto Pflicht bei Überweisung), Anzeige in Buchungsdetail und kopiertem Kundentext. - Auftragsbestätigung: bei Überweisung Bankverbindung der Buchung, Restbetrag mit Zahlungsziel (5 Tage vor Mietbeginn) und Hinweis auf die Erinnerung; bei Barzahlung unverändert "bei der Übergabe in bar fällig". - Zahlungserinnerung als eigene Unterlage (Migration 018): offener Betrag (Restbetrag bei Anzahlung, sonst Gesamtbetrag), Konto der Buchung, Frist, Erzeugen/Mailen über die Buchungsseite, Handbuch und README. - Automatischer Versand: payment_reminder_send_due() im Cron-Lauf, 10 Tage vor Mietbeginn (app.transfer_reminder_days), genau ein Versand pro Termin über payment_reminder_log, kein Doppelversand nach manuellem Mailen. - Startseite: öffentliche Verfügbarkeitsampel für Kühlanhänger ohne Truhen (GET /verfuegbarkeit.json, availability_public_days()), Monatskalender mit Grün (>2 frei), Gelb (1-2) und Rot (ausgebucht); neuer Abschnitt #verfuegbarkeit inkl. Navigation, Footer und noscript-Hinweis. - Aufräumen: payment_reminder_log nach einem Jahr, Cron-Report erweitert.
This commit is contained in:
parent
506d802b33
commit
7445740b90
21 changed files with 911 additions and 46 deletions
|
|
@ -81,6 +81,8 @@ CREATE TABLE IF NOT EXISTS bookings (
|
|||
-- Anzahlung laut Auftragsbestätigung: vereinbart? auf welches Konto?
|
||||
deposit_required TINYINT(1) NOT NULL DEFAULT 0,
|
||||
deposit_account_id BIGINT UNSIGNED NULL DEFAULT NULL,
|
||||
-- Restzahlung: bar bei der Übergabe oder per Überweisung.
|
||||
balance_method ENUM('cash', 'transfer') NOT NULL DEFAULT 'cash',
|
||||
rent_cents INT UNSIGNED NOT NULL DEFAULT 0,
|
||||
delivery_cents INT UNSIGNED NOT NULL DEFAULT 0,
|
||||
total_cents INT UNSIGNED NOT NULL DEFAULT 0,
|
||||
|
|
@ -150,6 +152,20 @@ CREATE TABLE IF NOT EXISTS reminder_mail_log (
|
|||
CONSTRAINT fk_reminder_mail_employee FOREIGN KEY (employee_id) REFERENCES employees (id) ON DELETE SET NULL
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
|
||||
|
||||
-- Versandprotokoll der automatischen Zahlungserinnerung an den Kunden
|
||||
-- (Restzahlung per Überweisung, app.transfer_reminder_days vor Mietbeginn).
|
||||
CREATE TABLE IF NOT EXISTS payment_reminder_log (
|
||||
id BIGINT UNSIGNED NOT NULL AUTO_INCREMENT,
|
||||
booking_id BIGINT UNSIGNED NOT NULL,
|
||||
due_date DATE NOT NULL,
|
||||
sent_to VARCHAR(190) NOT NULL,
|
||||
sent_at DATETIME NOT NULL,
|
||||
PRIMARY KEY (id),
|
||||
UNIQUE KEY uq_payment_reminder (booking_id, due_date),
|
||||
KEY idx_payment_reminder_sent (sent_at),
|
||||
CONSTRAINT fk_payment_reminder_booking FOREIGN KEY (booking_id) REFERENCES bookings (id) ON DELETE CASCADE
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
|
||||
|
||||
CREATE TABLE IF NOT EXISTS auth_tokens (
|
||||
id BIGINT UNSIGNED NOT NULL AUTO_INCREMENT,
|
||||
user_id BIGINT UNSIGNED NOT NULL,
|
||||
|
|
@ -271,7 +287,7 @@ CREATE TABLE IF NOT EXISTS absences (
|
|||
CREATE TABLE IF NOT EXISTS booking_documents (
|
||||
id BIGINT UNSIGNED NOT NULL AUTO_INCREMENT,
|
||||
booking_id BIGINT UNSIGNED NOT NULL,
|
||||
kind ENUM('contract', 'confirmation', 'invoice') NOT NULL,
|
||||
kind ENUM('contract', 'confirmation', 'invoice', 'reminder') NOT NULL,
|
||||
variant VARCHAR(20) NOT NULL DEFAULT '',
|
||||
file_name VARCHAR(190) NOT NULL,
|
||||
stored_file VARCHAR(190) NOT NULL,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue