Use Laravel-Dompdf and create pdf invoices.
This commit is contained in:
3
resources/views/components/pdf-icon.blade.php
Normal file
3
resources/views/components/pdf-icon.blade.php
Normal file
@@ -0,0 +1,3 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512" {{ $attributes->merge(['class' => 'size-8 p-1']) }}>>
|
||||
<path d="M64 464l48 0 0 48-48 0c-35.3 0-64-28.7-64-64L0 64C0 28.7 28.7 0 64 0L229.5 0c17 0 33.3 6.7 45.3 18.7l90.5 90.5c12 12 18.7 28.3 18.7 45.3L384 304l-48 0 0-144-80 0c-17.7 0-32-14.3-32-32l0-80L64 48c-8.8 0-16 7.2-16 16l0 384c0 8.8 7.2 16 16 16zM176 352l32 0c30.9 0 56 25.1 56 56s-25.1 56-56 56l-16 0 0 32c0 8.8-7.2 16-16 16s-16-7.2-16-16l0-48 0-80c0-8.8 7.2-16 16-16zm32 80c13.3 0 24-10.7 24-24s-10.7-24-24-24l-16 0 0 48 16 0zm96-80l32 0c26.5 0 48 21.5 48 48l0 64c0 26.5-21.5 48-48 48l-32 0c-8.8 0-16-7.2-16-16l0-128c0-8.8 7.2-16 16-16zm32 128c8.8 0 16-7.2 16-16l0-64c0-8.8-7.2-16-16-16l-16 0 0 96 16 0zm80-112c0-8.8 7.2-16 16-16l48 0c8.8 0 16 7.2 16 16s-7.2 16-16 16l-32 0 0 32 32 0c8.8 0 16 7.2 16 16s-7.2 16-16 16l-32 0 0 48c0 8.8-7.2 16-16 16s-16-7.2-16-16l0-64 0-64z"/>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 907 B |
@@ -1,8 +1,13 @@
|
||||
<x-app-layout>
|
||||
<x-slot name="header">
|
||||
<h2 class="font-semibold text-xl text-gray-800 dark:text-gray-200 leading-tight">
|
||||
{{ __('invoice.Invoice') }} {{ $invoice->number }}
|
||||
</h2>
|
||||
<div class="flex flex-row">
|
||||
<h2 class="w-1/2 font-semibold text-xl text-gray-800 dark:text-gray-200 leading-tight">
|
||||
{{ __('invoice.Invoice') }} {{ $invoice->number }}
|
||||
</h2>
|
||||
<p class="w-1/2 relative">
|
||||
<x-pdf-icon class="text-gray-800 absolute right-0 cursor-pointer" onclick="window.open('/invoice/{{ $invoice->id }}/download', '_blank', 'popup=true')"/>
|
||||
</p>
|
||||
</div>
|
||||
</x-slot>
|
||||
|
||||
<div class="py-12">
|
||||
|
||||
@@ -115,6 +115,14 @@
|
||||
autocomplete="jurisdiction"
|
||||
x-model="options.jurisdiction"/>
|
||||
</div>
|
||||
<div class="flex flex-row items-center">
|
||||
<x-input-label class="w-1/4" for="activity"
|
||||
:value="__('configuration.Activity')"/>
|
||||
<textarea id="activity" name="activity" rows="5"
|
||||
class="border-gray-300 dark:border-gray-700 dark:bg-gray-900 dark:text-gray-300 focus:border-indigo-500 dark:focus:border-indigo-600 focus:ring-indigo-500 dark:focus:ring-indigo-600 rounded-md shadow-sm mt-1 block w-full"
|
||||
autocomplete="activity"
|
||||
x-model="options.activity"></textarea>
|
||||
</div>
|
||||
</form>
|
||||
</details>
|
||||
</section>
|
||||
|
||||
35
resources/views/pdfs/address.blade.php
Normal file
35
resources/views/pdfs/address.blade.php
Normal 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> </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>
|
||||
17
resources/views/pdfs/footer.blade.php
Normal file
17
resources/views/pdfs/footer.blade.php
Normal 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>
|
||||
14
resources/views/pdfs/header.blade.php
Normal file
14
resources/views/pdfs/header.blade.php
Normal 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>
|
||||
79
resources/views/pdfs/invoice.blade.php
Normal file
79
resources/views/pdfs/invoice.blade.php
Normal 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>
|
||||
Reference in New Issue
Block a user