Files
LarsandClaude Opus 5.5 3bcfc09417
Deploy FeWo mit PipelineManager / deploy (push) Successful in 4m44s
Pakete 8, 5 und 6: Beträge und Zahlungen, Ändern und Stornieren, A6 im Vorgang
- Paket 8: Zahlungsarten (Gast an uns, laut Portal, Auszahlung, Erstattung),
  Portalbeträge als Angaben mit Quelle, Übersicht nach Zuständigkeit (R09).
- Paket 5: Ändern mit Folgenvorschau, vereinbart oder dem Gast vorgeschlagen
  (signierter Link), ein Stornoweg mit Grund und Erstattung, Portalstorno erst
  nach Bestätigung.
- Paket 6: eigene Nutzung, Besuch und Sperre als Vorgang mit Kurabgabe und
  Aufenthaltsbestätigung; Bestandsübernahme der Sperren mit identischem Export.
- Wirksame Einstellungen (Expertenansicht), Abnahmekatalog T01–T14, Ergebnis-,
  Abnahme- und Konfigurationsdokument.

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

59 lines
1.7 KiB
PHP

<?php
namespace App\Models;
use App\Models\Concerns\BelongsToTenant;
use Illuminate\Database\Eloquent\Attributes\Fillable;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\BelongsTo;
/**
* The record of a cancelled booking: when, how many days before arrival, the cost proposed by the cancellation rule
* and the amount the landlord finally charges. Cancelled bookings stay in the system for this history.
*/
#[Fillable(['booking_id', 'cancelled_on', 'initiated_by', 'has_policy', 'policy_name', 'days_before', 'percent', 'base_amount', 'calculated_fee', 'final_fee', 'paid_amount', 'status', 'note', 'settled_at', 'reason', 'recorded_by'])]
class Cancellation extends Model
{
use BelongsToTenant;
public const OPEN = 'open';
public const SETTLED = 'settled';
public const WAIVED = 'waived';
/**
* Get the attributes that should be cast.
*
* @return array<string, string>
*/
protected function casts(): array
{
return ['cancelled_on' => 'immutable_date', 'has_policy' => 'boolean', 'settled_at' => 'immutable_datetime'];
}
/**
* @return BelongsTo<Booking, $this>
*/
public function booking(): BelongsTo
{
return $this->belongsTo(Booking::class);
}
/**
* What the guest owes: the final fee, else the proposal; nothing when waived.
*/
public function fee(): int
{
return $this->status === self::WAIVED ? 0 : (int) ($this->final_fee ?? $this->calculated_fee ?? 0);
}
/**
* Positive: the guest still has to pay; negative: the landlord has to refund.
*/
public function balance(): int
{
return $this->fee() - $this->paid_amount;
}
}