142 lines
4.8 KiB
PHP
142 lines
4.8 KiB
PHP
@use(App\Models\Invoice)
|
|
@use(Carbon\CarbonInterface)
|
|
|
|
@php($c=$o->product)
|
|
|
|
<!-- $o=Service::class, $p=Product::class -->
|
|
<table class="table table-sm">
|
|
<thead>
|
|
<tr>
|
|
<th> </th>
|
|
<th class="text-center" colspan="2">This Plan</th>
|
|
<th> </th>
|
|
@if($p->exists)
|
|
<th class="text-center" colspan="2">Proposed Plan</th>
|
|
<th> </th>
|
|
@endif
|
|
</tr>
|
|
<tr>
|
|
<th> </th>
|
|
<th>Client</th>
|
|
<th>Supplier</th>
|
|
<th> </th>
|
|
@if($p->exists)
|
|
<th>Client</th>
|
|
<th>Supplier</th>
|
|
<th> </th>
|
|
@endif
|
|
</tr>
|
|
</thead>
|
|
|
|
<tbody>
|
|
<tr>
|
|
<th>Product</th>
|
|
<td><a href="{{ url('a/product/details',$o->product_id) }}">#{{ $o->product_id }}: {{ $o->product->name }}</a></td>
|
|
<td><a href="{{ url('a/product/details',$c->id) }}">#{{ $c->supplied->id }}: {{ $c->supplied->name_long }}</a></td>
|
|
@if($p->exists)
|
|
<th> </th>
|
|
<td class="text-center" colspan="2">#{{ $p->supplied->id }}: {{ $p->supplied->name_long }}</td>
|
|
@endif
|
|
<td>{{ $c->category_name }}</td>
|
|
</tr>
|
|
|
|
<tr>
|
|
<th>Setup</th>
|
|
<td>${{ number_format($b=$o->account->taxed($c->setup_charge),2) }}</td>
|
|
<td>${{ number_format($a=$o->account->taxed($c->setup_cost),2) }}</td>
|
|
<td>{!! markup($a,$b) !!}</td>
|
|
@if($p->exists)
|
|
<td>${{ number_format($b=$o->account->taxed($p->setup_charge),2) }}</td>
|
|
<td>${{ number_format($a=$o->account->taxed($p->setup_cost),2) }}</td>
|
|
<td>{!! markup($a,$b) !!}</td>
|
|
@endif
|
|
</tr>
|
|
|
|
<tr>
|
|
<th>Billed</th>
|
|
<td>{{ $o->billing_interval_string }}</td>
|
|
<td>{{ $c->type->billing_interval_string }}</td>
|
|
<td> </td>
|
|
@if($p->exists)
|
|
<td>{{ $o->billing_interval_string }}</td>
|
|
<td>{{ $p->type->billing_interval_string }}</td>
|
|
<td> </td>
|
|
@endif
|
|
</tr>
|
|
|
|
<tr>
|
|
<th>Billing Price</th>
|
|
<td @if($o->isChargeOverridden())class="text-danger"@endif>${{ number_format($b=$o->billing_charge,2) }}</td>
|
|
<td>${{ number_format($a=$o->account->taxed($c->base_cost),2) }}</td>
|
|
<td>{!! markup($a,$b) !!}</td>
|
|
@if($p->exists)
|
|
<td @if($o->isChargeOverridden())class="text-danger"@endif>${{ number_format($b=$o->account->taxed($p->base_charge),2) }}</td>
|
|
<td>${{ number_format($a=$o->account->taxed($p->base_cost),2) }}</td>
|
|
<td>{!! markup($a,$b) !!}</td>
|
|
@endif
|
|
</tr>
|
|
|
|
<tr>
|
|
<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)*Invoice::billing_change($o->billing_interval,Invoice::BILL_MONTHLY),2) }}">${{ number_format($b=$o->billing_charge_normalised,2) }}
|
|
@else
|
|
${{ number_format($b=$o->billing_charge_normalised,2) }}
|
|
@endif
|
|
</td>
|
|
<td @if($x=$o->isCostOverridden()) class="text-danger" @endif>
|
|
@if($x)
|
|
<abbr title="${{ number_format($a=$o->account->taxed($c->base_cost)*Invoice::billing_change($o->billing_interval,Invoice::BILL_MONTHLY),2) }}">${{ number_format($b=$o->billing_cost_normalised,2) }}
|
|
@else
|
|
${{ number_format($o->billing_cost_normalised,2) }}
|
|
@endif
|
|
</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)*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>
|
|
|
|
<tr>
|
|
<th>Contract</th>
|
|
<td>{{ $o->contract_term }} months</td>
|
|
<td>{{ $c->supplied->contract_term }} months</td>
|
|
<td> </td>
|
|
@if($p->exists)
|
|
<td>{{ $p->contract_term }} months</td>
|
|
<td>{{ $p->supplied->contract_term }} months</td>
|
|
<td> </td>
|
|
@endif
|
|
</tr>
|
|
|
|
<tr>
|
|
<th>Min Price</th>
|
|
<!-- @todo change this to $o->min_charge when implemented -->
|
|
<td>${{ number_format($b=$o->account->taxed($o->product->min_charge),2) }}</td>
|
|
<td>${{ number_format($a=$o->account->taxed($c->supplied->min_cost),2) }}</td>
|
|
<td>{!! markup($a,$b) !!}</td>
|
|
|
|
@if($p->exists)
|
|
<td>${{ number_format($a=$o->account->taxed($p->min_charge),2) }}</td>
|
|
<td>${{ number_format($a=$o->account->taxed($p->supplied->min_cost ?? 0),2) }}</td>
|
|
<td>{!! markup($a,$b) !!}</td>
|
|
@endif
|
|
</tr>
|
|
|
|
<tr>
|
|
<th>Contract Left</th>
|
|
@if($o->isContract())
|
|
<td>${{ number_format($o->billing_charge_to($o->contract_end),2) }} (<small>{{ $o->paid_to->format('Y-m-d') }}</small>)</td>
|
|
<td>${{ number_format($o->billing_cost_to($o->contract_end),2) }} (<small>{{ $o->invoiced_to->format('Y-m-d') }}</small>)</td>
|
|
<td>{{ $o->contract_end->format('Y-m-d') }}<br><small>({{ $o->contract_end->diffForHumans(now(),CarbonInterface::DIFF_RELATIVE_TO_OTHER,FALSE,2) }} today)</small></td>
|
|
|
|
@else
|
|
<td colspan="2" class="text-center">Not on contract</td>
|
|
<td> </td>
|
|
@endif
|
|
</tr>
|
|
</tbody>
|
|
</table> |