Pakete 8, 5 und 6: Beträge und Zahlungen, Ändern und Stornieren, A6 im Vorgang
Deploy FeWo mit PipelineManager / deploy (push) Successful in 4m44s
Deploy FeWo mit PipelineManager / deploy (push) Successful in 4m44s
- 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>
This commit is contained in:
1 parent
33f8f899d6
commit
3bcfc09417
77 files changed
+3638
-122
No files matched your search
+80
-3
@@ -7,6 +7,8 @@
|
||||
use App\Enums\BookingTaskKind;
|
||||
use App\Enums\CaseType;
|
||||
use App\Enums\IntakeKind;
|
||||
use App\Enums\InternalKind;
|
||||
use App\Enums\PaymentKind;
|
||||
use App\Enums\ProcessingMode;
|
||||
use App\Enums\ReferralSource;
|
||||
use App\Enums\Responsibility;
|
||||
@@ -91,13 +93,19 @@
|
||||
'balance_requested_at',
|
||||
'balance_reminded_at',
|
||||
'arrival_info_sent_at',
|
||||
'internal_kind',
|
||||
'occasion',
|
||||
'tourist_tax_persons',
|
||||
'tourist_tax_note',
|
||||
'portal_cancellation_requested_at',
|
||||
'export_uid',
|
||||
])]
|
||||
class Booking extends Model
|
||||
{
|
||||
/** @use HasFactory<BookingFactory> */
|
||||
use BelongsToTenant, HasChannelProvenance, HasFactory;
|
||||
|
||||
public const DIRECT_SOURCES = ['website', 'manual', 'phone', 'direct', 'email'];
|
||||
public const DIRECT_SOURCES = ['website', 'manual', 'phone', 'direct', 'email', 'internal'];
|
||||
|
||||
public function isDirect(): bool
|
||||
{
|
||||
@@ -177,6 +185,8 @@ protected function casts(): array
|
||||
'contact_requested_at' => 'immutable_datetime',
|
||||
'guest_confirmed_at' => 'immutable_datetime',
|
||||
'archived_at' => 'immutable_datetime',
|
||||
'internal_kind' => InternalKind::class,
|
||||
'portal_cancellation_requested_at' => 'immutable_datetime',
|
||||
];
|
||||
}
|
||||
|
||||
@@ -267,6 +277,7 @@ public function bookingChannelLabel(): string
|
||||
'phone' => 'Telefon',
|
||||
'email' => 'E-Mail',
|
||||
'direct' => 'Direkt',
|
||||
'internal' => 'Eigene Belegung',
|
||||
default => $this->source,
|
||||
};
|
||||
}
|
||||
@@ -336,7 +347,73 @@ public function payments(): HasMany
|
||||
*/
|
||||
public function paidAmount(): int
|
||||
{
|
||||
return (int) ($this->relationLoaded('payments') ? $this->payments->sum('amount') : $this->payments()->sum('amount'));
|
||||
return $this->sumOfPayments([PaymentKind::Guest, PaymentKind::GuestViaPortal, PaymentKind::Refund]);
|
||||
}
|
||||
|
||||
/**
|
||||
* What the guest paid us directly, less refunds (money on our account from the guest).
|
||||
*/
|
||||
public function paidToUs(): int
|
||||
{
|
||||
return $this->sumOfPayments([PaymentKind::Guest, PaymentKind::Refund]);
|
||||
}
|
||||
|
||||
/**
|
||||
* What the guest paid to the portal according to the portal (no money on our account).
|
||||
*/
|
||||
public function paidViaPortal(): int
|
||||
{
|
||||
return $this->sumOfPayments([PaymentKind::GuestViaPortal]);
|
||||
}
|
||||
|
||||
/**
|
||||
* What the portal paid out to us.
|
||||
*/
|
||||
public function payoutsReceived(): int
|
||||
{
|
||||
return $this->sumOfPayments([PaymentKind::PortalPayout]);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param list<PaymentKind> $kinds
|
||||
*/
|
||||
private function sumOfPayments(array $kinds): int
|
||||
{
|
||||
$payments = $this->relationLoaded('payments') ? $this->payments : $this->payments()->get();
|
||||
|
||||
return (int) $payments->filter(fn (Payment $payment): bool => in_array($payment->kind ?? PaymentKind::Guest, $kinds, true))->sum('amount');
|
||||
}
|
||||
|
||||
/**
|
||||
* @return HasOne<Cancellation, $this>
|
||||
*/
|
||||
public function cancellation(): HasOne
|
||||
{
|
||||
return $this->hasOne(Cancellation::class);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return HasMany<CaseAmount, $this>
|
||||
*/
|
||||
public function amounts(): HasMany
|
||||
{
|
||||
return $this->hasMany(CaseAmount::class)->orderBy('id');
|
||||
}
|
||||
|
||||
/**
|
||||
* @return HasMany<BookingChange, $this>
|
||||
*/
|
||||
public function changes(): HasMany
|
||||
{
|
||||
return $this->hasMany(BookingChange::class)->orderBy('id');
|
||||
}
|
||||
|
||||
/**
|
||||
* Own use, private stay or block (A6).
|
||||
*/
|
||||
public function isInternal(): bool
|
||||
{
|
||||
return $this->intake === IntakeKind::Internal;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -366,7 +443,7 @@ public function requiresFullPayment(): bool
|
||||
*/
|
||||
public function wantsPaymentTasks(): bool
|
||||
{
|
||||
return $this->process()->payments() === Responsibility::Landlord && $this->total !== null && $this->total > 0;
|
||||
return ! $this->isInternal() && $this->process()->payments() === Responsibility::Landlord && $this->total !== null && $this->total > 0;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in new issue
Block a user