479 lines
19 KiB
PHP
479 lines
19 KiB
PHP
@extends('layouts.business.pdf.pdf_layout')
|
||
|
||
@section('pdf_title')
|
||
<style>
|
||
body {
|
||
font-family: sans-serif;
|
||
font-size: 12px;
|
||
color: #000;
|
||
}
|
||
|
||
.invoice-container {
|
||
width: 100%;
|
||
padding: 10px;
|
||
}
|
||
|
||
.top-table {
|
||
width: 100%;
|
||
border-collapse: collapse;
|
||
}
|
||
|
||
.logo-cell img {
|
||
height: 45px;
|
||
}
|
||
|
||
.company-name {
|
||
font-size: 20px;
|
||
font-weight: bold;
|
||
}
|
||
|
||
.right-info {
|
||
text-align: right;
|
||
font-size: 12px;
|
||
line-height: 1.6;
|
||
}
|
||
|
||
.invoice-badge {
|
||
margin: 10px auto 15px auto;
|
||
text-align: center;
|
||
}
|
||
|
||
.invoice-badge span {
|
||
display: inline-block;
|
||
padding: 6px 25px;
|
||
background: #c5161d;
|
||
color: #fff;
|
||
border-radius: 20px;
|
||
font-weight: bold;
|
||
letter-spacing: 1px;
|
||
}
|
||
|
||
.info-table {
|
||
width: 100%;
|
||
margin-bottom: 10px;
|
||
}
|
||
|
||
.info-table td {
|
||
vertical-align: top;
|
||
padding: 2px 4px;
|
||
}
|
||
|
||
.item-table {
|
||
width: 100%;
|
||
border-collapse: collapse;
|
||
margin-top: 10px;
|
||
}
|
||
|
||
.item-table th,
|
||
.item-table td {
|
||
border: 1px solid #000;
|
||
padding: 6px;
|
||
font-size: 12px;
|
||
}
|
||
|
||
.item-table th {
|
||
background: #f5f5f5;
|
||
font-weight: bold;
|
||
}
|
||
|
||
.text-right {
|
||
text-align: right;
|
||
}
|
||
|
||
.text-center {
|
||
text-align: center;
|
||
}
|
||
|
||
.summary-table {
|
||
width: 100%;
|
||
margin-top: 10px;
|
||
}
|
||
|
||
.summary-table td {
|
||
padding: 4px;
|
||
font-size: 12px;
|
||
}
|
||
|
||
.summary-right {
|
||
width: 40%;
|
||
float: right;
|
||
}
|
||
|
||
.return-title {
|
||
margin-top: 15px;
|
||
font-weight: bold;
|
||
}
|
||
|
||
.footer-table {
|
||
width: 100%;
|
||
margin-top: 25px;
|
||
}
|
||
|
||
.signature {
|
||
width: 40%;
|
||
text-align: end;
|
||
}
|
||
|
||
.signature-2 {
|
||
text-align: right
|
||
}
|
||
|
||
.signature hr {
|
||
margin-bottom: 3px;
|
||
}
|
||
|
||
.warranty-box {
|
||
border: 1px solid #000;
|
||
padding: 6px;
|
||
margin-top: 15px;
|
||
font-size: 11px;
|
||
}
|
||
</style>
|
||
@endsection
|
||
|
||
@section('pdf_content')
|
||
<div class="invoice-container">
|
||
|
||
{{-- HEADER --}}
|
||
<table class="top-table">
|
||
<tr>
|
||
<td>
|
||
@php
|
||
$defaultLogo = public_path('assets/images/default.svg');
|
||
$customLogo = public_path(
|
||
get_business_option('business-settings')['a4_invoice_logo'] ?? 'assets/images/default.svg',
|
||
);
|
||
$logoPath = file_exists($customLogo) ? $customLogo : $defaultLogo;
|
||
$logoData = base64_encode(file_get_contents($logoPath));
|
||
$logoType = pathinfo($logoPath, PATHINFO_EXTENSION);
|
||
@endphp
|
||
|
||
<table>
|
||
<tr>
|
||
@if ((get_business_option('business-settings')['show_a4_invoice_logo'] ?? 0) == 1)
|
||
<td>
|
||
<img style="width: auto;
|
||
height: 54px;
|
||
display: block;" src="data:image/{{ $logoType }};base64,{{ $logoData }}">
|
||
</td>
|
||
@endif
|
||
</tr>
|
||
</table>
|
||
</td>
|
||
<td class="right-info">
|
||
{{ __('Address') }} : {{ $purchase->branch?->address ?? $purchase->business?->address }}<br>
|
||
{{ __('Mobile') }} : {{ $purchase->branch?->phone ?? $purchase->business?->phoneNumber }}<br>
|
||
{{ __('Email') }} : {{ $purchase->branch?->email ?? $purchase->business?->email }}<br>
|
||
@if (($purchase->business->meta['show_vat'] ?? 0) == 1)
|
||
{{ $purchase->business->vat_name }}
|
||
@endif
|
||
{{ ($purchase->business->meta['show_vat'] ?? 0) == 1 && ($purchase->business->meta['show_vat'] ?? 0) == 1 ? ':' : '' }}
|
||
@if (($purchase->business->meta['show_vat'] ?? 0) == 1)
|
||
{{ $purchase->business->vat_no ?? '' }}
|
||
@endif
|
||
</td>
|
||
</tr>
|
||
</table>
|
||
|
||
{{-- INVOICE BADGE --}}
|
||
<h3
|
||
style="
|
||
font-size: 20px;
|
||
font-weight: 600;
|
||
color: white;
|
||
background-color: #c52127;
|
||
padding: 5px 12px;
|
||
border-radius: 30px;
|
||
margin: 0;
|
||
width: 100px;
|
||
display: flex;
|
||
align-items: center;
|
||
justify-content: center;
|
||
margin: auto;
|
||
border: 1px solid black;
|
||
text-align: center;">
|
||
{{ __('INVOICE') }}
|
||
</h3>
|
||
|
||
{{-- SUPPLIER / PURCHASE INFO --}}
|
||
<table class="info-table">
|
||
<tr>
|
||
<td width="50%" style="text-align:{{ app()->getLocale() == 'ar' ? 'left' : 'left' }};">
|
||
<strong>{{ __('Supplier Name') }}</strong> : {{ $purchase->party->name }}<br>
|
||
<strong>{{ __('Mobile') }}</strong> : {{ $purchase->party->phone }}<br>
|
||
<strong>{{ __('Address') }}</strong> : {{ $purchase->party->address }}
|
||
</td>
|
||
|
||
<td width="50%" style="text-align:{{ app()->getLocale() == 'ar' ? 'right' : 'right' }};">
|
||
<strong>{{ __('Invoice') }}</strong> : {{ $purchase->invoiceNumber }}<br>
|
||
<strong>{{ __('Date') }}</strong> : {{ formatted_date($purchase->purchaseDate) }}<br>
|
||
<strong>{{ __('Purchases By') }}</strong> :
|
||
{{ $purchase->user->role != 'staff' ? __('Admin') : $purchase->user->name }}
|
||
</td>
|
||
|
||
</tr>
|
||
</table>
|
||
|
||
{{-- ITEM TABLE --}}
|
||
<table class="item-table">
|
||
<thead>
|
||
<tr>
|
||
<th width="5%">{{ __('SL') }}</th>
|
||
<th width="45%">{{ __('Item') }}</th>
|
||
<th width="10%">{{ __('Quantity') }}</th>
|
||
@usercan('purchases.price')
|
||
<th width="20%">{{ __('Unit Price') }}</th>
|
||
@endusercan
|
||
<th width="20%">{{ __('Total Price') }}</th>
|
||
</tr>
|
||
</thead>
|
||
<tbody>
|
||
@php $subtotal = 0; @endphp
|
||
@foreach ($purchase->details as $detail)
|
||
@php
|
||
$productTotal = ($detail->productPurchasePrice ?? 0) * ($detail->quantities ?? 0);
|
||
$subtotal += $productTotal;
|
||
@endphp
|
||
<tr>
|
||
<td class="text-center">{{ $loop->iteration }}</td>
|
||
<td class="text-center">{{ ($detail->product->productName ?? '') . (!empty($detail->stock?->batch_no) ? ' (' . $detail->stock?->batch_no . ')' : '') }}</td>
|
||
<td class="text-center">{{ $detail->quantities }}</td>
|
||
@usercan('purchases.price')
|
||
<td class="text-center">
|
||
{{ currency_format($detail->productPurchasePrice, currency: business_currency()) }}
|
||
</td>
|
||
@endusercan
|
||
<td class="text-center">
|
||
{{ currency_format($productTotal, currency: business_currency()) }}
|
||
</td>
|
||
</tr>
|
||
@endforeach
|
||
</tbody>
|
||
</table>
|
||
|
||
<table width="100%" style="margin-top:15px;">
|
||
<tr>
|
||
<!-- LEFT SIDE -->
|
||
<td width="60%" valign="top">
|
||
<table width="100%">
|
||
<tbody>
|
||
<tr>
|
||
<td style="padding-bottom:8px;">
|
||
{{ amountInWords($subtotal) }}
|
||
</td>
|
||
</tr>
|
||
<tr>
|
||
<td style="padding-bottom:8px;">
|
||
{{ __('Paid by') }} :
|
||
{{ $transactionTypes ?? ($purchase->payment_type_id ? ($purchase->payment_type->name ?? '') : ($purchase->paymentType ?? '')) }}
|
||
</td>
|
||
</tr>
|
||
@if ((get_business_option('business-settings')['show_note'] ?? 0) == 1)
|
||
<tr>
|
||
<td style="padding-top:5px;">
|
||
{{ get_business_option('business-settings')['note'] ?? '' }}
|
||
</td>
|
||
</tr>
|
||
@endif
|
||
|
||
</tbody>
|
||
</table>
|
||
|
||
{{-- BANK DETAILS --}}
|
||
@if (($bank_detail->show_in_invoice ?? 0) == 1)
|
||
<table style="margin-top:10px; border:1px solid #ccc;" cellspacing="0" cellpadding="5">
|
||
<tr>
|
||
<td colspan="2" style="font-weight:bold; background:#f5f5f5;">
|
||
{{ __('Bank Details') }}
|
||
</td>
|
||
</tr>
|
||
<tr>
|
||
<td width="40%">{{ __('Name') }}</td>
|
||
<td width="60%">: {{ $bank_detail->name }}</td>
|
||
</tr>
|
||
<tr>
|
||
<td>{{ __('Account No') }}</td>
|
||
<td>: {{ $bank_detail->meta['account_number'] ?? '' }}</td>
|
||
</tr>
|
||
<tr>
|
||
<td>{{ __('UPI ID') }}</td>
|
||
<td>: {{ $bank_detail->meta['upi_id'] ?? '' }}</td>
|
||
</tr>
|
||
<tr>
|
||
<td>{{ __('Holder’s Name') }}</td>
|
||
<td>: {{ $bank_detail->meta['account_holder'] ?? '' }}</td>
|
||
</tr>
|
||
</table>
|
||
@endif
|
||
</td>
|
||
|
||
<!-- RIGHT SIDE -->
|
||
<td width="40%" valign="top" align="right">
|
||
<table width="100%">
|
||
<tbody>
|
||
<tr>
|
||
<td class="text-right">{{ __('Subtotal') }}</td>
|
||
<td class="text-right">{{ currency_format($subtotal, currency: business_currency()) }}</td>
|
||
</tr>
|
||
<tr>
|
||
<td class="text-right">{{ __('Vat') }}</td>
|
||
<td class="text-right">
|
||
{{ currency_format($purchase->vat_amount, currency: business_currency()) }}</td>
|
||
</tr>
|
||
<tr>
|
||
<td class="text-right">{{ __('Shipping Charge') }}</td>
|
||
<td class="text-right">
|
||
{{ currency_format($purchase->shipping_charge, currency: business_currency()) }}</td>
|
||
</tr>
|
||
<tr>
|
||
<td class="text-right">{{ __('Discount') }}</td>
|
||
<td class="text-right">
|
||
{{ currency_format($purchase->discountAmount, currency: business_currency()) }}</td>
|
||
</tr>
|
||
<tr>
|
||
<td class="text-right"><strong>{{ __('Total Amount') }}</strong></td>
|
||
<td class="text-right">
|
||
<strong>{{ currency_format($purchase->totalAmount, currency: business_currency()) }}</strong>
|
||
</td>
|
||
</tr>
|
||
<tr>
|
||
<td class="text-right">{{ __('Total Return Amount') }}</td>
|
||
<td class="text-right">
|
||
{{ currency_format($returnTotal ?? 0, currency: business_currency()) }}</td>
|
||
</tr>
|
||
<tr>
|
||
<td class="text-right">{{ __('Payable Amount') }}</td>
|
||
<td class="text-right">
|
||
{{ currency_format($purchase->totalAmount, currency: business_currency()) }}</td>
|
||
</tr>
|
||
<tr>
|
||
<td class="text-right">{{ __('Paid Amount') }}</td>
|
||
<td class="text-right">
|
||
{{ currency_format($purchase->paidAmount, currency: business_currency()) }}</td>
|
||
</tr>
|
||
<tr>
|
||
<td class="text-right">{{ __('Due') }}</td>
|
||
<td class="text-right">
|
||
{{ currency_format($purchase->dueAmount, currency: business_currency()) }}</td>
|
||
</tr>
|
||
</tbody>
|
||
</table>
|
||
</td>
|
||
</tr>
|
||
</table>
|
||
|
||
|
||
<div style="clear: both;"></div>
|
||
|
||
{{-- RETURN TABLE --}}
|
||
@if (!$purchase_returns->isEmpty())
|
||
<div class="return-title">{{ __('Returned Items') }}</div>
|
||
<table class="item-table">
|
||
<thead>
|
||
<tr>
|
||
<th>{{ __('SL') }}</th>
|
||
<th>{{ __('Date') }}</th>
|
||
<th>{{ __('Returned Item') }}</th>
|
||
<th>{{ __('Quantity') }}</th>
|
||
<th>{{ __('Total Amount') }}</th>
|
||
</tr>
|
||
</thead>
|
||
<tbody>
|
||
@php $total_return_amount = 0; @endphp
|
||
@foreach ($purchase_returns as $return)
|
||
@foreach ($return->details as $detail)
|
||
@php $total_return_amount += $detail->return_amount ?? 0; @endphp
|
||
<tr>
|
||
<td class="text-center">{{ $loop->iteration }}</td>
|
||
<td class="text-center">{{ formatted_date($return->return_date) }}</td>
|
||
<td class="text-center">
|
||
{{ $detail->purchaseDetail->product->productName ?? '' }}
|
||
{{ $detail->purchaseDetail?->stock?->batch_no ? '(' . $detail->purchaseDetail?->stock?->batch_no . ')' : '' }}
|
||
</td>
|
||
<td class="text-center">{{ $detail->return_qty }}</td>
|
||
<td class="text-center">
|
||
{{ currency_format($detail->return_amount, currency: business_currency()) }}
|
||
</td>
|
||
</tr>
|
||
@endforeach
|
||
@endforeach
|
||
</tbody>
|
||
</table>
|
||
|
||
<table width="100%" style="margin-top:15px;">
|
||
<tr>
|
||
<td>{{ amountInWords($total_return_amount) }}</td>
|
||
</tr>
|
||
<tr>
|
||
<!-- LEFT SIDE -->
|
||
<td width="60%" valign="top">
|
||
{{ __('Paid by') }} :
|
||
{{ $returnTransactionType ?? $purchase->paymentType ?? '' }}
|
||
</td>
|
||
|
||
<!-- RIGHT SIDE -->
|
||
<td width="40%" valign="top" align="right">
|
||
<table width="100%">
|
||
<tbody>
|
||
<tr>
|
||
<td align="right">{{ __('Total Return Amount') }}</td>
|
||
<td align="right">:</td>
|
||
<td align="right">{{ currency_format($total_return_amount, currency: business_currency()) }}</td>
|
||
</tr>
|
||
<tr>
|
||
<td align="right">{{ __('Payable Amount') }}</td>
|
||
<td align="right">:</td>
|
||
<td align="right">{{ currency_format($purchase->totalAmount, currency: business_currency()) }}</td>
|
||
</tr>
|
||
<tr>
|
||
<td align="right">{{ __('Paid Amount') }} </td>
|
||
<td align="right">:</td>
|
||
<td align="right">{{ currency_format($purchase->paidAmount, currency: business_currency()) }}</td>
|
||
</tr>
|
||
<tr>
|
||
<td align="right">{{ __('Due') }} </td>
|
||
<td align="right">:</td>
|
||
<td align="right">{{ currency_format($purchase->dueAmount, currency: business_currency()) }}</td>
|
||
</tr>
|
||
</tbody>
|
||
</table>
|
||
</td>
|
||
</tr>
|
||
</table>
|
||
@endif
|
||
|
||
{{-- PAYMENT INFO --}}
|
||
|
||
<div style="clear: both;"></div>
|
||
|
||
|
||
{{-- SIGNATURE --}}
|
||
<table class="footer-table">
|
||
<tr>
|
||
<td class="signature">
|
||
<div class="" style="border-top: 1px solid black">
|
||
{{ __('Customer Signature') }}
|
||
</div>
|
||
</td>
|
||
<td></td>
|
||
<td class="signature-2">
|
||
<div style="border-top: 1px solid black;">
|
||
{{ __('Authorized Signature') }}
|
||
</div>
|
||
</td>
|
||
</tr>
|
||
</table>
|
||
|
||
{{-- WARRANTY --}}
|
||
@if ((get_business_option('business-settings')['show_warranty'] ?? 0) == 1)
|
||
<div class="warranty-box">
|
||
@if ((get_business_option('business-settings')['show_warranty'] ?? 0) == 1)
|
||
<strong>{{ get_business_option('business-settings')['warranty_void_label'] ?? '' }} - </strong>
|
||
@endif
|
||
{{ get_business_option('business-settings')['warranty_void'] ?? '' }}
|
||
</div>
|
||
@endif
|
||
|
||
</div>
|
||
@endsection
|