Use Laravel-Dompdf and create pdf invoices.

This commit is contained in:
2025-01-06 16:04:51 +01:00
parent fa085b7384
commit 8e0696d438
15 changed files with 872 additions and 4 deletions

View File

@@ -0,0 +1,35 @@
<div class="left" style="margin-left: 10mm; height: 45mm; width: 100mm;">
<div style="font-size: 10px;">{{ $options->company_name }}, {{ $options->address }}
, {{ $options->zip }} {{ $options->city }}</div>
<div style="margin-top: 5mm;">
<div>{{ $invoice->address->name }}</div>
<div>{{ $invoice->address->address }}</div>
<div>&nbsp;</div>
<div>{{ $invoice->address->zip }} {{ $invoice->address->city }}</div>
</div>
</div>
<div class="right" style="height: 45mm; width: 60mm; font-size: 13px; ">
<div class="left">{{ __('common.Phone_short') }}:</div>
<div class="right text-right">{{ $options->phone }}</div>
<br/>
<div class="left">{{ __('common.Email_short') }}:</div>
<div class="right text-right" style="color: {{ $options->color_1 }};">{{ $options->email }}</div>
<br/>
<div class="left">{{ __('common.Web_short') }}:</div>
<div class="right text-right" style="color: {{ $options->color_1 }};">{{ $options->website }}</div>
<br/>
<div class="text-right" style="margin-top: 5mm; color: {{ $options->color_2 }};">{!! nl2br($options->activity) !!}</div>
<br class="clear"/>
</div>
<div class="clear"></div>
<div class="left" style="width: 110mm; height:15mm;">
{{ __('invoice.Invoice Number short') }}: {{ $invoice->number }}
</div>
<div class="right" style=" width: 60mm; height:15mm;">
<div class="left">{{ __('common.Date') }}:</div>
<div class="right text-right">{{ $invoice->created }}</div>
</div>
<div class="clear"></div>

View File

@@ -0,0 +1,17 @@
<footer>
<div>
<div class="left footer-left">
<div style="font-weight: bold;">{{ __('configuration.Bank details') }}</div>
<div>{{ $options->institute_1 }} - {{ __('configuration.BIC') }}: {{ $options->bic_1 }} - {{ __('configuration.IBAN') }}: {{ $options->iban_1 }}</div>
</div>
<div class="left footer-center">
<div style="font-weight: bold">{{ __('configuration.Tax number') }}</div>
<div>{{ $options->tax_number }}</div>
</div>
<div class="right footer-right text-right">
<div style="font-weight: bold">{{ __('configuration.Jurisdiction') }}</div>
<div>{{ $options->jurisdiction }}</div>
</div>
</div>
<br class="clear"/>
</footer>

View File

@@ -0,0 +1,14 @@
<header>
<div>
<div class="left header-left">
<img class="header-logo" src="{{ $options->company_logo }}" />
</div>
<div class="right header-right text-right">
<div>{{ $options->company_name }}</div>
<div>{{ $options->representative }}</div>
<div>{{ $options->address }}</div>
<div>{{ $options->zip }} {{ $options->city }}</div>
</div>
</div>
</header>

View File

@@ -0,0 +1,79 @@
<!DOCTYPE html>
<html lang="{{ str_replace('_', '-', app()->getLocale()) }}">
<head>
<meta charset="utf-8">
<title>{{ __('invoice.Invoice') }}</title>
<style>
@page { margin: 50mm 15mm 35mm 20mm; font-family:Figtree,ui-sans-serif,system-ui,sans-serif,"Apple Color Emoji","Segoe UI Emoji",Segoe UI Symbol,"Noto Color Emoji";font-feature-settings:normal;font-variation-settings:normal; }
header { position: fixed; top: -30mm; left: 0; right: 0; height: 25mm; }
footer { position: fixed; bottom: -25mm; left: 0; right: 0; height: 10mm; font-size: 10px; border-top: 1px solid black; padding-top: 2mm;}
.invoice { font-size: 13px; }
.invoice-header { font-weight: bold; border-bottom: 1px solid black; }
.item { border-bottom: 1px solid black; }
.header-left { width: 100mm; }
.header-right { width: 70mm; font-size: 13px; }
.header-logo { height: 20mm; }
.footer-left { width: 100mm; }
.footer-center { width: 40mm; }
.footer-right {width: 40mm; }
.text-right { text-align: right; }
.left { float: left; display: inline-block; }
.right { float: right; display: inline-block; }
.clear { clear:both; height: 0; line-height: 0; }
.page-break { page-break-after: always; }
</style>
</head>
<body>
@include('pdfs.header')
@include('pdfs.footer')
<main>
@include('pdfs.address')
<div class="invoice">
<div class="invoice-header">
<div style="width: 15mm;" class="left">{{ __('invoice.Item position short') }}</div>
<div style="width: 15mm;" class="left">{{ __('invoice.Item amount short') }}</div>
<div style="width: 85mm;" class="left">{{ __('invoice.Item description') }}</div>
<div style="width: 20mm;" class="left text-right">{{ __('invoice.Item single price short') }}</div>
<div style="width: 20mm;" class="left text-right">{{ __('invoice.Vat short') }}</div>
<div style="width: 20mm;" class="left text-right">{{ __('invoice.Item total price short') }}</div>
<br class="clear"/>
</div>
@foreach ($invoice->items as $key => $item)
<div class="item">
<div style="width: 15mm;" class="left">{{ $key + 1 }}</div>
<div style="width: 15mm;" class="left">{{ \Illuminate\Support\Number::format($item->amount) }}</div>
<div style="width: 85mm;" class="left">{{ $item->name }}</div>
<div style="width: 20mm;" class="left text-right">{{ \Illuminate\Support\Number::currency($item->price) }}</div>
<div style="width: 20mm;" class="left text-right">{{ \Illuminate\Support\Number::percentage($item->tax) }}<br/></div>
<div style="width: 20mm;" class="left text-right">{{ \Illuminate\Support\Number::currency($item->total) }}</div>
<br class="clear"/>
<div style="width: 30mm;" class="left"></div>
<div style="width: 105mm;" class="left">{{ $item->description }}</div>
<div style="width: 20mm;" class="left text-right">{{ \Illuminate\Support\Number::currency($item->amount * $item->price * $item->tax / 100) }}</div>
<br class="clear"/>
</div>
@endforeach
<div class="left" style="padding-left: 30mm; width: 105mm;">{{ __('invoice.Net long') }}</div>
<div class="left text-right" style="width: 40mm;">{{ \Illuminate\Support\Number::currency($invoice->sum - $invoice->tax) }}</div>
<br class="clear"/>
<div class="left" style="padding-left: 30mm; width: 105mm;">+ {{ __('invoice.Vat short') }}</div>
<div class="left text-right" style="width: 40mm;">{{ \Illuminate\Support\Number::currency($invoice->tax) }}</div>
<br class="clear"/>
<div class="left" style="width: 30mm;"></div>
<div class="left" style="font-weight: bold; width: 105mm; border-bottom: 1px solid black;">{{ __('invoice.Gross long') }}</div>
<div class="left text-right" style="font-weight: bold; width: 40mm; border-bottom: 1px solid black;">{{ \Illuminate\Support\Number::currency($invoice->sum) }}</div>
<br class="clear"/>
<div style="margin-top: 5mm;">{{ __('invoice.Final sentence', ['sum' => \Illuminate\Support\Number::currency($invoice->sum), 'date' => \Illuminate\Support\Carbon::parse($invoice->created_at)->addDays(14)->format('d.m.Y')]) }}</div>
</div>
</main>
</body>
</html>