Fix old products report

This commit is contained in:
Deon George 2022-08-01 21:06:57 +10:00
parent 7feec266b8
commit 360182b6bb
4 changed files with 34 additions and 36 deletions

View File

@ -47,11 +47,13 @@ final class Host extends Type implements ProductItem
public function allowance_string(): string
{
// TODO: Implement allowance_string() method.
return '';
}
public function getCostAttribute(): float
{
// TODO: Implement getCostAttribute() method.
return 0;
}
public function getSupplierAttribute()

View File

@ -21,9 +21,10 @@
<th>ID</th>
<th>Service</th>
<th>Product</th>
<th>Monthly</th>
<th>Cost</th>
<th>Traffic</th>
<th class="text-right">Monthly</th>
<th class="text-right">Cost</th>
<th class="text-right">Traffic (GB)</th>
<th>Supplier</th>
</tr>
</thead>
@ -31,11 +32,12 @@
@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->name }}</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>
<td class="text-right">{{ number_format($o->billing_monthly_price,2) }}</td>
<td class="text-right">{{ number_format(\App\Models\Tax::tax_calc(($s=$o->supplied)->base_cost*\App\Models\Invoice::billing_change($s->billing_interval,1),$o->account->taxes),2) }}</td>
<td class="text-right">{{ $o->category == 'broadband' ? number_format($o->type->usage_summary(0)->sum()/1000,1) : '-' }}</td>
<td>{{ $o->product->supplier->name }}</td>
</tr>
@endforeach
</tbody>

View File

@ -1,32 +1,25 @@
<div class="card">
<div class="card-header bg-gray-dark">
<h3 class="card-title">Broadband Traffic</h3>
<div class="row">
<div class="col-3">
<table class="table table-sm">
<thead>
<tr>
<th>Period</th>
<th class="text-right">Traffic <small>(GB)</small></th>
</tr>
</thead>
<tbody>
@foreach ($o->usage_summary(6) as $key => $oo)
<tr>
<td>{{ $key }}</td>
<td class="text-right">{{ number_format($oo/1024,2) }}</td>
</tr>
@endforeach
</tbody>
</table>
</div>
<div class="card-body">
<div class="row">
<div class="col-3">
<table class="table table-sm">
<thead>
<tr>
<th>Period</th>
<th class="text-right">Traffic <small>(GB)</small></th>
</tr>
</thead>
<tbody>
@foreach ($o->usage_summary(6) as $key => $oo)
<tr>
<td>{{ $key }}</td>
<td class="text-right">{{ number_format($oo/1024,2) }}</td>
</tr>
@endforeach
</tbody>
</table>
</div>
<div class="col-9">
<div id="graph"></div>
</div>
</div>
<div class="col-9">
<div id="graph"></div>
</div>
</div>

View File

@ -14,7 +14,8 @@ use App\Http\Controllers\{AdminController,
SearchController,
ServiceController,
SupplierController,
WelcomeController};
WelcomeController,
Wholesale\ReportController};
use App\Models\Supplier;
/*
@ -94,7 +95,7 @@ Route::group(['middleware'=>['theme:adminlte-be','auth','role:wholesaler'],'pref
->whereIn('type',Supplier::offeringTypeKeys()->toArray())
->where('oo','[0-9]+');
//Route::get('report/products','Wholesale\ReportController@products');
Route::get('report/products',[ReportController::class,'products']);
// Charges - @todo This should probably go to resellers
Route::match(['get','post'],'charge/addedit/{o?}',[AdminController::class,'charge_addedit']);
Route::get('charge/unprocessed',[AdminController::class,'charge_unprocessed']);