Add cost/price/supplierid to service, update service report to show supplerid and overridden costs (if any)
This commit is contained in:
@@ -25,6 +25,7 @@
|
||||
<th>ID</th>
|
||||
<th>Service</th>
|
||||
<th>Product</th>
|
||||
<th>Supplier ID</th>
|
||||
<th class="text-right">Monthly</th>
|
||||
<th class="text-right">Cost</th>
|
||||
<th class="text-right">Usage</th>
|
||||
@@ -38,8 +39,9 @@
|
||||
<td><a href="{{ url('u/service',[$o->id]) }}">{{ $o->id }}</a></td>
|
||||
<td>{{ $o->name }}</td>
|
||||
<td>{{ $o->product->name }}</td>
|
||||
<td>{{ $o->supplierid }}</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">{{ number_format($o->billing_cost_normalised,2) }}</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>
|
||||
@@ -49,6 +51,7 @@
|
||||
<tr>
|
||||
<td></td>
|
||||
<th>TOTAL:</th>
|
||||
<td></td>
|
||||
<td class="text-right"></td>
|
||||
<td class="text-right"></td>
|
||||
<td></td>
|
||||
@@ -101,22 +104,23 @@
|
||||
// Total over all pages
|
||||
let month = rows
|
||||
.data()
|
||||
.pluck(3)
|
||||
.pluck(4)
|
||||
.reduce((a, b) => intVal(a) + intVal(b), 0);
|
||||
|
||||
let cost = rows
|
||||
.data()
|
||||
.pluck(4)
|
||||
.pluck(5)
|
||||
.reduce((a, b) => intVal(a) + intVal(b), 0);
|
||||
|
||||
let usage = rows
|
||||
.data()
|
||||
.pluck(5)
|
||||
.pluck(6)
|
||||
.reduce((a, b) => intVal(a) + intVal(b), 0);
|
||||
|
||||
return $('<tr/>')
|
||||
.append('<td/>')
|
||||
.append('<td><strong>SUB-TOTAL:</strong></td>')
|
||||
.append('<td/>')
|
||||
.append('<td class="text-right"><strong>'+month.toFixed(2)+'</strong></td>')
|
||||
.append('<td class="text-right"><strong>'+cost.toFixed(2)+'</strong></td>')
|
||||
.append('<td class="text-right"><strong>'+usage.toFixed(2)+'</strong></td>')
|
||||
@@ -129,7 +133,7 @@
|
||||
visible: false,
|
||||
},
|
||||
{
|
||||
targets: [0,1,3,4,5],
|
||||
targets: [0,1,4,5,6],
|
||||
searchPanes: {
|
||||
show: false,
|
||||
}
|
||||
@@ -163,31 +167,31 @@
|
||||
|
||||
// Total over all pages
|
||||
month = api
|
||||
.column(3,{ search: 'applied' })
|
||||
.data()
|
||||
.reduce((a, b) => intVal(a) + intVal(b), 0);
|
||||
|
||||
// Total over this page
|
||||
monthTotal = api
|
||||
.column(3, { page: 'current' })
|
||||
.data()
|
||||
.reduce((a, b) => intVal(a) + intVal(b), 0);
|
||||
|
||||
// Total over all pages
|
||||
cost = api
|
||||
.column(4,{ search: 'applied' })
|
||||
.data()
|
||||
.reduce((a, b) => intVal(a) + intVal(b), 0);
|
||||
|
||||
// Total over this page
|
||||
costTotal = api
|
||||
monthTotal = api
|
||||
.column(4, { page: 'current' })
|
||||
.data()
|
||||
.reduce((a, b) => intVal(a) + intVal(b), 0);
|
||||
|
||||
// Total over all pages
|
||||
cost = api
|
||||
.column(5,{ search: 'applied' })
|
||||
.data()
|
||||
.reduce((a, b) => intVal(a) + intVal(b), 0);
|
||||
|
||||
// Total over this page
|
||||
costTotal = api
|
||||
.column(5, { page: 'current' })
|
||||
.data()
|
||||
.reduce((a, b) => intVal(a) + intVal(b), 0);
|
||||
|
||||
// Update footer
|
||||
api.column(3).footer().innerHTML = monthTotal.toFixed(2)+'<br><small>('+month.toFixed(2)+')</small>';
|
||||
api.column(4).footer().innerHTML = costTotal.toFixed(2)+'<br><small>('+cost.toFixed(2)+')</small>';
|
||||
api.column(4).footer().innerHTML = monthTotal.toFixed(2)+'<br><small>('+month.toFixed(2)+')</small>';
|
||||
api.column(5).footer().innerHTML = costTotal.toFixed(2)+'<br><small>('+cost.toFixed(2)+')</small>';
|
||||
}
|
||||
});
|
||||
});
|
||||
|
@@ -10,7 +10,7 @@
|
||||
</div>
|
||||
|
||||
<div class="row">
|
||||
<div class="col">
|
||||
<div class="col-12">
|
||||
Connection Type
|
||||
<x-leenooks::form.toggle id="pppoe" name="broadband[pppoe]" label="PPPoE" old="broadband.pppoe" :value="$o->pppoe"/>
|
||||
</div>
|
||||
|
@@ -1,7 +1,7 @@
|
||||
<!-- $o=Service::class,$p=Product::class -->
|
||||
|
||||
@use(App\Models\Invoice)
|
||||
@use(Carbon\CarbonInterface)
|
||||
@use(App\Models\Invoice)
|
||||
|
||||
@php($c=$o->product)
|
||||
|
||||
@@ -68,7 +68,7 @@
|
||||
<tr>
|
||||
<th>Billing Price</th>
|
||||
<td @if($o->isChargeOverridden())class="text-danger"@endif>${{ number_format($b=$o->billing_charge,2) }}</td>
|
||||
<td>${{ number_format($a=$o->account->taxed($c->base_cost),2) }}</td>
|
||||
<td @if($o->isCostOverridden())class="text-danger"@endif>${{ number_format($a=$o->billing_cost,2) }}</td>
|
||||
<td>{!! markup($a,$b) !!}</td>
|
||||
@if($p->exists)
|
||||
<td @if($o->isChargeOverridden())class="text-danger"@endif>${{ number_format($b=$o->account->taxed($p->base_charge),2) }}</td>
|
||||
@@ -90,7 +90,7 @@
|
||||
@if($x)
|
||||
<abbr title="${{ number_format($a=$o->account->taxed($c->base_cost)*Invoice::billing_change($o->billing_interval,Invoice::BILL_MONTHLY),2) }}">${{ number_format($b=$o->billing_cost_normalised,2) }}
|
||||
@else
|
||||
${{ number_format($o->billing_cost_normalised,2) }}
|
||||
${{ number_format($a=$o->billing_cost_normalised,2) }}
|
||||
@endif
|
||||
</td>
|
||||
<td>{!! markup($a,$b) !!}</td>
|
||||
|
@@ -3,7 +3,7 @@
|
||||
|
||||
<div class="row">
|
||||
<div class="col-12">
|
||||
<h4>Update Service details <x-leenooks::button.success class="float-right"/></h4>
|
||||
<h4>Update Service Details <x-leenooks::button.success class="float-right"/></h4>
|
||||
<hr>
|
||||
|
||||
<form method="POST" action="{{ url('a/service/update',[$o->id]) }}">
|
||||
@@ -29,11 +29,18 @@
|
||||
</div>
|
||||
|
||||
<div class="row">
|
||||
<div class="col-3"></div>
|
||||
<div class="col-12 col-sm-3">
|
||||
<x-leenooks::form.text name="supplierid" icon="fa-hashtag" label="Supplier ID" :value="$o->supplierid"/>
|
||||
</div>
|
||||
|
||||
<div class="col-12 col-sm-9 col-md-6 col-xl-5">
|
||||
<x-leenooks::form.select id="recur_schedule" name="recur_schedule" icon="fa-redo" label="Renew Term" :value="$o->recur_schedule" :options="collect(Invoice::billing_periods)->map(fn($item,$key)=>['id'=>$key,'value'=>$item['name']])"/>
|
||||
</div>
|
||||
|
||||
<!-- Cost -->
|
||||
<div class="col-12 col-sm-4 col-xl-3">
|
||||
<x-leenooks::form.text name="cost" icon="fa-dollar-sign" label="Cost (Monthly)" :value="$o->cost"/>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<hr>
|
||||
|
Reference in New Issue
Block a user