feat(booking): Anzahlung mit Konto und Frist in der Auftragsbestätigung

- Migration 015_booking_deposit.sql: bookings.deposit_required +
  bookings.deposit_account (bestehende Buchungen mit Betrag > 0 werden auf JA
  gesetzt), schema.sql nachgezogen
- Buchungsformular: „Anzahlung fällig: JA/NEIN“ und Kontoauswahl neben dem
  Betrag (nur Verwaltung; Nicht-Admins behalten die gespeicherten Werte),
  Pflichtbetrag bei JA, Hinweis in der Zusammenfassung
- app/documents.php: deposit_accounts() (Standard Postbank/Michael Schmitz,
  überschreibbar per app.deposit_accounts) und deposit_due_date() (7 Werktage
  Mo–Sa ohne NRW-Feiertage, app.deposit_due_working_days)
- Auftragsbestätigung: Block „Anzahlung und verbindliche Reservierung“ mit
  Betrag, Datum, Kontoinhaber, Bank, IBAN, Verwendungszweck und Hinweis, dass
  der Termin erst nach Zahlungseingang reserviert ist; kompaktere Beträge/
  Signatur, damit alles auf eine Seite passt
- Buchungsdetail, Kopiertext, AGB (Zahlungsabschnitt), Anleitung, README,
  config.example.php und ROADMAP (Feature 24) ergänzt
This commit is contained in:
torsten 2026-11-30 17:06:01 +01:00
parent 8f0d3d9191
commit bf85a64a79
12 changed files with 243 additions and 17 deletions

View file

@ -806,6 +806,8 @@ function booking_form_context(array $user, ?array $booking = null, array $values
'user' => $user,
'isEdit' => $booking !== null,
'canEditBilling' => auth_can_manage($user),
'depositAccounts' => deposit_accounts(),
'depositDueDays' => deposit_due_working_days(),
];
}
@ -820,6 +822,8 @@ function form_values_from_input(array $data): array
'start_time' => (string) ($data['start_time'] ?? ''),
'end_time' => (string) ($data['end_time'] ?? ''),
'deposit' => number_format($data['deposit_cents'] / 100, 2, ',', ''),
'deposit_required' => (int) ($data['deposit_required'] ?? 0),
'deposit_account' => (string) ($data['deposit_account'] ?? ''),
'rent' => number_format($data['rent_cents'] / 100, 2, ',', ''),
'delivery' => number_format($data['delivery_cents'] / 100, 2, ',', ''),
'invoice' => (int) $data['invoice'],
@ -872,6 +876,8 @@ function page_booking_new(array $user, string $method): void
'start_time' => '',
'end_time' => '',
'deposit' => '',
'deposit_required' => 0,
'deposit_account' => '',
'rent' => '',
'delivery' => '',
'invoice' => 0,
@ -926,6 +932,8 @@ function page_booking_edit(array $user, int $id, string $method): void
'start_time' => (string) ($booking['start_time'] ?? ''),
'end_time' => (string) ($booking['end_time'] ?? ''),
'deposit' => number_format((int) $booking['deposit_cents'] / 100, 2, ',', ''),
'deposit_required' => (int) ($booking['deposit_required'] ?? 0),
'deposit_account' => (string) ($booking['deposit_account'] ?? ''),
'rent' => number_format((int) $booking['rent_cents'] / 100, 2, ',', ''),
'delivery' => number_format((int) $booking['delivery_cents'] / 100, 2, ',', ''),
'invoice' => (int) $booking['invoice'],
@ -950,6 +958,8 @@ function page_booking_edit(array $user, int $id, string $method): void
$data = booking_input($_POST);
if (!$canEditBilling) {
$data['deposit_cents'] = (int) $booking['deposit_cents'];
$data['deposit_required'] = (int) ($booking['deposit_required'] ?? 0);
$data['deposit_account'] = (string) ($booking['deposit_account'] ?? '');
$data['rent_cents'] = (int) $booking['rent_cents'];
$data['delivery_cents'] = (int) $booking['delivery_cents'];
$data['total_cents'] = (int) $booking['total_cents'];