Add Deadline to pdf

This commit is contained in:
philipp lang 2021-07-17 17:13:16 +02:00
parent 2bf0292ca3
commit 81c4d12213
4 changed files with 35 additions and 3 deletions

View File

@ -3,6 +3,7 @@
namespace App\Pdf;
use App\Member\Member;
use Carbon\Carbon;
use Illuminate\Support\Collection;
interface PdfRepository
@ -32,4 +33,6 @@ interface PdfRepository
public function linkLabel(): string;
public function getUntil(): Carbon;
}

View File

@ -2,6 +2,8 @@
namespace App\Pdf;
use Carbon\Carbon;
abstract class Repository
{
@ -10,4 +12,9 @@ abstract class Repository
return number_format($number / 100, 2, '.', '');
}
public function getUntil(): Carbon
{
return now()->addWeeks(2);
}
}

View File

@ -21,7 +21,7 @@
\end{tabular}
\end{center}
Somit bitten wir Sie, den ausstehenden Betrag von \totalttc bis zum 18.07.2021 auf folgendes Konto zu überweisen:
Somit bitten wir Sie, den ausstehenden Betrag von \totalttc bis zum \textbf{<<< $data->getUntil()->format('d.m.Y') >>>} auf folgendes Konto zu überweisen:
\begin{tabular}{ll}
Kontoinhaber: & DPSG Stamm Silva \\

View File

@ -7,18 +7,17 @@ use App\Fee;
use App\Group;
use App\Member\Member;
use App\Nationality;
use App\Payment\Payment;
use App\Payment\Subscription;
use App\Pdf\BillType;
use App\Pdf\PdfGenerator;
use App\Pdf\PdfRepositoryFactory;
use Carbon\Carbon;
use Database\Factories\Member\MemberFactory;
use Database\Factories\Payment\PaymentFactory;
use Illuminate\Foundation\Testing\RefreshDatabase;
use Illuminate\Support\Collection;
use Storage;
use Tests\TestCase;
use Tests\Traits\FakesTex;
class GenerateTest extends TestCase
{
@ -29,6 +28,8 @@ class GenerateTest extends TestCase
{
parent::setUp();
Carbon::setTestNow(Carbon::parse('2021-04-15 00:00:00'));
Storage::fake('temp');
}
@ -75,6 +76,27 @@ class GenerateTest extends TestCase
'Familie ::lastname::\\\\::street::\\\\::zip:: ::location::',
],
],
'bill_has_deadline' => [
'members' => [
[
'factory' => fn (MemberFactory $member): MemberFactory => $member
->state([
'firstname' => '::firstname::',
'lastname' => '::lastname::',
]),
'payments' => [
fn (PaymentFactory $payment): PaymentFactory => $payment
->nr('A')->notPaid()->subscription('::subName::', 1500),
],
],
],
'urlCallable' => fn (Collection $members): int => $members->first()->id,
'type' => BillType::class,
'filename' => 'rechnung-fur-firstname-lastname.pdf',
'output' => [
'29.04.2021',
],
],
];
}