Fixes to cost display

This commit is contained in:
Deon George 2022-06-14 17:23:14 +10:00
parent 8ba6a93214
commit b0a317d709

View File

@ -46,11 +46,11 @@
<td>{{ $o->broadbands->max('end_at')->format('Y-m-d') }}</td>
<td class="text-right">${{ number_format($a=$o->broadbands->sum('base'),2) }}</td>
<td class="text-right">${{ number_format($o->broadbands->sum('excess'),2) }}</td>
<td class="text-right">${{ number_format($o->broadbands->sum('cost'),2) }}</td>
<td class="text-right">${{ number_format($x=$o->broadbands->sum('cost'),2) }}</td>
<td class="text-right">${{ number_format($b=$o->broadbands->sum('service.billing_monthly_price'),2) }}</td>
<td class="text-right {{ $b-$a < 0 ? 'text-danger' : '' }}">${{ number_format($b-$a,2) }}</td>
</tr>
@php($cost += $a)
@php($cost += $x)
@php($charge += $b)
@foreach ($o->broadbands->groupBy('service_broadband_id') as $oo)
@ -77,11 +77,11 @@
<td>{{ $o->phones->max('end_at')->format('Y-m-d') }}</td>
<td class="text-right">${{ number_format($a=$o->phones->sum('base'),2) }}</td>
<td class="text-right">${{ number_format($o->phones->sum('excess'),2) }}</td>
<td class="text-right">${{ number_format($o->phones->sum('cost'),2) }}</td>
<td class="text-right">${{ number_format($x=$o->phones->sum('cost'),2) }}</td>
<td class="text-right">${{ number_format($b=$o->phones->sum('service.billing_monthly_price'),2) }}</td>
<td class="text-right {{ $b-$a < 0 ? 'text-danger' : '' }}">${{ number_format($b-$a,2) }}</td>
</tr>
@php($cost += $a)
@php($cost += $x)
@php($charge += $b)
@foreach ($o->phones->groupBy('service_phone_id') as $oo)
@ -104,17 +104,16 @@
<td>Generic</td>
<td>&nbsp;</td>
<td>&nbsp;</td>
<td>{{ $o->generics->min('start_at')->format('Y-m-d') }}</td>
<td>{{ $o->generics->max('end_at')->format('Y-m-d') }}</td>
<td>{{ ($x=$o->generics)->count() ? $x->min('start_at')->format('Y-m-d') : '-' }}</td>
<td>{{ $x->count() ? $x->max('end_at')->format('Y-m-d') : '-' }}</td>
<td class="text-right">${{ number_format($a=$o->generics->sum('base'),2) }}</td>
<td class="text-right">${{ number_format($o->generics->sum('excess'),2) }}</td>
<td class="text-right">${{ number_format($o->generics->sum('cost'),2) }}</td>
<td class="text-right">${{ number_format($x=$o->generics->sum('cost'),2) }}</td>
<td class="text-right">$0.00</td>
<td class="text-right {{ 0-$a < 0 ? 'text-danger' : '' }}">${{ number_format(0-$a,2) }}</td>
</tr>
@php($cost += $a)
@php($charge += $b)
@php($cost += $x)
@foreach ($o->generics->groupBy('service_generic_id') as $oo)
<tr>