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 public function allowance_string(): string
{ {
// TODO: Implement allowance_string() method. // TODO: Implement allowance_string() method.
return '';
} }
public function getCostAttribute(): float public function getCostAttribute(): float
{ {
// TODO: Implement getCostAttribute() method. // TODO: Implement getCostAttribute() method.
return 0;
} }
public function getSupplierAttribute() public function getSupplierAttribute()

View File

@ -21,9 +21,10 @@
<th>ID</th> <th>ID</th>
<th>Service</th> <th>Service</th>
<th>Product</th> <th>Product</th>
<th>Monthly</th> <th class="text-right">Monthly</th>
<th>Cost</th> <th class="text-right">Cost</th>
<th>Traffic</th> <th class="text-right">Traffic (GB)</th>
<th>Supplier</th>
</tr> </tr>
</thead> </thead>
@ -31,11 +32,12 @@
@foreach (\App\Models\Service::active()->get() as $o) @foreach (\App\Models\Service::active()->get() as $o)
<tr> <tr>
<td><a href="{{ url('u/service',[$o->id]) }}">{{ $o->id }}</a></td> <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>{{ $o->product->name }}</td>
<td>{{ number_format($o->billing_monthly_price,2) }}</td> <td class="text-right">{{ number_format($o->billing_monthly_price,2) }}</td>
<td>{{ $o->product->type ? number_format($o->product->type->cost,2) : 'NO TYPE' }}</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>{{ $o->product->type ? $o->product->type->allowance_string() : '-' }}</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> </tr>
@endforeach @endforeach
</tbody> </tbody>

View File

@ -1,32 +1,25 @@
<div class="card"> <div class="row">
<div class="card-header bg-gray-dark"> <div class="col-3">
<h3 class="card-title">Broadband Traffic</h3> <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>
<div class="card-body"> <div class="col-9">
<div class="row"> <div id="graph"></div>
<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> </div>
</div> </div>

View File

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