Rework service, removed redundant code, service invoicing improvements
This commit is contained in:
@@ -1,3 +1,5 @@
|
||||
@use(App\Models\Service)
|
||||
|
||||
@extends('adminlte::layouts.app')
|
||||
|
||||
@section('htmlheader_title')
|
||||
@@ -25,21 +27,20 @@
|
||||
<th>Product</th>
|
||||
<th class="text-right">Monthly</th>
|
||||
<th class="text-right">Cost</th>
|
||||
<th class="text-right">Traffic (GB)</th>
|
||||
<th class="text-right">Usage</th>
|
||||
<th>Supplier</th>
|
||||
</tr>
|
||||
</thead>
|
||||
|
||||
<tbody>
|
||||
{{-- @todo This query is expensive still --}}
|
||||
@foreach (\App\Models\Service::active()->with(['type','product.type.supplied.supplier_detail.supplier','product.translate'])->get() as $o)
|
||||
@foreach (Service::ServiceActive()->with(['account.taxes','type','product.type.supplied.supplier_detail.supplier','product.translate','type.traffic'])->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($o->billing_charge_normalised,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 class="text-right">{{ $o->product->hasUsage() ? number_format($o->type->usage_summary(0)->sum()/1000,1) : '-' }}</td>
|
||||
<td>{{ $o->product->supplier->name }}</td>
|
||||
</tr>
|
||||
@endforeach
|
||||
@@ -50,51 +51,60 @@
|
||||
</div>
|
||||
@endsection
|
||||
|
||||
@pa(datatables,rowgroup|conditionalpaging|select|searchpanes|searchpanes-left)
|
||||
|
||||
@section('page-scripts')
|
||||
@css(datatables,bootstrap4|fixedheader|responsive|rowgroup|buttons)
|
||||
@js(datatables,bootstrap4|fixedheader|responsive|rowgroup|buttons)
|
||||
|
||||
<style>
|
||||
tr.odd td:first-child,
|
||||
tr.even td:first-child {
|
||||
padding-left: 3em;
|
||||
}
|
||||
table.dataTable tr.dtrg-group.dtrg-level-1 td {
|
||||
background-color: #e0e0e0;
|
||||
color: #4c110f;
|
||||
}
|
||||
</style>
|
||||
|
||||
<script type="text/javascript">
|
||||
$(document).ready(function() {
|
||||
$('#table').DataTable({
|
||||
//oSearch: { sSearch: searchString ? decodeURIComponent(searchString) : '' },
|
||||
aLengthMenu: [
|
||||
[25, 50, 100, 200, -1],
|
||||
[25, 50, 100, 200, "All"]
|
||||
],
|
||||
paging: true,
|
||||
pageLength: 25,
|
||||
lengthChange: true,
|
||||
searching: true,
|
||||
ordering: true,
|
||||
info: true,
|
||||
autoWidth: false,
|
||||
fixedHeader: true,
|
||||
order: [
|
||||
[2,'asc'],
|
||||
[1,'asc'],
|
||||
],
|
||||
rowGroup: {
|
||||
dataSrc: [2],
|
||||
},
|
||||
columnDefs: [
|
||||
{
|
||||
targets: [2],
|
||||
visible: false,
|
||||
},
|
||||
],
|
||||
});
|
||||
});
|
||||
</script>
|
||||
$(document).ready(function() {
|
||||
$('#table').DataTable({
|
||||
//oSearch: { sSearch: searchString ? decodeURIComponent(searchString) : '' },
|
||||
aLengthMenu: [
|
||||
[25, 50, 100, 200, -1],
|
||||
[25, 50, 100, 200, "All"]
|
||||
],
|
||||
paging: true,
|
||||
pageLength: 25,
|
||||
conditionalPaging: true,
|
||||
lengthChange: true,
|
||||
searching: true,
|
||||
ordering: true,
|
||||
info: true,
|
||||
autoWidth: false,
|
||||
fixedHeader: true,
|
||||
order: [
|
||||
[2,'asc'],
|
||||
[1,'asc'],
|
||||
],
|
||||
rowGroup: {
|
||||
dataSrc: [2],
|
||||
},
|
||||
columnDefs: [
|
||||
{
|
||||
targets: [2],
|
||||
visible: false,
|
||||
},
|
||||
{
|
||||
targets: [0,1,3,4,5],
|
||||
searchPanes: {
|
||||
show: false,
|
||||
}
|
||||
},
|
||||
],
|
||||
language: {
|
||||
searchPanes: {
|
||||
title: 'Filters: %d',
|
||||
collapse: 'Filter',
|
||||
}
|
||||
},
|
||||
searchPanes: {
|
||||
cascadePanes: true,
|
||||
viewTotal: true,
|
||||
layout: 'columns-1',
|
||||
dataLength: 20,
|
||||
controls: false,
|
||||
},
|
||||
dom: '<"dtsp-verticalContainer"<"dtsp-verticalPanes"P><"dtsp-dataTable"Bfrtip>>',
|
||||
});
|
||||
});
|
||||
</script>
|
||||
@append
|
@@ -8,11 +8,11 @@
|
||||
</div>
|
||||
@endif
|
||||
|
||||
<div class="card-header bg-light">
|
||||
<div class="card-header bg-light p-2">
|
||||
<h3 class="card-title">Service Information</h3>
|
||||
</div>
|
||||
|
||||
<div class="card-body bg-light">
|
||||
<div class="card-body p-2">
|
||||
<table class="table table-sm">
|
||||
<tr>
|
||||
<th>Account</th>
|
||||
@@ -28,7 +28,7 @@
|
||||
<td>{{ $o->order_info_reference ?? '' }}</td>
|
||||
</tr>
|
||||
@endif
|
||||
@if($o->start_at AND $o->isPending())
|
||||
@if($o->start_at && $o->isPending())
|
||||
<tr>
|
||||
<th>Pending Connection</th>
|
||||
<td>{{ $o->start_at->format('Y-m-d') }}</td>
|
||||
@@ -47,10 +47,10 @@
|
||||
<td>${{ number_format($o->billing_charge,2) }}</td>
|
||||
@endif
|
||||
</tr>
|
||||
@if($o->active && $o->invoice_to)
|
||||
@if($o->isActive() && $o->invoiced_to)
|
||||
<tr>
|
||||
<th>Invoiced To</th>
|
||||
<td>{{ $o->invoice_to->format('Y-m-d') }}</td>
|
||||
<td>{{ $o->invoiced_to->format('Y-m-d') }}</td>
|
||||
</tr>
|
||||
@if($o->paid_to)
|
||||
<tr>
|
||||
@@ -59,14 +59,16 @@
|
||||
</tr>
|
||||
@endif
|
||||
@endif
|
||||
@if($o->status !== 'cancel-pending')
|
||||
<tr>
|
||||
<th>Next Invoice</th>
|
||||
<td>@if($o->suspend_billing)<del>@endif{{ $o->invoice_next->format('Y-m-d') }}@if($o->suspend_billing)</del> <strong>SUSPENDED</strong>@endif</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>Next Estimated Invoice</th>
|
||||
<td>${{ number_format($o->next_invoice_items(TRUE)->sum('total'),2) }} <sup>*</sup></td>
|
||||
<td>${{ number_format($o->next_invoice_items()->sum('total'),2) }} <sup>*</sup></td>
|
||||
</tr>
|
||||
@endif
|
||||
<tr>
|
||||
<th>Payment Method</th>
|
||||
<td>@if($o->billing)Direct Debit @else Invoice @endif</td>
|
||||
|
@@ -1,5 +1,7 @@
|
||||
<!-- $o=Service::class, $p=Product::class -->
|
||||
@use(App\Models\Invoice)
|
||||
@php($c=$o->product)
|
||||
|
||||
<!-- $o=Service::class, $p=Product::class -->
|
||||
<table class="table table-sm">
|
||||
<thead>
|
||||
<tr>
|
||||
@@ -75,16 +77,16 @@
|
||||
<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)*\App\Models\Invoice::billing_change($o->billing_interval,\App\Models\Invoice::BILL_MONTHLY),2) }}">${{ number_format($b=$o->billing_monthly_price,2) }}
|
||||
<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->account->taxed($c->base_charge)*\App\Models\Invoice::billing_change($o->billing_interval,\App\Models\Invoice::BILL_MONTHLY),2) }}
|
||||
{{ number_format($b=$o->billing_charge_normalised,2) }}
|
||||
@endif
|
||||
</td>
|
||||
<td>${{ number_format($a=$o->account->taxed($c->base_cost)*\App\Models\Invoice::billing_change($o->billing_interval,\App\Models\Invoice::BILL_MONTHLY),2) }}</td>
|
||||
<td>${{ number_format($a=$o->account->taxed($c->base_cost)*Invoice::billing_change($o->billing_interval,Invoice::BILL_MONTHLY),2) }}</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)*\App\Models\Invoice::billing_change($o->billing_interval,\App\Models\Invoice::BILL_MONTHLY),2) }}</td>
|
||||
<td>${{ number_format($a=$o->account->taxed($p->base_cost)*\App\Models\Invoice::billing_change($o->billing_interval,\App\Models\Invoice::BILL_MONTHLY),2) }}</td>
|
||||
<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>
|
||||
|
@@ -1,6 +1,6 @@
|
||||
<table class="table">
|
||||
<tr>
|
||||
<th colspan="3">{{ $o->name }}</th><th class="text-right">${{ number_format(($x=$o->next_invoice_items(TRUE))->sum('total'),2) }}</th>
|
||||
<th colspan="3">{{ $o->name }}</th><th class="text-right">${{ number_format(($x=$o->next_invoice_items())->sum('total'),2) }}</th>
|
||||
</tr>
|
||||
|
||||
@foreach ($x as $io)
|
||||
|
Reference in New Issue
Block a user