More Product Model optimisation
This commit is contained in:
@@ -29,13 +29,14 @@
|
||||
</thead>
|
||||
|
||||
<tbody>
|
||||
@foreach (\App\Models\Service::active()->get() as $o)
|
||||
{{-- @todo This query is expensive still --}}
|
||||
@foreach (\App\Models\Service::active()->with(['type','product.type.supplied.supplier_detail.supplier','product.translate'])->get() as $o)
|
||||
<tr>
|
||||
<td><a href="{{ url('u/service',[$o->id]) }}">{{ $o->id }}</a></td>
|
||||
<td>{{ $o->name }}</td>
|
||||
<td>{{ $o->product->name }}</td>
|
||||
<td class="text-right">{{ number_format($o->billing_monthly_price,2) }}</td>
|
||||
<td class="text-right">{{ number_format(\App\Models\Tax::tax_calc(($s=$o->supplied)->base_cost*\App\Models\Invoice::billing_change($s->billing_interval,1),$o->account->taxes),2) }}</td>
|
||||
<td class="text-right">{{ number_format($o->product->cost_normalized(),2) }}</td>
|
||||
<td class="text-right">{{ $o->category == 'broadband' ? number_format($o->type->usage_summary(0)->sum()/1000,1) : '-' }}</td>
|
||||
<td>{{ $o->product->supplier->name }}</td>
|
||||
</tr>
|
||||
|
@@ -27,13 +27,14 @@
|
||||
<tr>
|
||||
<th>Setup</th>
|
||||
@if ($s->exists)
|
||||
<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($p->setup_charge,$o->account->taxes),2) }}</td>
|
||||
<td>${{ number_format($a=$o->account->taxed($s->setup_cost),2) }}</td>
|
||||
<td>${{ number_format($b=$o->account->taxed($p->setup_charge),2) }}</td>
|
||||
<td>{!! markup($a,$b) !!}</td>
|
||||
@else
|
||||
<td>-</td>
|
||||
@endif
|
||||
</tr>
|
||||
{{--
|
||||
<tr>
|
||||
<th>Billed</th>
|
||||
@if ($s->exists)
|
||||
@@ -47,7 +48,7 @@
|
||||
<tr>
|
||||
<th>Billing Price</th>
|
||||
@if ($s->exists)
|
||||
<td>${{ number_format($a=\App\Models\Tax::tax_calc($s->base_cost*\App\Models\Invoice::billing_change($s->billing_interval,$p->billing_interval),$o->account->taxes),2) }}</td>
|
||||
<td>${{ number_format($a=$o->account->taxed($s->base_cost*\App\Models\Invoice::billing_change($s->billing_interval,$p->billing_interval)),2) }}</td>
|
||||
@endif
|
||||
<td>${{ number_format($b=$o->billing_charge,2) }}</td>
|
||||
@if ($s->exists)
|
||||
@@ -57,9 +58,9 @@
|
||||
<tr>
|
||||
<th>Monthly Price</th>
|
||||
@if ($s->exists)
|
||||
<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($a=$o->account->taxed($s->base_cost*\App\Models\Invoice::billing_change($s->billing_interval,1)),2) }}</td>
|
||||
@endif
|
||||
<td @if($x=$o->isChargeOverriden()) class="text-danger" @endif>${{ number_format($b=($x ? $p->base_charge_taxable : $o->billing_monthly_price),2) }}</td>
|
||||
<td @if($x=$o->isChargeOverriden()) class="text-danger" @endif>${{ number_format($b=($x ? $o->account->taxed($p->base_charge) : $o->billing_monthly_price),2) }}</td>
|
||||
@if ($s->exists)
|
||||
<td>{!! markup($a,$b) !!}</td>
|
||||
@endif
|
||||
@@ -77,12 +78,13 @@
|
||||
<tr>
|
||||
<th>Min Price</th>
|
||||
@if ($s->exists)
|
||||
<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($p->getMinChargeAttribute($o->billing_interval),$o->account->taxes),2) }}</td>
|
||||
<td>${{ number_format($a=$o->account->taxed($s->min_cost),2) }}</td>
|
||||
<td>${{ number_format($b=$o->account->taxed($p->getMinChargeAttribute($o->billing_interval)),2) }}</td>
|
||||
<td>{!! markup($a,$b) !!}</td>
|
||||
@else
|
||||
<td>-</td>
|
||||
@endif
|
||||
</tr>
|
||||
--}}
|
||||
</tbody>
|
||||
</table>
|
@@ -39,8 +39,8 @@
|
||||
<td>{{ $oo->name }}</td>
|
||||
<td>{{ $oo->name_long }}</td>
|
||||
<td class="text-right">{{ $oo->active ? 'YES' : 'NO' }}</td>
|
||||
<td class="text-right">{{ number_format($oo->setup_cost_taxable,2) }}</td>
|
||||
<td class="text-right">{{ number_format($oo->base_cost_taxable,2) }}</td>
|
||||
<td class="text-right">{{ number_format($site->taxed($oo->setup_cost),2) }}</td>
|
||||
<td class="text-right">{{ number_format($site->taxed($oo->base_cost),2) }}</td>
|
||||
<td class="text-right">{{ number_format($oo->products->count()) }}</td>
|
||||
<td class="text-right">{{ number_format($oo->products->pluck('products')->filter()->count()) }}</td>
|
||||
<td class="text-right">{{ number_format(($x=$oo->products->pluck('products')->flatten()->pluck('services')->flatten()->filter())->count()) }}</td>
|
||||
|
@@ -42,10 +42,10 @@
|
||||
<td>{{ $po->name }}</td>
|
||||
<td class="text-right">{{ $po->active ? 'YES' : 'NO' }}</td>
|
||||
<td class="text-right">{{ $po->billing_interval_string }}</td>
|
||||
<td class="text-right">{{ number_format($po->setup_cost_taxable,2) }}</td>
|
||||
<td class="text-right">{{ number_format($po->base_cost_taxable,2) }}</td>
|
||||
<td class="text-right">{{ number_format($po->setup_charge_taxable,2) }}</td>
|
||||
<td class="text-right">{{ number_format($po->base_charge_taxable,2) }}</td>
|
||||
<td class="text-right">{{ number_format($site->taxed($po->setup_cost),2) }}</td>
|
||||
<td class="text-right">{{ number_format($site->taxed($po->base_cost),2) }}</td>
|
||||
<td class="text-right">{{ number_format($site->taxed($po->setup_charge),2) }}</td>
|
||||
<td class="text-right">{{ number_format($site->taxed($po->base_charge),2) }}</td>
|
||||
<td class="text-right">{{ number_format($po->services->count()) }}</td>
|
||||
<td class="text-right">{{ number_format($po->services->where('active')->count()) }}</td>
|
||||
</tr>
|
||||
|
Reference in New Issue
Block a user