2022-11-07 16:18:11 +01:00
|
|
|
<?php
|
|
|
|
|
2023-04-18 22:08:45 +02:00
|
|
|
namespace App\Invoice;
|
2022-11-07 16:18:11 +01:00
|
|
|
|
|
|
|
use App\Payment\Payment;
|
|
|
|
use Illuminate\Database\Eloquent\Relations\HasMany;
|
|
|
|
|
2023-12-17 22:33:29 +01:00
|
|
|
class BillDocument extends InvoiceDocument
|
2022-11-07 16:18:11 +01:00
|
|
|
{
|
|
|
|
public function linkLabel(): string
|
|
|
|
{
|
|
|
|
return 'Rechnung erstellen';
|
|
|
|
}
|
|
|
|
|
|
|
|
public function getSubject(): string
|
|
|
|
{
|
|
|
|
return 'Rechnung';
|
|
|
|
}
|
|
|
|
|
|
|
|
public function view(): string
|
|
|
|
{
|
|
|
|
return 'tex.bill';
|
|
|
|
}
|
|
|
|
|
2022-12-07 00:40:53 +01:00
|
|
|
public static function sendAllLabel(): string
|
2022-11-07 16:18:11 +01:00
|
|
|
{
|
|
|
|
return 'Rechnungen versenden';
|
|
|
|
}
|
|
|
|
|
|
|
|
public function afterSingle(Payment $payment): void
|
|
|
|
{
|
2023-11-30 23:54:16 +01:00
|
|
|
$payment->update([
|
|
|
|
'invoice_data' => $this->toArray(),
|
|
|
|
'status_id' => 2,
|
|
|
|
]);
|
2022-11-07 16:18:11 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @param HasMany<Payment> $query
|
|
|
|
*
|
|
|
|
* @return HasMany<Payment>
|
|
|
|
*/
|
|
|
|
public static function paymentsQuery(HasMany $query): HasMany
|
|
|
|
{
|
|
|
|
return $query->whereNeedsBill();
|
|
|
|
}
|
2022-12-07 00:40:53 +01:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Get Descriptions for sendpayment page.
|
|
|
|
*
|
|
|
|
* @return array<int, string>
|
|
|
|
*/
|
|
|
|
public static function getDescription(): array
|
|
|
|
{
|
|
|
|
return [
|
|
|
|
'Diese Funktion erstellt ein PDF mit allen noch nicht versendenden Rechnungen bei den Mitgliedern die Post als Versandweg haben.',
|
|
|
|
'Die Rechnungen werden automatisch auf "Rechnung gestellt" aktualisiert.',
|
|
|
|
];
|
|
|
|
}
|
2022-11-07 16:18:11 +01:00
|
|
|
}
|