Removed redundant functions from Invoice, optimised Invoice tables
This commit is contained in:
@@ -65,7 +65,7 @@
|
||||
<div class="input-group-prepend">
|
||||
<span class="input-group-text"><i class="fa fa-fw fa-calendar"></i></span>
|
||||
</div>
|
||||
<input type="date" class="form-control" name="date_start" value="{{ $o->service->date_start ? $o->service->date_start->format('Y-m-d') : '' }}">
|
||||
<input type="date" class="form-control" name="start_at" value="{{ $o->service->start_at ? $o->service->start_at->format('Y-m-d') : '' }}">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
@@ -3,7 +3,7 @@
|
||||
<thead>
|
||||
<tr>
|
||||
<th> </th>
|
||||
<th>{{ $o->product->type->supplied->supplier_detail->supplier->name }}</th>
|
||||
<th>{{ ($s=$o->supplied)->supplier_detail->supplier->name }}</th>
|
||||
<th>Us</th>
|
||||
<th> </th>
|
||||
</tr>
|
||||
@@ -12,7 +12,7 @@
|
||||
<tbody>
|
||||
<tr>
|
||||
<th>Product</th>
|
||||
<td>#{{ ($s=$o->product->type->supplied)->id }}: {{ $s->name }}</td>
|
||||
<td>#{{ $s->id }}: {{ $s->name }}</td>
|
||||
<td>#{{ $o->product->id }}: {{ $o->product->name }}</td>
|
||||
<td>{{ $s->type }}</td>
|
||||
</tr>
|
||||
@@ -20,61 +20,45 @@
|
||||
<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>
|
||||
<td>{!! markup($a,$b) !!}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>Billed</th>
|
||||
<td>{{ $s->billing_interval_string }}</td>
|
||||
<td>{{ $o->product->billing_interval_string }}</td>
|
||||
<td>{{ $o->billing_interval_string }}</td>
|
||||
<td> </td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>Billing Charge</th>
|
||||
<th>Billing Price</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>
|
||||
<td>${{ number_format($b=$o->billing_charge,2) }}</td>
|
||||
<td>{!! markup($a,$b) !!}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>Monthly Cost</th>
|
||||
<th>Monthly Price</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>
|
||||
<td>${{ number_format($b=$o->billing_monthly_price,2) }}</td>
|
||||
<td>{!! markup($a,$b) !!}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>Contract</th>
|
||||
<td>{{ $s->contract_term }} months</td>
|
||||
<td>{{ $o->product->contract_term }} months</td>
|
||||
<td>{{ $o->contract_term }} months</td>
|
||||
<td> </td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>Min Cost</th>
|
||||
<th>Min Price</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>
|
||||
<td>{!! markup($a,$b) !!}</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</table>
|
||||
|
||||
@php
|
||||
function markup($a,$b) {
|
||||
return ($a > $b)
|
||||
? sprintf('<span class="badge bg-danger>">(%3.1f%%)</span>',$a ? ($b-$a)/($b ?: 1)*100 : 100)
|
||||
: sprintf('<span class="badge">%3.1f%%</span>',$a ? ($b-$a)/($b ?: 1)*100 : ($b ? 100: 0));
|
||||
}
|
||||
@endphp
|
Reference in New Issue
Block a user