Optimise Invoice
This commit is contained in:
@@ -1,3 +1,7 @@
|
||||
@php
|
||||
use App\Models\{Checkout,Service};
|
||||
@endphp
|
||||
|
||||
<!-- $o = Invoice::class -->
|
||||
@extends('adminlte::layouts.app')
|
||||
|
||||
@@ -49,7 +53,7 @@
|
||||
{!! $o->account->address->join('<br>') !!}
|
||||
<br><br>
|
||||
<strong>Email:</strong> {{ $o->account->user->email }}<br>
|
||||
@if ($o->account->phone)
|
||||
@if($o->account->phone)
|
||||
<strong>Phone:</strong> {{ $o->account->phone }}<br>
|
||||
@endif
|
||||
</address>
|
||||
@@ -58,7 +62,7 @@
|
||||
<div class="ml-auto col-3">
|
||||
<table class="table table-borderless text-right" style="font-size: 1.1rem;">
|
||||
<tr >
|
||||
<td class="p-0">Issue Date:</td><td class="p-0"><strong>{{ $o->invoice_date->format('Y-m-d') }}</strong></td>
|
||||
<td class="p-0">Issue Date:</td><td class="p-0"><strong>{{ $o->created_at->format('Y-m-d') }}</strong></td>
|
||||
</tr>
|
||||
<tr >
|
||||
<td class="p-0">Account:</td><td class="p-0"><strong>{{ $o->account->sid }}</strong></td>
|
||||
@@ -70,12 +74,12 @@
|
||||
<td class="p-0">Payment Due:</td><td class="p-0"><strong>{{ $o->due_at->format('Y-m-d') }}</strong></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="p-0">This Invoice Due:</td><td class="p-0"><strong>${{ number_format($o->total,$o->currency()->rounding) }}</strong></td>
|
||||
<td class="p-0">This Invoice Due:</td><td class="p-0"><strong>${{ number_format($o->total,2) }}</strong></td>
|
||||
</tr>
|
||||
{{--
|
||||
<!-- @todo -->
|
||||
<tr>
|
||||
<td class="p-0">Total Account Due:</td><td class="p-0"><strong>${{ number_format($o->account->due,$o->currency()->rounding) }}</strong></td>
|
||||
<td class="p-0">Total Account Due:</td><td class="p-0"><strong>${{ number_format($o->account->due,2) }}</strong></td>
|
||||
</tr>
|
||||
--}}
|
||||
</table>
|
||||
@@ -97,29 +101,29 @@
|
||||
</thead>
|
||||
|
||||
<tbody>
|
||||
@foreach ($o->products() as $po)
|
||||
@foreach($o->summary_products() as $item)
|
||||
<tr id="invoice-services">
|
||||
<td>{{ $po->count }}</td>
|
||||
<td>#{{ $po->lid }}</td>
|
||||
<td colspan="2">{{ $po->name }}</td>
|
||||
<td colspan="3" class="text-right">${{ number_format($o->items->filter(function($item) use ($po) {return $item->product_id == $po->id; })->sum('total'),$o->currency()->rounding) }}</td>
|
||||
<td>{{ $item['services']->count() }}</td>
|
||||
<td>#{{ $item['product']->lid }}</td>
|
||||
<td colspan="2">{{ $item['product']->name }}</td>
|
||||
<td colspan="3" class="text-right">${{ number_format($item['total'],2) }}</td>
|
||||
</tr>
|
||||
|
||||
@foreach ($o->product_services($po) as $so)
|
||||
<tr id="invoice-service-items" class="invoice-services @if($o->products()->count() > 1) d-print-table-row @endif">
|
||||
@foreach(Service::whereIn('id',$item['services'])->get() as $so)
|
||||
<tr id="invoice-service-items" class="invoice-services @if($item['services']->count() > 1) d-print-table-row @endif">
|
||||
<td colspan="2"> </td>
|
||||
<td colspan="2">Service: <strong>{{ $so->sid }}: [{{ $so->name }}]</strong></td>
|
||||
<td> </td>
|
||||
<td class="text-right">${{ number_format($o->product_service_items($po,$so)->sum('total'),$o->currency()->rounding) }}</td>
|
||||
<td class="text-right">${{ number_format($o->product_service_items($item['product'],$so)->sum('total'),2) }}</td>
|
||||
<td> </td>
|
||||
</tr>
|
||||
|
||||
@foreach ($o->product_service_items($po,$so) as $io)
|
||||
@foreach($o->product_service_items($item['product'],$so) as $io)
|
||||
<tr class="invoice-service-items d-print-table-row">
|
||||
<td colspan="2"> </td>
|
||||
<td width="5%"> </td>
|
||||
<td>{{ $io->item_type_name }}</td>
|
||||
<td class="text-right">${{ number_format($io->total,$o->currency()->rounding) }}</td>
|
||||
<td class="text-right">${{ number_format($io->total,2) }}</td>
|
||||
<td colspan="2"> </td>
|
||||
</tr>
|
||||
@endforeach
|
||||
@@ -141,18 +145,18 @@
|
||||
<p class="lead">Payment Methods:</p>
|
||||
|
||||
<table class="table table-borderless">
|
||||
@foreach (\App\Models\Checkout::available() as $cho)
|
||||
<tr>
|
||||
<td style="width: 50px;"><i class="fa-2x fa-fw {{ $cho->icon }}"></i></td>
|
||||
<td>{{ $cho->name }}</td>
|
||||
<td>{{ $cho->description }}</td>
|
||||
<td class="w-25">@includeIf('theme.backend.adminlte.payment.widget.plugin.'.strtolower($cho->plugin),['o'=>$cho])</td>
|
||||
</tr>
|
||||
@endforeach
|
||||
@foreach(Checkout::available() as $cho)
|
||||
<tr>
|
||||
<td style="width: 50px;"><i class="fa-2x fa-fw {{ $cho->icon }}"></i></td>
|
||||
<td>{{ $cho->name }}</td>
|
||||
<td>{{ $cho->description }}</td>
|
||||
<td class="w-25">@includeIf('theme.backend.adminlte.payment.widget.plugin.'.strtolower($cho->plugin),['o'=>$cho])</td>
|
||||
</tr>
|
||||
@endforeach
|
||||
</table>
|
||||
|
||||
<p class="text-muted well well-sm no-shadow" style="position: absolute;bottom: 0;left: 0;">
|
||||
{!! $o->invoice_text !!}
|
||||
{{ config('osb.invoice_text') }}
|
||||
</p>
|
||||
</div>
|
||||
|
||||
@@ -161,12 +165,12 @@
|
||||
<table class="table">
|
||||
<tr>
|
||||
<th colspan="3" style="width:50%">Subtotal:</th>
|
||||
<td colspan="2" class="text-right">${{ number_format($o->sub_total,$o->currency()->rounding) }}</td>
|
||||
<td colspan="2" class="text-right">${{ number_format($o->sub_total,2) }}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th> </th>
|
||||
<th>Tax (GST 10%)</th>
|
||||
<td colspan="2" class="text-right">${{ number_format($o->total_tax,$o->currency()->rounding) }}</td>
|
||||
<td colspan="2" class="text-right">${{ number_format($o->tax_total,2) }}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th> </th>
|
||||
@@ -176,23 +180,23 @@
|
||||
</tr>
|
||||
<tr>
|
||||
<th colspan="2">Total:</th>
|
||||
<td colspan="2" class="text-right">${{ number_format($o->total,$o->currency()->rounding) }}</td>
|
||||
<td colspan="2" class="text-right">${{ number_format($o->total,2) }}</td>
|
||||
</tr>
|
||||
@if($o->id)
|
||||
<tr>
|
||||
<th> </th>
|
||||
<th>Payments To Clear:</th>
|
||||
<td colspan="2" class="text-right">${{ number_format($o->paid_pending,$o->currency()->rounding) }}</td>
|
||||
<td colspan="2" class="text-right">${{ number_format($o->paid_pending,2) }}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th> </th>
|
||||
<th>Payments:</th>
|
||||
<td>#{{ $o->payments->pluck('id')->join(', #') }}</td>
|
||||
<td class="text-right">${{ number_format($o->paid,$o->currency()->rounding) }}</td>
|
||||
<td>#{{ $o->payment_items_active->pluck('payment_id')->join(', #') }}</td>
|
||||
<td class="text-right">${{ number_format($o->paid,2) }}</td>
|
||||
</tr>
|
||||
<tr style="font-size: 145%">
|
||||
<th colspan="2">Invoice Due:</th>
|
||||
<td colspan="2" class="text-right">${{ number_format($o->due,$o->currency()->rounding) }}</td>
|
||||
<td colspan="2" class="text-right">${{ number_format($o->due,2) }}</td>
|
||||
</tr>
|
||||
@endif
|
||||
</table>
|
||||
|
Reference in New Issue
Block a user