Work on product costing (broadband) and reporting

This commit is contained in:
Deon George
2020-02-18 22:35:20 +11:00
parent f8d998d935
commit 910edfd89f
19 changed files with 762 additions and 45 deletions

View File

@@ -0,0 +1,106 @@
@extends('adminlte::layouts.app')
@section('htmlheader_title')
Product List
@endsection
@section('page_title')
Product List
@endsection
@section('contentheader_title')
Product List
@endsection
@section('contentheader_description')
@endsection
@section('main-content')
<div class="col-md-12">
<table class="table table-sm table-striped" id="table">
<thead>
<tr>
<th>ID</th>
<th>Service</th>
<th>Product</th>
<th>Monthly</th>
<th>Cost</th>
<th>Traffic</th>
</tr>
</thead>
<tbody>
@foreach (\App\Models\Service::active()->get() as $o)
<tr>
<td><a href="{{ url('u/service',[$o->id]) }}">{{ $o->id }}</a></td>
<td>{{ $o->sname }}</td>
<td>{{ $o->product->name }}</td>
<td>{{ number_format($o->billing_monthly_price,2) }}</td>
<td>{{ $o->product->type ? number_format($o->product->type->cost,2) : 'NO TYPE' }}</td>
<td>{{ $o->product->type ? $o->product->type->allowance_string() : '-' }}</td>
</tr>
@endforeach
</tbody>
</table>
</div>
@endsection
@section('page-scripts')
@css('//cdn.datatables.net/1.10.19/css/jquery.dataTables.min.css','datatables-css')
@js('//cdn.datatables.net/1.10.19/js/jquery.dataTables.min.js','datatables-js')
@css('//cdn.datatables.net/responsive/2.2.1/css/responsive.dataTables.min.css','datatables-responsive-css')
@js('//cdn.datatables.net/responsive/2.2.1/js/dataTables.responsive.min.js','datatables-responsive-js')
@css('//cdn.datatables.net/rowgroup/1.1.0/css/rowGroup.dataTables.min.css','datatables-rowgroup-css')
@js('//cdn.datatables.net/rowgroup/1.1.0/js/dataTables.rowGroup.min.js','datatables-rowgroup-js')
@css('//cdn.datatables.net/buttons/1.5.6/css/buttons.dataTables.min.css','datatables-button-css')
@js('//cdn.datatables.net/buttons/1.5.6/js/dataTables.buttons.min.js','datatables-button-js')
@css('//cdn.datatables.net/fixedheader/3.1.5/css/fixedHeader.dataTables.min.css','datatables-fixed-css')
@js('//cdn.datatables.net/fixedheader/3.1.5/js/dataTables.fixedHeader.min.js','datatables-fixed-js')
@css('/plugin/dataTables/dataTables.bootstrap4.css','datatables-bootstrap4-css')
@js('/plugin/dataTables/dataTables.bootstrap4.js','datatables-bootstrap4-js')
@css('/plugin/dataTables/dataTables.bootstrap4.css','datatables-bootstrap4-css')
@js('//cdnjs.cloudflare.com/ajax/libs/jszip/3.1.3/jszip.min.js','jszip')
@js('//cdn.datatables.net/buttons/1.5.6/js/buttons.html5.min.js','datatables-buttons-html5')
<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>
@append

View File

@@ -0,0 +1,28 @@
<table class="table table-sm">
<tr>
<th>Supplier</th><td>{{ $o->product->type->supplier->name }}</td>
</tr>
<tr>
<th>Supplier Product</th><td>#{{ $o->product_id }}: {{ $o->product->type->product->product_id }}</td>
</tr>
<tr>
<!-- @todo Tax shouldnt be hard coded -->
<th>Supplier Setup</th><td>${{ number_format($o->product->type->product->setup_cost*1.1,2) }}</td>
</tr>
<tr>
<th>Supplier Cost</th><td>${{ number_format($o->product->type->cost,2) }}</td>
</tr>
<tr>
<th>Supplier Contract</th><td>{{ $o->product->type->product->contract_term }} months</td>
</tr>
<tr>
<!-- @todo Tax shouldnt be hard coded -->
<th>Supplier Min Cost</th><td>${{ number_format((($x=$o->product->type->product)->setup_cost+$x->base_cost*$x->contract_term)*1.1,2) }}</td>
</tr>
<tr>
<th>Price</th><td>${{ number_format($o->billing_monthly_price,2) }}</td>
</tr>
<tr>
<th>Markup</th><td>{{ number_format(($o->billing_monthly_price/$o->product->type->cost-1)*100,2) }}%</td>
</tr>
</table>

View File

@@ -26,16 +26,19 @@
<div class="card">
<div class="card-header bg-dark d-flex p-0">
<span class="p-3"><i class="fa fa-bars"></i></span>
<ul class="nav nav-pills p-2">
<ul class="nav nav-pills p-2 w-100">
{{--
<li class="nav-item"><a class="nav-link active" href="#product" data-toggle="tab">Product</a></li>
<li class="nav-item"><a class="nav-link" href="#traffic" data-toggle="tab">Traffic</a></li>
--}}
<li class="nav-item active"><a class="nav-link" href="#invoice_next" data-toggle="tab">Next Invoice</a></li>
<li class="nav-item active"><a class="nav-link" href="#pending_items" data-toggle="tab">Pending Items</a></li>
{{--
<li class="nav-item"><a class="nav-link" href="#invoices" data-toggle="tab">Invoices</a></li>
<li class="nav-item"><a class="nav-link" href="#emails" data-toggle="tab">Emails</a></li>
--}}
@can('wholesaler')
<li class="nav-item ml-auto"><a class="nav-link" href="#internal" data-toggle="tab">Internal</a></li>
@endcan
</ul>
@can('update',$o)
@@ -64,7 +67,7 @@
<div class="tab-pane fade" id="product" role="tabpanel">
Product.
</div>
<div class="tab-pane fade show active" id="invoice_next" role="tabpanel">
<div class="tab-pane fade show active" id="pending_items" role="tabpanel">
@include('common.service.widget.invoice')
</div>
<div class="tab-pane fade" id="invoices" role="tabpanel">
@@ -73,6 +76,11 @@
<div class="tab-pane fade" id="emails" role="tabpanel">
Email.
</div>
@can('wholesaler')
<div class="tab-pane fade" id="internal" role="tabpanel">
@include('a.service.widget.internal')
</div>
@endcan
</div>
</div>
<!-- /.card -->

View File

@@ -36,16 +36,21 @@
</tr>
@endif
<!-- @todo -->
@if(FALSE)
@if($o->technology)
<tr>
<th>Speed</th>
<td>{{ 'xxx/YY' }} Mbps</td>
</tr>
<tr>
<th>Traffic</th>
<td>{{ 'xxx' }} GB (YY GB used month)</td>
<th>Technology</th>
<td>{{ $o->technology }}</td>
</tr>
@endif
<tr>
<th>Speed</th>
<td>{{ $o->service->product->type->product->speed }} Mbps</td>
</tr>
<!-- @todo -->
<tr>
<th>Traffic</th>
<td>{{ $o->service->product->type->allowance_string() }} GB @if(FALSE)(YY GB used month)@endif</td>
</tr>
<tr>
<th>IP Address</th>
<td>{{ $o->ipaddress ?: 'Dynamic' }}</td>