Files
fewo-stommer/app/Pricing/PortalPrice.php
T
LarsandClaude Opus 5.5 3a728c3255 Vorgangskern und geführte Vorgangsbearbeitung (Pakete 1 und 2, Prozessarchitektur v0.10)
- Buchung ist der einheitliche Vorgang: Eingangsart, Vorgangsart A1–A6, eingefrorenes
  Abwicklungsprofil, gespeicherter Verlauf (booking_events); Gast, Personen und Beträge
  dürfen unbekannt sein, Platzhalter-Gäste werden migriert und nicht mehr angelegt
- Einstellungen in Ebenen: Vermieterstandard (So arbeite ich), Abweichung der Wohnung
  (Experte), Abweichung je Portal und Eingangsart; ersetzt booking_model als Steuergröße
- Ein Weg für extern verbindliche Buchungen (TakeOverExternalBooking) statt
  RecordPortalBooking und "Akte anlegen"; Portalpreis als belegte Gesamtposition
- Startseite "Zu erledigen", neue Vorgangsseite mit nächstem Schritt, Automatik-Schalter,
  "Beenden" mit Storno statt Statusumschaltung; Status von Hand nur im Expertenmodus
- Migration übernimmt bisheriges Verhalten unverändert (abweichende Wohnungswerte bleiben
  als Abweichung), Bericht: php artisan process:settings-report

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-01 16:25:46 +01:00

48 lines
1.9 KiB
PHP
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
<?php
namespace App\Pricing;
use App\Enums\QuoteLineType;
use App\Models\Property;
use Carbon\CarbonImmutable;
/**
* The price of a booking that was made binding on a portal, as booking columns. The total the guest agreed to on the
* portal is taken over as one line with its source – it is never split into our own price items, and our own price
* list never replaces it (docs/Prozessarchitektur/Querschnitt/Preise_und_Zahlungen.md). An unknown portal price stays
* unknown: no quote, no total, no payment plan.
*/
class PortalPrice
{
public const LABEL = 'Gesamtpreis laut Portal';
/**
* @return array{quote: ?array<string, mixed>, total: ?int, deposit: ?int, balance_due_on: ?string, price_adjustment: null, price_adjustment_label: null}
*/
public function columns(Property $property, CarbonImmutable $arrival, CarbonImmutable $departure, ?int $guests, ?int $portalTotal, ?string $channelName = null): array
{
if ($portalTotal === null) {
return ['quote' => null, 'total' => null, 'deposit' => null, 'balance_due_on' => null, 'price_adjustment' => null, 'price_adjustment_label' => null];
}
$label = self::LABEL.($channelName ? ' ('.$channelName.')' : '');
$quote = new PriceQuote(
$arrival,
$departure,
(int) $guests,
[new QuoteLine(QuoteLineType::Accommodation, $label, 1, $portalTotal, $portalTotal)],
$property->deposit_percent,
$arrival->subDays($property->balance_due_days_before_arrival),
);
return [
'quote' => [...$quote->toArray(), 'source' => 'portal'],
'total' => $quote->total(),
'deposit' => $quote->deposit(),
'balance_due_on' => $quote->balanceDueOn->toDateString(),
'price_adjustment' => null,
'price_adjustment_label' => null,
];
}
}