Added: POS Invoice

This commit is contained in:
Fahim 2021-08-15 02:01:53 +06:00
parent 528089dd3f
commit 3f6de174e5
4 changed files with 155 additions and 2 deletions

View File

@ -3,6 +3,9 @@
<i class="bi bi-three-dots-vertical"></i>
</button>
<div class="dropdown-menu">
<a target="_blank" href="{{ route('sales.pos.pdf', $data->id) }}" class="dropdown-item">
<i class="bi bi-file-earmark-pdf mr-2 text-success" style="line-height: 1;"></i> POS Invoice
</a>
@can('access_sale_payments')
<a href="{{ route('sale-payments.index', $data->id) }}" class="dropdown-item">
<i class="bi bi-cash-coin mr-2 text-warning" style="line-height: 1;"></i> Show Payments

View File

@ -0,0 +1,131 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<title></title>
<meta name="description" content="">
<meta name="viewport" content="width=device-width, initial-scale=1">
<style>
* {
font-size: 12px;
line-height: 18px;
font-family: 'Ubuntu', sans-serif;
}
h2 {
font-size: 16px;
}
td,
th,
tr,
table {
border-collapse: collapse;
}
tr {border-bottom: 1px dashed #ddd;}
td,th {padding: 7px 0;width: 50%;}
table {width: 100%;}
tfoot tr th:first-child {text-align: left;}
.centered {
text-align: center;
align-content: center;
}
small{font-size:11px;}
@media print {
* {
font-size:12px;
line-height: 20px;
}
td,th {padding: 5px 0;}
.hidden-print {
display: none !important;
}
tbody::after {
content: '';
display: block;
page-break-after: always;
page-break-inside: auto;
page-break-before: avoid;
}
}
</style>
</head>
<body>
<div style="max-width:400px;margin:0 auto">
<div id="receipt-data">
<div class="centered">
<h2 style="margin-bottom: 5px">{{ settings()->company_name }}</h2>
<p style="font-size: 11px;line-height: 15px;margin-top: 0">
{{ settings()->company_email }}, {{ settings()->company_phone }}
<br>{{ settings()->company_address }}
</p>
</div>
<p>
Date: {{ \Carbon\Carbon::parse($sale->date)->format('d M, Y') }}<br>
Reference: {{ $sale->reference }}<br>
Name: {{ $sale->customer_name }}
</p>
<table class="table-data">
<tbody>
@foreach($sale->saleDetails as $saleDetail)
<tr>
<td colspan="2">
{{ $saleDetail->product->product_name }}
({{ $saleDetail->quantity }} x {{ format_currency($saleDetail->price) }})
</td>
<td style="text-align:right;vertical-align:bottom">{{ format_currency($saleDetail->sub_total) }}</td>
</tr>
@endforeach
@if($sale->tax_percentage)
<tr>
<th colspan="2" style="text-align:left">Tax ({{ $sale->tax_percentage }}%)</th>
<th style="text-align:right">{{ format_currency($sale->tax_amount) }}</th>
</tr>
@endif
@if($sale->discount_percentage)
<tr>
<th colspan="2" style="text-align:left">Discount ({{ $sale->discount_percentage }}%)</th>
<th style="text-align:right">{{ format_currency($sale->discount_amount) }}</th>
</tr>
@endif
@if($sale->shipping_amount)
<tr>
<th colspan="2" style="text-align:left">Shipping</th>
<th style="text-align:right">{{ format_currency($sale->shipping_amount) }}</th>
</tr>
@endif
<tr>
<th colspan="2" style="text-align:left">Grand Total</th>
<th style="text-align:right">{{ format_currency($sale->total_amount) }}</th>
</tr>
</tbody>
</table>
<table>
<tbody>
<tr style="background-color:#ddd;">
<td class="centered" style="padding: 5px;">
Paid By: {{ $sale->payment_method }}
</td>
<td class="centered" style="padding: 5px;">
Amount: {{ format_currency($sale->paid_amount) }}
</td>
</tr>
<tr style="border-bottom: 0;">
<td class="centered" colspan="3">
<div style="margin-top: 10px;">
{!! \Milon\Barcode\Facades\DNS1DFacade::getBarcodeSVG($sale->reference, 'C128', 1, 25, 'black', false) !!}
</div>
</td>
</tr>
</tbody>
</table>
</div>
</div>
</body>
</html>

View File

@ -30,6 +30,20 @@ Route::group(['middleware' => 'auth'], function () {
return $pdf->stream('sale-'. $sale->reference .'.pdf');
})->name('sales.pdf');
Route::get('/sales/pos/pdf/{id}', function ($id) {
$sale = \Modules\Sale\Entities\Sale::findOrFail($id);
$pdf = \PDF::loadView('sale::print-pos', [
'sale' => $sale,
])->setPaper('a7')
->setOption('margin-top', 8)
->setOption('margin-bottom', 8)
->setOption('margin-left', 5)
->setOption('margin-right', 5);
return $pdf->stream('sale-'. $sale->reference .'.pdf');
})->name('sales.pos.pdf');
//Sales
Route::resource('sales', 'SaleController');

View File

@ -9,7 +9,12 @@
</div>
</div>
@endif
<div class="table-responsive-md">
<div class="table-responsive">
<div wire:loading.flex class="col-12 position-absolute justify-content-center align-items-center" style="top:0;right:0;left:0;bottom:0;background-color: rgba(255,255,255,0.5);z-index: 99;">
<div class="spinner-border text-primary" role="status">
<span class="sr-only">Loading...</span>
</div>
</div>
<table class="table table-bordered">
<thead>
<tr class="align-middle">
@ -31,7 +36,7 @@
<td class="align-middle">{{ $product['product_code'] ?? $product['product']['product_code'] }}</td>
<td class="align-middle text-center">
<span class="badge badge-info">
{{ $product['product_quantity'] ?? $product['product']['product_quantity'] }}
{{ $product['product_quantity'] ?? $product['product']['product_quantity'] }} {{ $product['product_unit'] ?? $product['product']['product_unit'] }}
</span>
</td>
<input type="hidden" name="product_ids[]" value="{{ $product['product']['id'] ?? $product['id'] }}">