pdf invoice generation scaffolding

This commit is contained in:
Peter Papp
2021-04-26 17:03:17 +02:00
parent 644fbaede4
commit 7cf193abb7
99 changed files with 390 additions and 325 deletions
+31 -28
View File
@@ -8,10 +8,6 @@ $border-radius: 15px;
font-size:(($size*1.6)/16) + 0em;
}
body {
padding: 25px;
}
* {
outline: 0;
margin: 0;
@@ -31,8 +27,9 @@ html {
}
.row {
display: flex;
flex-wrap: nowrap;
display: -webkit-flex;
-webkit-flex-wrap: nowrap;
width: 100%;
&.spaces {
margin: 0 -15px;
@@ -43,7 +40,7 @@ html {
}
div[class^='col-'] {
flex-grow: 1;
-webkit-flex-grow: 1;
&.align-right {
text-align: right;
@@ -51,19 +48,23 @@ html {
}
.col-left, .col-right {
width: 50%;
width: 49%;
}
&.align-center div[class^='col-'] {
align-self: center;
-webkit-align-self: center;
}
&.align-bottom div[class^='col-'] {
align-self: flex-end;
-webkit-align-self: flex-end;
}
}
.invoice-header {
.col-left, .col-right {
display: inline-block;
}
.logo {
margin-bottom: 5px;
display: block;
@@ -117,16 +118,20 @@ html {
}
.special-wrapper {
display: grid;
grid-template-columns: 2fr 1fr 1fr 1fr;
gap: 20px;
padding-bottom: 25px;
border-bottom: 1px dashed $border-color;
margin-bottom: 25px;
margin: 0 -5px 25px;
.special-item {
background: $background-color;
border-radius: 8px;
display: inline-block;
width: 20.9%;
margin: 0 5px;
&:nth-child(1) {
width: 31.5%;
}
.padding {
padding: 10px 15px;
@@ -152,10 +157,11 @@ html {
}
.table {
table-layout: fixed;
border-collapse: collapse;
width: 100%;
.table-row {
display: flex;
&:nth-child(even) {
background-color: $background-color;
@@ -163,17 +169,16 @@ html {
}
.table-cell {
flex: 1 1 100%;
text-align: left;
min-width: 50px;
word-break: break-word;
padding: 5px;
span, a {
word-break: break-word;
}
&:first-child {
flex: 0 0 280px;
width: 280px;
padding-left: 15px;
padding-right: 15px;
}
@@ -195,7 +200,6 @@ html {
background-color: white !important;
padding-bottom: 15px;
border-bottom: 0;
display: block;
.table-cell {
@@ -209,7 +213,7 @@ html {
}
.table-cell {
align-self: center;
word-break: break-all;
span, a {
vertical-align: middle;
@@ -226,16 +230,15 @@ html {
li {
padding: 2px 0;
display: block;
.col-full:first-child {
b, span {
white-space: nowrap;
}
b, span {
white-space: nowrap;
}
.col-full {
width: 50%;
display: inline-block;
}
}
@@ -255,9 +258,9 @@ html {
}
.invoice-author {
display: flex;
justify-content: space-between;
align-items: flex-end;
display: -webkit-flex;
-webkit-justify-content: space-between;
-webkit-align-items: flex-end;
padding-bottom: 25px;
.sign {
@@ -1,28 +1,34 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
<meta http-equiv="Pragma" content="no-cache">
<link rel="preconnect" href="https://fonts.gstatic.com">
<link href="https://fonts.googleapis.com/css2?family=Nunito:wght@300;400;600;700;900&display=swap" rel="stylesheet">
<link href="{{ mix('css/oasis-invoice.css') }}?v={{ get_version() }}" rel="stylesheet">
@if(is_route('invoice-debug'))
<link rel="stylesheet" href="{{ mix('css/oasis-invoice.css') }}">
<style>
body {
padding: 25px;
}
</style>
@else
<link rel="stylesheet" href="{{ public_path('css/oasis-invoice.css') }}">
@endif
<title>Invoice</title>
</head>
<body>
@php
//dd($invoice->user);
@endphp
{{--Invoice header--}}
<header class="invoice-header">
<div class="row">
<div class="col-left">
{{--TODO: klientske logo--}}
<img class="logo" src="{{ get_setting('app_logo_horizontal') }}">
<img class="logo" src="{{ get_storage_path('system/5YDehSGh-vuefilemanager-horizontal-logo.svg') }}">
<b class="email">{{ $user->email }}</b>
<b class="phone">{{ $user->settings->phone_number }}</b>
@@ -144,6 +150,8 @@
<td class="table-cell">
<span>Celkom</span>
</td>
{{--TODO: zmenit dph z klienta na usera--}}
@if($invoice->client['ic_dph'])
<td class="table-cell">
<span>Sadzba DPH</span>
@@ -203,82 +211,58 @@
@if($invoice->discount_type)
<li class="row">
<div class="col-full">
<span>Zlava za doklad:</span>
</div>
<div class="col-full">
<!-- -32,64-->
<span>-{{ invoice_total_discount($invoice, true) }}</span>
</div>
<span>Zlava za doklad:</span>
<!-- -32,64-->
<span>-{{ invoice_total_discount($invoice, true) }}</span>
</li>
@endif
{{--VAT Payer--}}
@if($invoice->client['ic_dph'] && ! $invoice->discount_type)
<li class="row">
<div class="col-full">
<span>Cena bez DPH:</span>
</div>
<div class="col-full">
<span>{{ format_to_currency($invoice->total_net) }}</span>
</div>
<span>Cena bez DPH:</span>
<span>{{ format_to_currency($invoice->total_net) }}</span>
</li>
<li class="row">
<div class="col-full">
<span>DPH:</span>
</div>
<div class="col-full">
<span>{{ format_to_currency($invoice->total_tax) }}</span>
</div>
<span>DPH:</span>
<span>{{ format_to_currency($invoice->total_tax) }}</span>
</li>
@endif
{{--VAT Payer with Discount--}}
@if($invoice->client['ic_dph'] && $invoice->discount_type)
<li class="row">
<div class="col-full">
<span>Cena bez DPH:</span>
</div>
<div class="col-full">
<span>
@if($invoice->discount_type === 'percent')
<!--244,80-->
{{ format_to_currency($invoice->total_net * ((100 - $invoice->discount_rate) / 100)) }}
@endif
@if($invoice->discount_type === 'value')
<!--263,67-->
{{ format_to_currency(($invoice->total_net + invoice_total_tax($invoice)) / ((100 - $invoice->discount_rate) / 100)) }}
@endif
</span>
</div>
</li>
<li class="row">
<div class="col-full">
<span>DPH:</span>
</div>
<div class="col-full">
<span>Cena bez DPH:</span>
<span>
@if($invoice->discount_type === 'percent')
<!--48,96-->
<span>{{ format_to_currency(invoice_total_tax($invoice) * ((100 - $invoice->discount_rate) / 100)) }}</span>
<!--244,80-->
{{ format_to_currency($invoice->total_net * ((100 - $invoice->discount_rate) / 100)) }}
@endif
@if($invoice->discount_type === 'value')
<!--52,73-->
<!--263,67-->
{{ format_to_currency(($invoice->total_net + invoice_total_tax($invoice)) / ((100 - $invoice->discount_rate) / 100)) }}
@endif
</div>
</span>
</li>
<li class="row">
<span>DPH:</span>
@if($invoice->discount_type === 'percent')
<!--48,96-->
<span>{{ format_to_currency(invoice_total_tax($invoice) * ((100 - $invoice->discount_rate) / 100)) }}</span>
@endif
@if($invoice->discount_type === 'value')
<!--52,73-->
@endif
</li>
@endif
<li class="row">
<div class="col-full">
<b>Spolu k úhrade:</b>
</div>
<div class="col-full">
@if($invoice->client['ic_dph'])
<b>{{ format_to_currency(invoice_total_net($invoice) + invoice_total_tax($invoice)) }}</b>
@else
<b>{{ format_to_currency(invoice_total_net($invoice)) }}</b>
@endif
</div>
<b>Spolu k úhrade:</b>
@if($invoice->client['ic_dph'])
<b>{{ format_to_currency(invoice_total_net($invoice) + invoice_total_tax($invoice)) }}</b>
@else
<b>{{ format_to_currency(invoice_total_net($invoice)) }}</b>
@endif
</li>
</ul>
@@ -295,8 +279,10 @@
@endif
</div>
<div class="sign">
@if(is_route('invoice-debug'))
<img src="{{ asset('/stamp.png') }}">
@endif
{{--<img src="{{ public_path('/stamp.png') }}">--}}
<img src="{{ asset('/stamp.png') }}">
<span class="highlight">Faktúru vystavil:</span> {{ $invoice->user['name'] }}
</div>
</div>