feat: add legacy PDF generation support and invoice discount fields
This commit is contained in:
373
resources/views/invoices/pdf-legacy.blade.php
Normal file
373
resources/views/invoices/pdf-legacy.blade.php
Normal file
@@ -0,0 +1,373 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<style>
|
||||
* {
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
||||
body {
|
||||
font-family: 'Helvetica', Arial, sans-serif;
|
||||
color: #000;
|
||||
font-size: 11px;
|
||||
padding: 40px;
|
||||
}
|
||||
|
||||
.header-wrap {
|
||||
margin-bottom: 40px;
|
||||
}
|
||||
|
||||
.title-block {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
margin-bottom: 30px;
|
||||
}
|
||||
|
||||
.title-line {
|
||||
flex-grow: 1;
|
||||
height: 1px;
|
||||
background: #000;
|
||||
margin-right: 20px;
|
||||
}
|
||||
|
||||
.title {
|
||||
font-size: 32px;
|
||||
letter-spacing: 12px;
|
||||
font-weight: 300;
|
||||
}
|
||||
|
||||
.info-table {
|
||||
width: 100%;
|
||||
margin-bottom: 30px;
|
||||
}
|
||||
|
||||
.info-table td {
|
||||
vertical-align: top;
|
||||
}
|
||||
|
||||
.label {
|
||||
font-size: 9px;
|
||||
color: #666;
|
||||
text-transform: uppercase;
|
||||
font-weight: bold;
|
||||
margin-bottom: 5px;
|
||||
letter-spacing: 1px;
|
||||
}
|
||||
|
||||
.val-bold {
|
||||
font-weight: bold;
|
||||
font-size: 13px;
|
||||
margin-bottom: 4px;
|
||||
}
|
||||
|
||||
.val {
|
||||
font-size: 11px;
|
||||
color: #444;
|
||||
line-height: 1.4;
|
||||
}
|
||||
|
||||
.details-table {
|
||||
border-collapse: collapse;
|
||||
float: right;
|
||||
}
|
||||
|
||||
.details-table td {
|
||||
padding: 3px 0;
|
||||
font-size: 11px;
|
||||
}
|
||||
|
||||
.details-table .lbl {
|
||||
color: #666;
|
||||
text-align: right;
|
||||
padding-right: 15px;
|
||||
font-weight: bold;
|
||||
width: 80px;
|
||||
}
|
||||
|
||||
.details-table .val-dt {
|
||||
font-weight: bold;
|
||||
text-align: left;
|
||||
}
|
||||
|
||||
.items {
|
||||
width: 100%;
|
||||
border-collapse: collapse;
|
||||
margin-bottom: 10px;
|
||||
}
|
||||
|
||||
.items th,
|
||||
.items td {
|
||||
padding: 8px 0;
|
||||
font-size: 11px;
|
||||
}
|
||||
|
||||
.items th {
|
||||
text-align: left;
|
||||
text-transform: uppercase;
|
||||
font-weight: bold;
|
||||
border-top: 1px solid #000;
|
||||
border-bottom: 1px solid #000;
|
||||
font-size: 9px;
|
||||
letter-spacing: 1px;
|
||||
color: #333;
|
||||
}
|
||||
|
||||
.items td {
|
||||
border-bottom: 1px solid #ddd;
|
||||
}
|
||||
|
||||
.items tr:last-child td {
|
||||
border-bottom: 1px solid #000;
|
||||
}
|
||||
|
||||
.items .td-right {
|
||||
text-align: right;
|
||||
}
|
||||
|
||||
.items .td-center {
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.totals-wrapper {
|
||||
width: 100%;
|
||||
margin-bottom: 40px;
|
||||
}
|
||||
|
||||
.totals-wrapper::after {
|
||||
content: "";
|
||||
display: table;
|
||||
clear: both;
|
||||
}
|
||||
|
||||
.totals {
|
||||
float: right;
|
||||
border-collapse: collapse;
|
||||
min-width: 250px;
|
||||
}
|
||||
|
||||
.totals td {
|
||||
padding: 3px 0;
|
||||
font-size: 11px;
|
||||
}
|
||||
|
||||
.totals .lbl {
|
||||
text-align: right;
|
||||
padding-right: 35px;
|
||||
letter-spacing: 1px;
|
||||
font-size: 9px;
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
.totals .val {
|
||||
text-align: right;
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
.bank-info {
|
||||
margin-bottom: 60px;
|
||||
}
|
||||
|
||||
.bank-info .label {
|
||||
margin-bottom: 15px;
|
||||
}
|
||||
|
||||
.bank-info p {
|
||||
font-size: 11px;
|
||||
line-height: 1.6;
|
||||
color: #444;
|
||||
}
|
||||
|
||||
.footer {
|
||||
width: 100%;
|
||||
text-align: right;
|
||||
}
|
||||
|
||||
.signature {
|
||||
display: inline-block;
|
||||
text-align: center;
|
||||
width: 200px;
|
||||
}
|
||||
|
||||
.sig-date {
|
||||
font-size: 11px;
|
||||
color: #444;
|
||||
margin-bottom: 15px;
|
||||
}
|
||||
|
||||
.sig-img {
|
||||
max-height: 60px;
|
||||
max-width: 180px;
|
||||
object-fit: contain;
|
||||
margin-bottom: 15px;
|
||||
}
|
||||
|
||||
.sig-name {
|
||||
font-size: 11px;
|
||||
font-weight: bold;
|
||||
text-transform: uppercase;
|
||||
margin-bottom: 3px;
|
||||
}
|
||||
|
||||
.sig-title {
|
||||
font-size: 9px;
|
||||
color: #666;
|
||||
text-transform: uppercase;
|
||||
letter-spacing: 1px;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
|
||||
<table style="width:100%; margin-bottom: 30px;" cellpadding="0" cellspacing="0">
|
||||
<tr>
|
||||
<td style="width:50%; vertical-align:middle; padding-right:20px;">
|
||||
<div style="height:1px; background:#000; width:100%;"></div>
|
||||
</td>
|
||||
<td style="vertical-align:middle; text-align:right;">
|
||||
<div class="title">I N V O I C E</div>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
<table class="info-table" cellpadding="0" cellspacing="0">
|
||||
<tr>
|
||||
<td style="width:50%; padding-right:20px;">
|
||||
<div class="label">BILLING TO:</div>
|
||||
@if($invoice->client)
|
||||
<div class="val-bold">{{ $invoice->client->company }}</div>
|
||||
<!-- @if($invoice->client->company)
|
||||
<div class="val">{{ $invoice->client->company }}</div>@endif -->
|
||||
@if($invoice->client->full_address)
|
||||
<div class="val">{!! nl2br(e($invoice->client->full_address)) !!}</div>@endif
|
||||
@else
|
||||
<div class="val">—</div>
|
||||
@endif
|
||||
</td>
|
||||
<td style="width:50%; text-align:right;">
|
||||
<table class="details-table" align="right" cellpadding="0" cellspacing="0">
|
||||
<tr>
|
||||
<td class="lbl">Invoice No:</td>
|
||||
<td class="val-dt">{{ $invoice->invoice_number }}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="lbl">Date:</td>
|
||||
<td class="val-dt">{{ $invoice->issue_date->format('d.m.Y') }}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="lbl">Due Date:</td>
|
||||
<td class="val-dt">{{ $invoice->due_date->format('d.m.Y') }}</td>
|
||||
</tr>
|
||||
</table>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
<div style="margin-bottom: 30px;">
|
||||
<div class="label">FROM:</div>
|
||||
<div class="val-bold">
|
||||
{{ $invoiceSettings->header_name ?: 'Cathy' }}
|
||||
@if($invoiceSettings->header_title)
|
||||
<span style="font-weight: normal; color: #444;"> ( {{ $invoiceSettings->header_title }} )</span>
|
||||
@endif
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<table class="items" cellpadding="0" cellspacing="0">
|
||||
<thead>
|
||||
<tr>
|
||||
<th style="width:45%;">DESCRIPTION</th>
|
||||
<th class="td-right" style="width:25%;">PRICE</th>
|
||||
<th class="td-center" style="width:10%;">QTY</th>
|
||||
<th class="td-right" style="width:20%;">TOTAL</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
@foreach($invoice->items as $item)
|
||||
<tr>
|
||||
<td>
|
||||
{{ $item->description }}
|
||||
@if(!$item->is_taxable)
|
||||
<span
|
||||
style="margin-left:6px; font-size:8px; border:1px solid #999; color:#666; padding:1px 4px; border-radius:3px; text-transform:uppercase; letter-spacing:0.5px;">Non-Taxable</span>
|
||||
@endif
|
||||
@if($invoice->discount_rate > 0 && !$item->is_discountable)
|
||||
<span
|
||||
style="margin-left:6px; font-size:8px; border:1px solid #999; color:#666; padding:1px 4px; border-radius:3px; text-transform:uppercase; letter-spacing:0.5px;">No
|
||||
Discount</span>
|
||||
@endif
|
||||
</td>
|
||||
<td class="td-right">Rp {{ number_format($item->unit_price, 0, ',', '.') }}</td>
|
||||
<td class="td-center">{{ $item->quantity }}</td>
|
||||
<td class="td-right">Rp {{ number_format($item->total, 0, ',', '.') }}</td>
|
||||
</tr>
|
||||
@endforeach
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
<div class="totals-wrapper">
|
||||
<table class="totals" cellpadding="0" cellspacing="0">
|
||||
<tr>
|
||||
<td class="lbl" style="font-weight: normal;">SUBTOTAL</td>
|
||||
<td class="val" style="font-weight: normal;">Rp
|
||||
{{ number_format($invoice->subtotal + $invoice->discount_amount, 0, ',', '.') }}
|
||||
</td>
|
||||
</tr>
|
||||
@if($invoice->discount_amount > 0)
|
||||
<tr>
|
||||
<td class="lbl" style="font-weight: normal; color:#666;">DISCOUNT ({{ $invoice->discount_rate }}%)</td>
|
||||
<td class="val" style="font-weight: normal; color:#666;">- Rp
|
||||
{{ number_format($invoice->discount_amount, 0, ',', '.') }}
|
||||
</td>
|
||||
</tr>
|
||||
@endif
|
||||
@if($invoice->tax_rate > 0)
|
||||
<tr>
|
||||
<td class="lbl" style="font-weight: normal; color:#666;">TAX ({{ $invoice->tax_rate }}%)</td>
|
||||
<td class="val" style="font-weight: normal; color:#666;">Rp
|
||||
{{ number_format($invoice->tax_amount, 0, ',', '.') }}
|
||||
</td>
|
||||
</tr>
|
||||
@endif
|
||||
<tr>
|
||||
<td class="lbl" style="padding-top:10px;">GRAND TOTAL</td>
|
||||
<td class="val" style="padding-top:10px;">{{ $invoice->formatted_total }}</td>
|
||||
</tr>
|
||||
</table>
|
||||
</div>
|
||||
|
||||
@if($invoice->bank_name)
|
||||
<div class="bank-info">
|
||||
<div class="label"><b>PAYMENT ABOVE SHOULD BE MADE TO:</b></div>
|
||||
<p>
|
||||
{{ $invoice->bank_name }}<br>
|
||||
A/N {{ $invoice->bank_holder }}<br>
|
||||
{{ $invoice->bank_account }}
|
||||
@if($invoice->branch_name)<br>KCP: {{ $invoice->branch_name }}@endif
|
||||
</p>
|
||||
</div>
|
||||
@endif
|
||||
|
||||
<div class="footer">
|
||||
@if($invoice->signature_image && file_exists(storage_path('app/public/' . $invoice->signature_image)))
|
||||
<div class="signature">
|
||||
<div class="sig-date">Jakarta, {{ $invoice->issue_date->format('d F Y') }}</div>
|
||||
<img src="{{ storage_path('app/public/' . $invoice->signature_image) }}" class="sig-img">
|
||||
<div class="sig-name">
|
||||
{{ $invoice->signer_name ?: ($invoiceSettings->signer_name ?: ($invoiceSettings->header_name ?: 'Signature')) }}
|
||||
</div>
|
||||
<div class="sig-title">
|
||||
{{ $invoice->signer_title ?: ($invoiceSettings->signer_title ?: $invoiceSettings->header_title) }}
|
||||
</div>
|
||||
</div>
|
||||
@endif
|
||||
</div>
|
||||
|
||||
</body>
|
||||
|
||||
</html>
|
||||
Reference in New Issue
Block a user