Invoice rendering for service, and unit testing for Invoice Item quantity

This commit is contained in:
Deon George
2020-02-06 18:31:43 +09:00
parent 5f5d114f42
commit ebd4367975
14 changed files with 541 additions and 236 deletions

View File

@@ -1,19 +1,13 @@
<div class="card">
<div class="card-header">
<strong>Next Invoice Details</strong>
</div>
<table class="table">
<tr>
<th colspan="3">{{ $o->name }}</th><th class="text-right">${{ number_format($o->next_invoice_items()->sum('total'),2) }}</th>
</tr>
<div class="card-body">
<table class="table table-borderless">
<tr>
<th colspan="3">{{ $o->name }}</th><th class="text-right">${{ number_format($o->next_invoice_items()->sum('total'),2) }}</th>
</tr>
@foreach ($o->next_invoice_items() as $io)
<tr>
<td class="pt-0 pb-1">&nbsp;</td><td class="pt-0 pb-1">{{ $io->item_type_name }}</td><td class="text-right pt-0 pb-1">${{ number_format($io->total,2) }}</td>
</tr>
@endforeach
</table>
</div>
</div>
@foreach ($o->next_invoice_items() as $io)
<tr>
<td class="pt-0 pb-1">&nbsp;</td>
<td class="pt-0 pb-1">{{ $io->item_type_name }}</td>
<td class="text-right pt-0 pb-1">${{ number_format($io->total,2) }}</td>
</tr>
@endforeach
</table>

View File

@@ -8,7 +8,7 @@
@endsection
@section('contentheader_title')
Service: {{ $o->sid }} <strong>NBN-50/20-100</strong>
Service: {{ $o->sid }} <strong>{{ $o->product->name }}</strong>
@endsection
@section('contentheader_description')
{{ $o->sname }}: {{ $o->sdesc }}
@@ -34,20 +34,22 @@
<li class="nav-item"><a class="nav-link" href="#emails" data-toggle="tab">Emails</a></li>
</ul>
<ul class="nav nav-pills ml-auto p-2">
<li class="nav-item dropdown">
<a class="nav-link dropdown-toggle" data-toggle="dropdown" href="#">
Dropdown <span class="caret"></span>
</a>
<div class="dropdown-menu dropdown-menu-right">
<a class="dropdown-item" tabindex="-1" href="#tab_3">Action</a>
<a class="dropdown-item" tabindex="-1" href="#">Another action</a>
<a class="dropdown-item" tabindex="-1" href="#">Something else here</a>
<div class="dropdown-divider"></div>
<a class="dropdown-item" tabindex="-1" href="#">Separated link</a>
</div>
</li>
</ul>
@can('update',$o)
<ul class="nav nav-pills ml-auto p-2">
<li class="nav-item dropdown">
<a class="nav-link dropdown-toggle" data-toggle="dropdown" href="#">
ACTION <span class="caret"></span>
</a>
<div class="dropdown-menu dropdown-menu-right">
<a class="dropdown-item" tabindex="-1" href="#tab_3">Action</a>
<a class="dropdown-item" tabindex="-1" href="#">Another action</a>
<a class="dropdown-item" tabindex="-1" href="#">Something else here</a>
<div class="dropdown-divider"></div>
<a class="dropdown-item" tabindex="-1" href="#">Separated link</a>
</div>
</li>
</ul>
@endcan
</div><!-- /.card-header -->
<div class="card-body">
@@ -59,7 +61,7 @@
Product.
</div>
<div class="tab-pane fade" id="invoice_next" role="tabpanel">
Invoice Next.
@include('common.service.widget.invoice')
</div>
<div class="tab-pane fade" id="invoices" role="tabpanel">
Invoices.

View File

@@ -1,11 +1,10 @@
<div class="card">
<!-- @todo -->
@if($o->service->isPending())
<div class="ribbon-wrapper ribbon-lg">
<div class="ribbon bg-warning">
Pending
<div class="ribbon-wrapper ribbon-lg">
<div class="ribbon bg-warning">
Pending
</div>
</div>
</div>
@endif
<div class="card-header bg-gray-dark">

View File

@@ -2,38 +2,53 @@
<div class="card-header bg-light">
<h3 class="card-title">Service Information</h3>
</div>
<div class="card-body bg-light">
<table class="table table-sm">
<tr>
<th>Status</th>
<td>{{ $o->status }}</td>
<td>{!! $o->status_html !!}</td>
</tr>
@if ($o->active)
@if ($o->active or $o->isPending())
<tr>
<th>Billed</th>
<td>{{ $o->billing_period }}</td>
</tr>
<tr>
<th>Invoiced To</th>
<td>{{ $o->invoice_to->format('Y-m-d') }}</td>
</tr>
<tr>
<th>Paid Until</th>
<td>{{ $o->paid_to->format('Y-m-d') }}</td>
</tr>
@if($o->active)
<tr>
<th>Invoiced To</th>
<td>{{ $o->invoice_to->format('Y-m-d') }}</td>
</tr>
<tr>
<th>Paid Until</th>
<td>{{ $o->paid_to->format('Y-m-d') }}</td>
</tr>
@endif
<tr>
<th>Next Invoice</th>
<td>{{ $o->invoice_next->format('Y-m-d') }}</td>
</tr>
<tr>
<th>Estimated Invoice</th>
<td>${{ number_format($o->billing_price,2) }}</td>
</tr>
<tr>
<th>Next Estimated Invoice</th>
<td>${{ number_format($o->next_invoice_items()->sum('total'),2) }} <sup>*</sup></td>
</tr>
<tr>
<th>Payment Method</th>
<td>@if ($o->autopay)Direct Debit @else Invoice @endif</td>
</tr>
@else
<tr>
<th>Cancelled</th>
<td>{!! $o->date_end ? $o->date_end->format('Y-m-d') : $o->paid_to->format('Y-m-d').'<sup>*</sup>' !!}</td>
</tr>
@endif
<tr>
<th>Payment Method</th>
<td>@if ($o->autopay)Direct Debit @else Invoice @endif</td>
</tr>
</table>
</div>
@if($o->active OR $o->isPending())
<div class="card-footer sm">
<strong><sup>*</sup>NOTE:</strong> Estimated Invoice does not include any setup, connection nor all current billing cycle usage charges.
</div>
@endif
</div>

View File

@@ -1,49 +0,0 @@
<div class="box">
<div class="box-header with-border">
<h3 class="box-title">Service Information</h3>
<div class="box-tools pull-right">
<button type="button" class="btn btn-box-tool" data-widget="collapse" data-toggle="tooltip" title="Collapse">
<i class="fa fa-minus"></i></button>
<button type="button" class="btn btn-box-tool" data-widget="remove" data-toggle="tooltip" title="Remove">
<i class="fa fa-times"></i></button>
</div>
</div>
<div class="box-body">
<table class="table table-condensed" width="100%">
<tr>
<th>Account</th><td>{{ $o->account->company }}</td>
</tr>
<tr>
<th>Active</th><td>{{ $o->active }} ({{ $o->order_status }}) [{{ $o->status }}]</td>
</tr>
<tr>
<th>Type</th><td>{{ $o->type->type }}</td>
</tr>
<tr>
<th>Product</th><td>{{ $o->product->name }}: {{ $o->name }}</td>
</tr>
<tr>
<th>Billing Period</th><td>{{ $o->recur_schedule }}</td>
</tr>
<tr>
<th>Billing Amount</th><td>{{ $o->cost }}</td>
</tr>
<tr>
<th>Last Invoice</th><td>{{ $o->date_last_invoice }}</td>
</tr>
<tr>
<th>Paid Until</th><td>{{ 'TBA' }}</td>
</tr>
<tr>
<th>Next Invoice</th><td>{{ $o->date_next_invoice }}</td>
</tr>
</table>
</div>
{{--
<div class="box-footer">
</div>
--}}
</div>

View File

@@ -1,52 +0,0 @@
<div class="box">
<div class="box-header with-border">
<h3 class="box-title">New Order <small>({{$o->order_status}})</small></h3>
<div class="box-tools pull-right">
<button type="button" class="btn btn-box-tool" data-widget="collapse" data-toggle="tooltip" title="Collapse">
<i class="fa fa-minus"></i></button>
<button type="button" class="btn btn-box-tool" data-widget="remove" data-toggle="tooltip" title="Remove">
<i class="fa fa-times"></i></button>
</div>
</div>
<div class="box-body">
<table class="table table-condensed" width="100%">
<tr>
<th>Account</th><td>{{ $o->account->company }}</td>
</tr>
<tr>
<th>Product</th><td>{{ $o->product->name }}: {{ $o->name }}</td>
</tr>
@if($o->date_last_invoice)
<tr>
<th>Last Invoice</th><td>{{ $o->date_last_invoice }}</td>
</tr>
<tr>
<th>Paid Until</th><td>{{ 'TBA' }}</td>
</tr>
<tr>
<th>Next Invoice</th><td>{{ $o->date_next_invoice }}</td>
</tr>
@endif
<tr>
<th>Ordered</th><td>{{ $o->date_orig->format('Y-m-d') }}</td>
</tr>
@if ($o->date_last)
<tr>
<th>Update</th><td>{{ $o->date_last->format('Y-m-d') }}</td>
</tr>
@endif
<tr>
<th>Order Details</th><td>{!! $o->order_info_details !!}</td>
</tr>
<tr>
<th>Reference:</th><td>{{ \Illuminate\Support\Arr::get($o->order_info,'order_reference','') }}</td>
</tr>
</table>
</div>
{{--
<div class="box-footer">
</div>
--}}
</div>