Rework service, removed redundant code, service invoicing improvements

This commit is contained in:
2024-07-29 23:12:53 +10:00
parent 5f10175b35
commit 0b5bc9e012
29 changed files with 474 additions and 523 deletions

View File

@@ -8,11 +8,11 @@
</div>
@endif
<div class="card-header bg-light">
<div class="card-header bg-light p-2">
<h3 class="card-title">Service Information</h3>
</div>
<div class="card-body bg-light">
<div class="card-body p-2">
<table class="table table-sm">
<tr>
<th>Account</th>
@@ -28,7 +28,7 @@
<td>{{ $o->order_info_reference ?? '' }}</td>
</tr>
@endif
@if($o->start_at AND $o->isPending())
@if($o->start_at && $o->isPending())
<tr>
<th>Pending Connection</th>
<td>{{ $o->start_at->format('Y-m-d') }}</td>
@@ -47,10 +47,10 @@
<td>${{ number_format($o->billing_charge,2) }}</td>
@endif
</tr>
@if($o->active && $o->invoice_to)
@if($o->isActive() && $o->invoiced_to)
<tr>
<th>Invoiced To</th>
<td>{{ $o->invoice_to->format('Y-m-d') }}</td>
<td>{{ $o->invoiced_to->format('Y-m-d') }}</td>
</tr>
@if($o->paid_to)
<tr>
@@ -59,14 +59,16 @@
</tr>
@endif
@endif
@if($o->status !== 'cancel-pending')
<tr>
<th>Next Invoice</th>
<td>@if($o->suspend_billing)<del>@endif{{ $o->invoice_next->format('Y-m-d') }}@if($o->suspend_billing)</del> <strong>SUSPENDED</strong>@endif</td>
</tr>
<tr>
<th>Next Estimated Invoice</th>
<td>${{ number_format($o->next_invoice_items(TRUE)->sum('total'),2) }} <sup>*</sup></td>
<td>${{ number_format($o->next_invoice_items()->sum('total'),2) }} <sup>*</sup></td>
</tr>
@endif
<tr>
<th>Payment Method</th>
<td>@if($o->billing)Direct Debit @else Invoice @endif</td>

View File

@@ -1,5 +1,7 @@
<!-- $o=Service::class, $p=Product::class -->
@use(App\Models\Invoice)
@php($c=$o->product)
<!-- $o=Service::class, $p=Product::class -->
<table class="table table-sm">
<thead>
<tr>
@@ -75,16 +77,16 @@
<th>Monthly Price</th>
<td @if($x=$o->isChargeOverridden()) class="text-danger" @endif>
@if($x)
<abbr title="${{ number_format($b=$o->account->taxed($c->base_charge)*\App\Models\Invoice::billing_change($o->billing_interval,\App\Models\Invoice::BILL_MONTHLY),2) }}">${{ number_format($b=$o->billing_monthly_price,2) }}
<abbr title="${{ number_format($b=$o->account->taxed($c->base_charge)*Invoice::billing_change($o->billing_interval,Invoice::BILL_MONTHLY),2) }}">${{ number_format($b=$o->billing_charge_normalised,2) }}
@else
{{ number_format($b=$o->account->taxed($c->base_charge)*\App\Models\Invoice::billing_change($o->billing_interval,\App\Models\Invoice::BILL_MONTHLY),2) }}
{{ number_format($b=$o->billing_charge_normalised,2) }}
@endif
</td>
<td>${{ number_format($a=$o->account->taxed($c->base_cost)*\App\Models\Invoice::billing_change($o->billing_interval,\App\Models\Invoice::BILL_MONTHLY),2) }}</td>
<td>${{ number_format($a=$o->account->taxed($c->base_cost)*Invoice::billing_change($o->billing_interval,Invoice::BILL_MONTHLY),2) }}</td>
<td>{!! markup($a,$b) !!}</td>
@if($p->exists)
<td @if($x=$o->isChargeOverridden()) class="text-danger" @endif>${{ number_format($b=$o->account->taxed($p->base_charge)*\App\Models\Invoice::billing_change($o->billing_interval,\App\Models\Invoice::BILL_MONTHLY),2) }}</td>
<td>${{ number_format($a=$o->account->taxed($p->base_cost)*\App\Models\Invoice::billing_change($o->billing_interval,\App\Models\Invoice::BILL_MONTHLY),2) }}</td>
<td @if($x=$o->isChargeOverridden()) class="text-danger" @endif>${{ number_format($b=$o->account->taxed($p->base_charge)*Invoice::billing_change($o->billing_interval,Invoice::BILL_MONTHLY),2) }}</td>
<td>${{ number_format($a=$o->account->taxed($p->base_cost)*Invoice::billing_change($o->billing_interval,Invoice::BILL_MONTHLY),2) }}</td>
<td>{!! markup($a,$b) !!}</td>
@endif
</tr>

View File

@@ -1,6 +1,6 @@
<table class="table">
<tr>
<th colspan="3">{{ $o->name }}</th><th class="text-right">${{ number_format(($x=$o->next_invoice_items(TRUE))->sum('total'),2) }}</th>
<th colspan="3">{{ $o->name }}</th><th class="text-right">${{ number_format(($x=$o->next_invoice_items())->sum('total'),2) }}</th>
</tr>
@foreach ($x as $io)