<!-- $o = Service::class -->
<table class="table table-sm">
	<thead>
	<tr>
		<th>&nbsp;</th>
		<th>{{ $o->product->type->supplied->supplier_detail->supplier->name }}</th>
		<th>Us</th>
		<th>&nbsp;</th>
	</tr>
	</thead>

	<tbody>
    <tr>
        <th>Product</th>
		<td>#{{ ($s=$o->product->type->supplied)->id }}: {{ $s->name }}</td>
		<td>#{{ $o->product->id }}: {{ $o->product->name }}</td>
		<td>{{ $s->type }}</td>
    </tr>
	<tr>
		<th>Setup</th>
		<td>${{ number_format($a=\App\Models\Tax::tax_calc($s->setup_cost,$o->account->taxes),2) }}</td>
		<td>${{ number_format($b=\App\Models\Tax::tax_calc($o->product->setup_charge,$o->account->taxes),2) }}</td>
		<td>
			@if ($a > $b)
				<span class="badge bg-danger>">({{ number_format($a ? ($b-$a)/($b ?: 1)*100 : 100,1) }})%</span>
			@else
				<span class="badge">{{ number_format($a ? ($b-$a)/($b ?: 1)*100 : ($b ? 100: 0),1) }}%</span>
			@endif
		</td>
	</tr>
	<tr>
		<th>Billed</th>
		<td>{{ $s->billing_interval_string }}</td>
		<td>{{ $o->product->billing_interval_string }}</td>
		<td>&nbsp;</td>
	</tr>
	<tr>
		<th>Billing Charge</th>
		<td>${{ number_format($a=\App\Models\Tax::tax_calc($s->base_cost*\App\Models\Invoice::billing_change($s->billing_interval,$o->product->billing_interval),$o->account->taxes),2) }}</td>
		<td>${{ number_format($b=\App\Models\Tax::tax_calc($o->product->getBaseChargeAttribute($o->billing_interval),$o->account->taxes),2) }}</td>
		<td>
			@if ($a > $b)
				<span class="badge bg-danger>">({{ number_format($a ? ($b-$a)/($b ?: 1)*100 : 100,1) }})%</span>
			@else
				<span class="badge">{{ number_format($a ? ($b-$a)/($b ?: 1)*100 : ($b ? 100: 0),1) }}%</span>
			@endif
		</td>
	</tr>
	<tr>
		<th>Monthly Cost</th>
		<td>${{ number_format($a=\App\Models\Tax::tax_calc($s->base_cost*\App\Models\Invoice::billing_change($s->billing_interval,1),$o->account->taxes),2) }}</td>
		<td>${{ number_format($b=\App\Models\Tax::tax_calc($o->product->getBaseChargeAttribute($o->billing_interval)*\App\Models\Invoice::billing_change($o->billing_interval,1),$o->account->taxes),2) }}</td>
		<td>
			@if ($a > $b)
				<span class="badge bg-danger>">({{ number_format($a ? ($b-$a)/($b ?: 1)*100 : 100,1) }})%</span>
			@else
				<span class="badge">{{ number_format($a ? ($b-$a)/($b ?: 1)*100 : ($b ? 100: 0),1) }}%</span>
			@endif
		</td>
	</tr>
	<tr>
		<th>Contract</th>
		<td>{{ $s->contract_term }} months</td>
		<td>{{ $o->product->contract_term }} months</td>
		<td>&nbsp;</td>
	</tr>
	<tr>
		<th>Min Cost</th>
		<td>${{ number_format($a=\App\Models\Tax::tax_calc($s->min_cost,$o->account->taxes),2) }}</td>
		<td>${{ number_format($b=\App\Models\Tax::tax_calc($o->product->getMinChargeAttribute($o->billing_interval),$o->account->taxes),2) }}</td>
		<td>
			@if ($a > $b)
				<span class="badge bg-danger>">({{ number_format($a ? ($b-$a)/($b ?: 1)*100 : 100,1) }})%</span>
			@else
				<span class="badge">{{ number_format($a ? ($b-$a)/($b ?: 1)*100 : ($b ? 100: 0),1) }}%</span>
			@endif
		</td>
	</tr>
	</tbody>
</table>