Basic support for creating invoices

This commit is contained in:
2026-07-02 23:39:47 +02:00
parent 872972ea48
commit 56b603aba0
15 changed files with 2147 additions and 29 deletions
BIN
View File
Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 MiB

@@ -0,0 +1,94 @@
<?php
namespace App\Domains\Rechnung\Actions\GeneratePdf;
use Barryvdh\DomPDF\Facade\Pdf;
class GeneratePdfCommand
{
public function __construct(private readonly GeneratePdfRequest $request) {}
public function execute(): GeneratePdfResponse
{
$rechnungsnummer = $this->request->rechnungsnummer !== ''
? $this->request->rechnungsnummer
: date('Y') . '-' . str_pad(random_int(1, 999), 3, '0', STR_PAD_LEFT);
$positionen = array_values(array_filter(
$this->request->positionen,
fn($p) => !empty($p['bezeichnung'])
));
$netto = array_sum(array_map(
fn($p) => (float) ($p['menge'] ?? 0) * (float) ($p['einzelpreis'] ?? 0),
$positionen
));
$mwst = $netto * $this->request->mwstSatz / 100;
$brutto = $netto + $mwst;
$pdf = Pdf::loadView('pdf.rechnung', [
'rechnungsnummer' => $rechnungsnummer,
'organisation' => $this->request->organisation,
'anrede' => $this->request->anrede,
'vorname' => $this->request->vorname,
'nachname' => $this->request->nachname,
'adresse' => $this->request->adresse,
'plz' => $this->request->plz,
'ort' => $this->request->ort,
'email' => $this->request->email,
'iban' => $this->request->iban,
'bic' => $this->request->bic,
'rechnungsdatum' => $this->request->rechnungsdatum,
'zahlungsziel' => $this->request->zahlungsziel,
'rechnungsdatumFormatiert' => $this->formatDate($this->request->rechnungsdatum),
'zahlungszielFormatiert' => $this->formatDate($this->request->zahlungsziel),
'positionen' => $positionen,
'mwstSatz' => $this->request->mwstSatz,
'netto' => $netto,
'mwst' => $mwst,
'brutto' => $brutto,
'absenderEmail' => $this->request->absenderEmail,
'absenderTelefon' => $this->request->absenderTelefon,
'kohteDataUri' => $this->imageToDataUri(storage_path('app/elemente/kohte.png')),
'logoDataUri' => $this->imageToDataUri(public_path('wbm.png')),
]);
$pdf->setPaper('A4', 'portrait');
$pdf->render();
$pdfContent = $pdf->output();
return new GeneratePdfResponse(
pdfContent: $pdfContent,
filename: 'rechnung-' . $rechnungsnummer . '.pdf',
);
}
private function formatDate(string $date): string
{
if (!$date) {
return '—';
}
$ts = strtotime($date);
return $ts ? date('d.m.Y', $ts) : $date;
}
private function imageToDataUri(string $path): string
{
if (!file_exists($path)) {
return '';
}
$mime = match (strtolower(pathinfo($path, PATHINFO_EXTENSION))) {
'jpg', 'jpeg' => 'image/jpeg',
'svg' => 'image/svg+xml',
default => 'image/png',
};
return 'data:' . $mime . ';base64,' . base64_encode(file_get_contents($path));
}
}
@@ -0,0 +1,49 @@
<?php
namespace App\Domains\Rechnung\Actions\GeneratePdf;
class GeneratePdfRequest
{
public function __construct(
public readonly string $organisation,
public readonly string $anrede,
public readonly string $vorname,
public readonly string $nachname,
public readonly string $adresse,
public readonly string $plz,
public readonly string $ort,
public readonly string $email,
public readonly string $rechnungsnummer,
public readonly string $rechnungsdatum,
public readonly string $zahlungsziel,
public readonly string $bic,
public readonly string $iban,
public readonly array $positionen,
public readonly int $mwstSatz,
public readonly string $absenderEmail,
public readonly string $absenderTelefon,
) {}
public static function fromArray(array $data): self
{
return new self(
organisation: $data['organisation'] ?? '',
anrede: $data['anrede'] ?? '',
vorname: $data['vorname'] ?? '',
nachname: $data['nachname'] ?? '',
adresse: $data['adresse'] ?? '',
plz: $data['plz'] ?? '',
ort: $data['ort'] ?? '',
email: $data['email'] ?? '',
rechnungsnummer: $data['rechnungsnummer'] ?? '',
rechnungsdatum: $data['rechnungsdatum'] ?? '',
zahlungsziel: $data['zahlungsziel'] ?? '',
bic: $data['bic'] ?? '',
iban: $data['iban'] ?? '',
positionen: $data['positionen'] ?? [],
mwstSatz: (int) ($data['mwstSatz'] ?? 19),
absenderEmail: $data['absenderEmail'] ?? 'finanzen@sachsen.pfadfinden.de',
absenderTelefon: $data['absenderTelefon'] ?? '',
);
}
}
@@ -0,0 +1,11 @@
<?php
namespace App\Domains\Rechnung\Actions\GeneratePdf;
class GeneratePdfResponse
{
public function __construct(
public readonly string $pdfContent,
public readonly string $filename,
) {}
}
@@ -0,0 +1,23 @@
<?php
namespace App\Domains\Rechnung\Controllers;
use App\Domains\Rechnung\Actions\GeneratePdf\GeneratePdfCommand;
use App\Domains\Rechnung\Actions\GeneratePdf\GeneratePdfRequest;
use Illuminate\Http\Request;
use Illuminate\Http\Response;
class GeneratePdfController
{
public function __invoke(Request $request): Response
{
$pdfRequest = GeneratePdfRequest::fromArray($request->all());
$command = new GeneratePdfCommand($pdfRequest);
$result = $command->execute();
return response($result->pdfContent, 200, [
'Content-Type' => 'application/pdf',
'Content-Disposition' => 'inline; filename="' . $result->filename . '"',
]);
}
}
+2
View File
@@ -1,6 +1,8 @@
<?php
use App\Domains\Rechnung\Controllers\GeneratePdfController;
use App\Domains\Rechnung\Controllers\RechnungController;
use Illuminate\Support\Facades\Route;
Route::get('/rechnung', RechnungController::class)->name('rechnung');
Route::post('/rechnung/pdf', GeneratePdfController::class)->name('rechnung.pdf');
File diff suppressed because it is too large Load Diff
+1
View File
@@ -7,6 +7,7 @@
"license": "MIT",
"require": {
"php": "^8.5",
"barryvdh/laravel-dompdf": "^3.1",
"inertiajs/inertia-laravel": "^2.0",
"laravel/framework": "^13.0"
},
Generated
+523 -1
View File
@@ -4,8 +4,85 @@
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
"This file is @generated automatically"
],
"content-hash": "844b0bde1d19fc4ee7aed07fa973aaff",
"content-hash": "e9179c934253bee1b1afef146ded5a2b",
"packages": [
{
"name": "barryvdh/laravel-dompdf",
"version": "v3.1.2",
"source": {
"type": "git",
"url": "https://github.com/barryvdh/laravel-dompdf.git",
"reference": "ee3b72b19ccdf57d0243116ecb2b90261344dedc"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/barryvdh/laravel-dompdf/zipball/ee3b72b19ccdf57d0243116ecb2b90261344dedc",
"reference": "ee3b72b19ccdf57d0243116ecb2b90261344dedc",
"shasum": ""
},
"require": {
"dompdf/dompdf": "^3.0",
"illuminate/support": "^9|^10|^11|^12|^13.0",
"php": "^8.1"
},
"require-dev": {
"larastan/larastan": "^2.7|^3.0",
"orchestra/testbench": "^7|^8|^9.16|^10|^11.0",
"phpro/grumphp": "^2.5",
"squizlabs/php_codesniffer": "^3.5"
},
"type": "library",
"extra": {
"laravel": {
"aliases": {
"PDF": "Barryvdh\\DomPDF\\Facade\\Pdf",
"Pdf": "Barryvdh\\DomPDF\\Facade\\Pdf"
},
"providers": [
"Barryvdh\\DomPDF\\ServiceProvider"
]
},
"branch-alias": {
"dev-master": "3.0-dev"
}
},
"autoload": {
"psr-4": {
"Barryvdh\\DomPDF\\": "src"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Barry vd. Heuvel",
"email": "barryvdh@gmail.com"
}
],
"description": "A DOMPDF Wrapper for Laravel",
"keywords": [
"dompdf",
"laravel",
"pdf"
],
"support": {
"issues": "https://github.com/barryvdh/laravel-dompdf/issues",
"source": "https://github.com/barryvdh/laravel-dompdf/tree/v3.1.2"
},
"funding": [
{
"url": "https://fruitcake.nl",
"type": "custom"
},
{
"url": "https://github.com/barryvdh",
"type": "github"
}
],
"time": "2026-02-21T08:51:10+00:00"
},
{
"name": "brick/math",
"version": "0.18.0",
@@ -376,6 +453,161 @@
],
"time": "2024-02-05T11:56:58+00:00"
},
{
"name": "dompdf/dompdf",
"version": "v3.1.5",
"source": {
"type": "git",
"url": "https://github.com/dompdf/dompdf.git",
"reference": "f11ead23a8a76d0ff9bbc6c7c8fd7e05ca328496"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/dompdf/dompdf/zipball/f11ead23a8a76d0ff9bbc6c7c8fd7e05ca328496",
"reference": "f11ead23a8a76d0ff9bbc6c7c8fd7e05ca328496",
"shasum": ""
},
"require": {
"dompdf/php-font-lib": "^1.0.0",
"dompdf/php-svg-lib": "^1.0.0",
"ext-dom": "*",
"ext-mbstring": "*",
"masterminds/html5": "^2.0",
"php": "^7.1 || ^8.0"
},
"require-dev": {
"ext-gd": "*",
"ext-json": "*",
"ext-zip": "*",
"mockery/mockery": "^1.3",
"phpunit/phpunit": "^7.5 || ^8 || ^9 || ^10 || ^11",
"squizlabs/php_codesniffer": "^3.5",
"symfony/process": "^4.4 || ^5.4 || ^6.2 || ^7.0"
},
"suggest": {
"ext-gd": "Needed to process images",
"ext-gmagick": "Improves image processing performance",
"ext-imagick": "Improves image processing performance",
"ext-zlib": "Needed for pdf stream compression"
},
"type": "library",
"autoload": {
"psr-4": {
"Dompdf\\": "src/"
},
"classmap": [
"lib/"
]
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"LGPL-2.1"
],
"authors": [
{
"name": "The Dompdf Community",
"homepage": "https://github.com/dompdf/dompdf/blob/master/AUTHORS.md"
}
],
"description": "DOMPDF is a CSS 2.1 compliant HTML to PDF converter",
"homepage": "https://github.com/dompdf/dompdf",
"support": {
"issues": "https://github.com/dompdf/dompdf/issues",
"source": "https://github.com/dompdf/dompdf/tree/v3.1.5"
},
"time": "2026-03-03T13:54:37+00:00"
},
{
"name": "dompdf/php-font-lib",
"version": "1.0.2",
"source": {
"type": "git",
"url": "https://github.com/dompdf/php-font-lib.git",
"reference": "a6e9a688a2a80016ac080b97be73d3e10c444c9a"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/dompdf/php-font-lib/zipball/a6e9a688a2a80016ac080b97be73d3e10c444c9a",
"reference": "a6e9a688a2a80016ac080b97be73d3e10c444c9a",
"shasum": ""
},
"require": {
"ext-mbstring": "*",
"php": "^7.1 || ^8.0"
},
"require-dev": {
"phpunit/phpunit": "^7.5 || ^8 || ^9 || ^10 || ^11 || ^12"
},
"type": "library",
"autoload": {
"psr-4": {
"FontLib\\": "src/FontLib"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"LGPL-2.1-or-later"
],
"authors": [
{
"name": "The FontLib Community",
"homepage": "https://github.com/dompdf/php-font-lib/blob/master/AUTHORS.md"
}
],
"description": "A library to read, parse, export and make subsets of different types of font files.",
"homepage": "https://github.com/dompdf/php-font-lib",
"support": {
"issues": "https://github.com/dompdf/php-font-lib/issues",
"source": "https://github.com/dompdf/php-font-lib/tree/1.0.2"
},
"time": "2026-01-20T14:10:26+00:00"
},
{
"name": "dompdf/php-svg-lib",
"version": "1.0.2",
"source": {
"type": "git",
"url": "https://github.com/dompdf/php-svg-lib.git",
"reference": "8259ffb930817e72b1ff1caef5d226501f3dfeb1"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/dompdf/php-svg-lib/zipball/8259ffb930817e72b1ff1caef5d226501f3dfeb1",
"reference": "8259ffb930817e72b1ff1caef5d226501f3dfeb1",
"shasum": ""
},
"require": {
"ext-mbstring": "*",
"php": "^7.1 || ^8.0",
"sabberworm/php-css-parser": "^8.4 || ^9.0"
},
"require-dev": {
"phpunit/phpunit": "^7.5 || ^8 || ^9 || ^10 || ^11"
},
"type": "library",
"autoload": {
"psr-4": {
"Svg\\": "src/Svg"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"LGPL-3.0-or-later"
],
"authors": [
{
"name": "The SvgLib Community",
"homepage": "https://github.com/dompdf/php-svg-lib/blob/master/AUTHORS.md"
}
],
"description": "A library to read, parse and export to PDF SVG files.",
"homepage": "https://github.com/dompdf/php-svg-lib",
"support": {
"issues": "https://github.com/dompdf/php-svg-lib/issues",
"source": "https://github.com/dompdf/php-svg-lib/tree/1.0.2"
},
"time": "2026-01-02T16:01:13+00:00"
},
{
"name": "dragonmantank/cron-expression",
"version": "v3.6.0",
@@ -2033,6 +2265,73 @@
],
"time": "2026-03-08T20:05:35+00:00"
},
{
"name": "masterminds/html5",
"version": "2.10.1",
"source": {
"type": "git",
"url": "https://github.com/Masterminds/html5-php.git",
"reference": "fd5018f6815fff903946d0564977b44ce8010e29"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/Masterminds/html5-php/zipball/fd5018f6815fff903946d0564977b44ce8010e29",
"reference": "fd5018f6815fff903946d0564977b44ce8010e29",
"shasum": ""
},
"require": {
"ext-dom": "*",
"php": ">=5.3.0"
},
"require-dev": {
"phpunit/phpunit": "^4.8.35 || ^5.7.21 || ^6 || ^7 || ^8 || ^9 || ^10"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "2.7-dev"
}
},
"autoload": {
"psr-4": {
"Masterminds\\": "src"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Matt Butcher",
"email": "technosophos@gmail.com"
},
{
"name": "Matt Farina",
"email": "matt@mattfarina.com"
},
{
"name": "Asmir Mustafic",
"email": "goetas@gmail.com"
}
],
"description": "An HTML5 parser and serializer.",
"homepage": "http://masterminds.github.io/html5-php",
"keywords": [
"HTML5",
"dom",
"html",
"parser",
"querypath",
"serializer",
"xml"
],
"support": {
"issues": "https://github.com/Masterminds/html5-php/issues",
"source": "https://github.com/Masterminds/html5-php/tree/2.10.1"
},
"time": "2026-06-23T18:43:15+00:00"
},
{
"name": "monolog/monolog",
"version": "3.10.0",
@@ -3171,6 +3470,86 @@
},
"time": "2026-06-18T03:57:49+00:00"
},
{
"name": "sabberworm/php-css-parser",
"version": "v9.4.0",
"source": {
"type": "git",
"url": "https://github.com/MyIntervals/PHP-CSS-Parser.git",
"reference": "fd3bf9fb173e0df649bc4e3e0d088a1b2417c08f"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/MyIntervals/PHP-CSS-Parser/zipball/fd3bf9fb173e0df649bc4e3e0d088a1b2417c08f",
"reference": "fd3bf9fb173e0df649bc4e3e0d088a1b2417c08f",
"shasum": ""
},
"require": {
"ext-iconv": "*",
"php": "^7.2.0 || ~8.0.0 || ~8.1.0 || ~8.2.0 || ~8.3.0 || ~8.4.0 || ~8.5.0",
"thecodingmachine/safe": "^1.3 || ^2.5 || ^3.4"
},
"require-dev": {
"php-parallel-lint/php-parallel-lint": "1.4.0",
"phpstan/extension-installer": "1.4.3",
"phpstan/phpstan": "1.12.33 || 2.2.2",
"phpstan/phpstan-phpunit": "1.4.2 || 2.0.16",
"phpstan/phpstan-strict-rules": "1.6.2 || 2.0.11",
"phpunit/phpunit": "8.5.52",
"rawr/phpunit-data-provider": "3.3.1",
"rector/rector": "1.2.10 || 2.4.6",
"rector/type-perfect": "1.0.0 || 2.1.3",
"squizlabs/php_codesniffer": "4.0.1",
"thecodingmachine/phpstan-safe-rule": "1.2.0 || 1.4.3"
},
"suggest": {
"ext-mbstring": "for parsing UTF-8 CSS"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-main": "9.5.x-dev"
}
},
"autoload": {
"files": [
"src/Rule/Rule.php",
"src/RuleSet/RuleContainer.php"
],
"psr-4": {
"Sabberworm\\CSS\\": "src/"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Raphael Schweikert"
},
{
"name": "Oliver Klee",
"email": "github@oliverklee.de"
},
{
"name": "Jake Hotson",
"email": "jake.github@qzdesign.co.uk"
}
],
"description": "Parser for CSS Files written in PHP",
"homepage": "https://www.sabberworm.com/blog/2010/6/10/php-css-parser",
"keywords": [
"css",
"parser",
"stylesheet"
],
"support": {
"issues": "https://github.com/MyIntervals/PHP-CSS-Parser/issues",
"source": "https://github.com/MyIntervals/PHP-CSS-Parser/tree/v9.4.0"
},
"time": "2026-06-18T15:10:53+00:00"
},
{
"name": "symfony/clock",
"version": "v8.1.0",
@@ -5650,6 +6029,149 @@
],
"time": "2026-06-09T10:54:51+00:00"
},
{
"name": "thecodingmachine/safe",
"version": "v3.4.0",
"source": {
"type": "git",
"url": "https://github.com/thecodingmachine/safe.git",
"reference": "705683a25bacf0d4860c7dea4d7947bfd09eea19"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/thecodingmachine/safe/zipball/705683a25bacf0d4860c7dea4d7947bfd09eea19",
"reference": "705683a25bacf0d4860c7dea4d7947bfd09eea19",
"shasum": ""
},
"require": {
"php": "^8.1"
},
"require-dev": {
"php-parallel-lint/php-parallel-lint": "^1.4",
"phpstan/phpstan": "^2",
"phpunit/phpunit": "^10",
"squizlabs/php_codesniffer": "^3.2"
},
"type": "library",
"autoload": {
"files": [
"lib/special_cases.php",
"generated/apache.php",
"generated/apcu.php",
"generated/array.php",
"generated/bzip2.php",
"generated/calendar.php",
"generated/classobj.php",
"generated/com.php",
"generated/cubrid.php",
"generated/curl.php",
"generated/datetime.php",
"generated/dir.php",
"generated/eio.php",
"generated/errorfunc.php",
"generated/exec.php",
"generated/fileinfo.php",
"generated/filesystem.php",
"generated/filter.php",
"generated/fpm.php",
"generated/ftp.php",
"generated/funchand.php",
"generated/gettext.php",
"generated/gmp.php",
"generated/gnupg.php",
"generated/hash.php",
"generated/ibase.php",
"generated/ibmDb2.php",
"generated/iconv.php",
"generated/image.php",
"generated/imap.php",
"generated/info.php",
"generated/inotify.php",
"generated/json.php",
"generated/ldap.php",
"generated/libxml.php",
"generated/lzf.php",
"generated/mailparse.php",
"generated/mbstring.php",
"generated/misc.php",
"generated/mysql.php",
"generated/mysqli.php",
"generated/network.php",
"generated/oci8.php",
"generated/opcache.php",
"generated/openssl.php",
"generated/outcontrol.php",
"generated/pcntl.php",
"generated/pcre.php",
"generated/pgsql.php",
"generated/posix.php",
"generated/ps.php",
"generated/pspell.php",
"generated/readline.php",
"generated/rnp.php",
"generated/rpminfo.php",
"generated/rrd.php",
"generated/sem.php",
"generated/session.php",
"generated/shmop.php",
"generated/sockets.php",
"generated/sodium.php",
"generated/solr.php",
"generated/spl.php",
"generated/sqlsrv.php",
"generated/ssdeep.php",
"generated/ssh2.php",
"generated/stream.php",
"generated/strings.php",
"generated/swoole.php",
"generated/uodbc.php",
"generated/uopz.php",
"generated/url.php",
"generated/var.php",
"generated/xdiff.php",
"generated/xml.php",
"generated/xmlrpc.php",
"generated/yaml.php",
"generated/yaz.php",
"generated/zip.php",
"generated/zlib.php"
],
"classmap": [
"lib/DateTime.php",
"lib/DateTimeImmutable.php",
"lib/Exceptions/",
"generated/Exceptions/"
]
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"description": "PHP core functions that throw exceptions instead of returning FALSE on error",
"support": {
"issues": "https://github.com/thecodingmachine/safe/issues",
"source": "https://github.com/thecodingmachine/safe/tree/v3.4.0"
},
"funding": [
{
"url": "https://github.com/OskarStark",
"type": "github"
},
{
"url": "https://github.com/shish",
"type": "github"
},
{
"url": "https://github.com/silasjoisten",
"type": "github"
},
{
"url": "https://github.com/staabm",
"type": "github"
}
],
"time": "2026-02-04T18:08:13+00:00"
},
{
"name": "tijsverkoyen/css-to-inline-styles",
"version": "v2.4.0",
BIN
View File
Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 MiB

BIN
View File
Binary file not shown.

After

Width:  |  Height:  |  Size: 10 KiB

BIN
View File
Binary file not shown.

After

Width:  |  Height:  |  Size: 160 KiB

+4 -4
View File
@@ -14,8 +14,8 @@ import {
faStar, faClock, faCircleQuestion, faSliders,
faBell, faMagnifyingGlass,
faGraduationCap, faFileInvoice, faHeart, faCertificate,
faChevronRight, faArrowRightFromBracket, faCube,
faTriangleExclamation,
faChevronRight, faChevronLeft, faArrowRightFromBracket, faCube,
faTriangleExclamation, faPlus, faFilePdf, faDownload,
} from '@fortawesome/free-solid-svg-icons'
library.add(
@@ -24,8 +24,8 @@ library.add(
faStar, faClock, faCircleQuestion, faSliders,
faBell, faMagnifyingGlass,
faGraduationCap, faFileInvoice, faHeart, faCertificate,
faChevronRight, faArrowRightFromBracket, faCube,
faTriangleExclamation,
faChevronRight, faChevronLeft, faArrowRightFromBracket, faCube,
faTriangleExclamation, faPlus, faFilePdf, faDownload,
)
InertiaProgress.init()
+1
View File
@@ -3,6 +3,7 @@
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="csrf-token" content="{{ csrf_token() }}">
<title inertia>{{ config('app.name', 'Nexus') }}</title>
+336
View File
@@ -0,0 +1,336 @@
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
<title>Rechnung {{ $rechnungsnummer }}</title>
<style>
@page {
size: A4 portrait;
margin: 0;
}
* { margin: 0; padding: 0; box-sizing: border-box; }
body {
font-family: 'DejaVu Sans', sans-serif;
font-size: 9.5pt;
color: #1a1a1a;
background: white;
}
/* ── Kohte: steht zwischen Empfänger und Kontaktdaten ── */
.kohte-img {
width: 13mm;
height: 13mm;
display: block;
margin: 0 auto;
}
/* ── Seiteninhalt ── */
.page {
padding: 10mm 18mm 20mm 10mm;
}
/* ── Kopfbereich ── */
.header-table {
width: 100%;
border-collapse: collapse;
margin-bottom: 6mm;
}
.header-table td { vertical-align: top; padding: 0; }
/* Rücksendeadresse (schmale Linie über Empfänger) */
.absender-rueck {
font-size: 6pt;
color: #555;
border-bottom: 0.3pt solid #888;
padding-bottom: 1.5mm;
margin-bottom: 3.5mm;
}
/* Empfängeradresse */
.empfaenger { font-size: 10pt; line-height: 1.65; }
.empfaenger-bold { font-weight: bold; }
/* ── BdP Logo ── */
.logo-img {
width: 36mm;
display: block;
margin-bottom: 4mm;
}
/* Absenderadresse rechts (linksbündig) */
.absender-block {
font-size: 7.5pt;
color: #1a4799;
line-height: 1.7;
}
.absender-name {
font-weight: bold;
font-size: 8pt;
}
/* ── Betreff ── */
.betreff {
font-size: 14pt;
color: #1a4799;
margin-bottom: 5mm;
}
/* ── Referenzdaten ── */
.ref-table {
border-collapse: collapse;
font-size: 8.5pt;
margin-bottom: 7mm;
}
.ref-table td { padding: 0.9mm 7mm 0.9mm 0; vertical-align: top; }
.ref-key { color: #666; white-space: nowrap; }
/* ── Anrede / Text ── */
.salutation { font-size: 9.5pt; margin-bottom: 3mm; }
.intro-text { font-size: 9pt; line-height: 1.6; margin-bottom: 7mm; color: #333; }
/* ── Positionstabelle ── */
.pos-table {
width: 100%;
border-collapse: collapse;
font-size: 8.5pt;
}
.pos-table th {
background-color: #1a4799;
color: white;
padding: 2.5mm 3mm;
text-align: left;
font-size: 7.5pt;
letter-spacing: 0.03em;
}
.pos-table th.r, .pos-table td.r { text-align: right; }
.pos-table td {
padding: 2mm 3mm;
border-bottom: 0.3pt solid #d8dde6;
vertical-align: top;
}
.pos-table tr:nth-child(even) td { background-color: #f7f8fb; }
.pos-table tr:last-child td { border-bottom: none; }
.pos-empty {
text-align: center;
color: #aaa;
font-style: italic;
padding: 3mm 0 !important;
background: none !important;
}
/* ── Summen ── */
.sum-outer { width: 100%; border-collapse: collapse; margin-top: 1mm; margin-bottom: 5mm; }
.sum-outer td { padding: 0; }
.sum-spacer { width: 55%; }
.sum-inner { width: 100%; border-collapse: collapse; font-size: 8.5pt; }
.sum-inner td { padding: 1.2mm 0; }
.sum-key { color: #555; padding-right: 6mm; white-space: nowrap; }
.sum-val { text-align: right; white-space: nowrap; }
.sum-line td { border-top: 0.4pt solid #bbb; padding-top: 2mm; }
.sum-total td {
font-weight: bold;
font-size: 11pt;
color: #1a4799;
border-top: 1.5pt solid #1a4799;
padding-top: 2mm;
}
/* ── Bankverbindung ── */
.bank-box {
border-left: 3pt solid #f5c400;
padding: 3mm 5mm;
background-color: #fffef5;
font-size: 8.5pt;
line-height: 1.6;
margin-bottom: 6mm;
}
.bank-head {
font-size: 7pt;
font-weight: bold;
color: #888;
text-transform: uppercase;
letter-spacing: 0.07em;
margin-bottom: 2mm;
}
.bank-hint {
margin-top: 1.5mm;
font-size: 7.5pt;
color: #999;
}
/* ── Grußformel ── */
.closing { font-size: 9.5pt; line-height: 1.5; }
.gut-pfad { font-size: 13pt; color: #1a4799; margin-top: 1mm; margin-bottom: 1mm; }
.closing-name { margin-top: 3mm; font-size: 9pt; }
</style>
</head>
<body>
<div class="page">
<!-- ══════════ KOPF ══════════ -->
<table class="header-table">
<tr>
<!-- LINKS: Rücksendezeile + Empfänger -->
<td style="width: 50%; padding-top: 4mm;">
<div class="absender-rueck">
BdP Bund der Pfadfinder*innen LV Sachsen e.V. &middot;
c/o Mandy Grazek &middot; Weststra&szlig;e 53c &middot; 09212 Limbach-Oberfrohna
</div>
<div class="empfaenger">
@if($organisation)
<div class="empfaenger-bold">{{ $organisation }}</div>
@endif
@if($vorname || $nachname)
<div class="empfaenger-bold">
{{ trim($anrede . ' ' . $vorname . ' ' . $nachname) }}
</div>
@endif
@if($adresse)
<div>{{ $adresse }}</div>
@endif
@if($plz || $ort)
<div>{{ trim($plz . ' ' . $ort) }}</div>
@endif
@if(!$organisation && !$vorname && !$nachname)
<div style="color:#aaa;font-style:italic;">Kein Empfänger angegeben</div>
@endif
</div>
</td>
<!-- MITTE: Kohte (zwischen Empfänger und Kontaktdaten) -->
<td style="vertical-align: middle; padding-top: 4mm; width: 9%; padding-right: 20px;">
<img src="{{ $kohteDataUri }}" style="width: 115px; height: 130px;" class="kohte-img" />
</td>
<!-- RECHTS: BdP Logo + Kontaktdaten (linksbündig) -->
<td style="width: 41%; vertical-align: top; padding-top: 2mm;">
<!-- BdP Wortmarke -->
<img src="{{ $logoDataUri }}" class="logo-img" />
<!-- Absenderadresse -->
<div class="absender-block">
<div class="absender-name">Bund der Pfadfinder*innen</div>
<div>Landesverband Sachsen e.V.&nbsp;(BdP)</div>
<div>c/o Mandy Grazek</div>
<div style="margin-top:2.5mm;">Weststra&szlig;e&nbsp;53c</div>
<div>09212&nbsp;Limbach&#8209;Oberfrohna</div>
<div style="margin-top:2.5mm;">Thomas Günther</div>
<div style="margin-top:2.5mm;">{{ $absenderEmail }}</div>
@if($absenderTelefon)
<div>{{ $absenderTelefon }}</div>
@endif
</div>
</td>
</tr>
</table>
<!-- ══════════ BETREFF ══════════ -->
<div class="betreff">Rechnung Nr.&nbsp;{{ $rechnungsnummer }}</div>
<!-- ══════════ REFERENZDATEN ══════════ -->
<table class="ref-table">
<tr>
<td class="ref-key">Rechnungsdatum:</td>
<td>{{ $rechnungsdatumFormatiert }}</td>
<td style="width: 8mm;"></td>
<td class="ref-key">Rechnungs-Nr.:</td>
<td>{{ $rechnungsnummer }}</td>
</tr>
@if($zahlungsziel)
<tr>
<td class="ref-key">Zahlungsziel:</td>
<td colspan="4">{{ $zahlungszielFormatiert }}</td>
</tr>
@endif
</table>
<!-- ══════════ ANREDE + EINLEITUNG ══════════ -->
<div class="salutation">
Hallo,
</div>
<div class="intro-text">
anbei übersenden wir folgende Rechnungmit der Bitte um Überweisung des Gesamtbetrags
bis zum {{ $zahlungszielFormatiert }} auf das unten angegebene Konto.
</div>
<!-- ══════════ POSITIONEN ══════════ -->
<table class="pos-table">
<thead>
<tr>
<th style="width:8%;">Nr.</th>
<th style="width:44%;">Bezeichnung</th>
<th style="width:12%;" class="r">Menge</th>
<th style="width:18%;" class="r">Einzelpreis</th>
<th style="width:18%;" class="r">Gesamt</th>
</tr>
</thead>
<tbody>
@forelse($positionen as $i => $pos)
<tr>
<td>{{ $i + 1 }}</td>
<td>{{ $pos['bezeichnung'] }}</td>
<td class="r">{{ number_format((float)($pos['menge'] ?? 0), 2, ',', '.') }}&nbsp;{{ $pos['einheit'] ?? '' }}</td>
<td class="r">{{ number_format((float)($pos['einzelpreis'] ?? 0), 2, ',', '.') }}&nbsp;&euro;</td>
<td class="r">{{ number_format((float)($pos['menge'] ?? 0) * (float)($pos['einzelpreis'] ?? 0), 2, ',', '.') }}&nbsp;&euro;</td>
</tr>
@empty
<tr>
<td colspan="5" class="pos-empty">Keine Positionen erfasst.</td>
</tr>
@endforelse
</tbody>
</table>
<!-- ══════════ SUMMEN ══════════ -->
<table class="sum-outer">
<tr>
<td class="sum-spacer"></td>
<td>
<table class="sum-inner">
<tr>
<td class="sum-key">Nettobetrag</td>
<td class="sum-val">{{ number_format($netto, 2, ',', '.') }}&nbsp;&euro;</td>
</tr>
<tr class="sum-line">
<td class="sum-key">zzgl. {{ $mwstSatz }}&nbsp;% MwSt.</td>
<td class="sum-val">{{ number_format($mwst, 2, ',', '.') }}&nbsp;&euro;</td>
</tr>
<tr class="sum-total">
<td class="sum-key">Gesamtbetrag</td>
<td class="sum-val">{{ number_format($brutto, 2, ',', '.') }}&nbsp;&euro;</td>
</tr>
</table>
</td>
</tr>
</table>
<!-- ══════════ BANKVERBINDUNG ══════════ -->
@if($iban || $bic)
<div class="bank-box">
<div class="bank-head">Bankverbindung</div>
<div>Kontoinhaber: BdP Landesverband Sachsen e.V.</div>
@if($iban)<div>IBAN:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<strong>{{ $iban }}</strong></div>@endif
@if($bic)<div>BIC:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<strong>{{ $bic }}</strong></div>@endif
</div>
@endif
<!-- ══════════ GRUSSFORMEL ══════════ -->
<div class="closing">
<div class="gut-pfad">Herzlichst Gut Pfad.</div>
<div class="closing-name">
BdP Landesverband Sachsen e.V.<br />
Landesschatzmeister<br />
Thomas Günther</div>
</div>
</div>
</body>
</html>