Files
fewo-stommer/app/Models/CaseAmount.php
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

51 lines
1.6 KiB
PHP
Raw Permalink 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\Models;
use App\Enums\AmountKind;
use App\Models\Concerns\BelongsToTenant;
use App\Process\CaseLog;
use App\Support\Money;
use Illuminate\Database\Eloquent\Attributes\Fillable;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\BelongsTo;
/**
* An amount of a case as a source states it (package 8): the portal's price positions, what it keeps as commission,
* what it announces to pay out, instalments of the guest. Stored as stated – contradicting statements stand side by
* side, and nothing is derived from them.
*/
#[Fillable(['booking_id', 'kind', 'label', 'amount', 'source', 'stated_on', 'due_on', 'note', 'recorded_by'])]
class CaseAmount extends Model
{
use BelongsToTenant;
protected static function booted(): void
{
static::created(function (CaseAmount $amount): void {
if ($amount->booking !== null) {
CaseLog::record($amount->booking, 'amount', ($amount->label ?: $amount->kind->getLabel()).': '.Money::format($amount->amount).($amount->source ? ' laut '.$amount->source : ''), data: ['case_amount_id' => $amount->id]);
}
});
}
/**
* @return array<string, string>
*/
protected function casts(): array
{
return ['kind' => AmountKind::class, 'amount' => 'integer', 'stated_on' => 'immutable_date', 'due_on' => 'immutable_date'];
}
/** @return BelongsTo<Booking, $this> */
public function booking(): BelongsTo
{
return $this->belongsTo(Booking::class);
}
public function title(): string
{
return $this->label ?: $this->kind->getLabel();
}
}