choose corp tax history for admins

This commit is contained in:
2018-12-14 16:42:38 -06:00
parent 4371ede166
commit ee372eb84d
3 changed files with 91 additions and 0 deletions

View File

@@ -12,6 +12,7 @@ use App\Library\Structures\StructureTaxHelper;
use App\User; use App\User;
use App\Models\User\UserRole; use App\Models\User\UserRole;
use App\Models\User\UserPermission; use App\Models\User\UserPermission;
use App\Models\Corporation\CorpStructure;
use App\Library\Esi; use App\Library\Esi;
@@ -22,6 +23,44 @@ class StructureController extends Controller
$this->middleware('permission:structure.operator'); $this->middleware('permission:structure.operator');
} }
public function chooseCorpTaxes() {
//$corps = DB::table('CorpStructures')->select('corporation_name')->groupBy('corporation_name')->get();
$corps = CorpStructure::lists('corporation_name', 'corporation_id')->groupBy('corporation_name');
return view('structures.choosecorporation')->with('corps', $corps);
}
public function displayCorpTaxes(Request $request) {
$this->middleware('role:Admin');
//Make the helper esi class
$helper = new Esi();
$corpId = $request->corpId;
//Get the character's corporation from esi
$corpId = $helper->FindCorporationId(Auth::user()->character_id);
//Declare the structure tax helper class
$sHelper = new StructureTaxHelper();
//Get the dates we are working with
$dates = $sHelper->GetTimeFrame();
//Get the market taxes for this month from the database
$totalTaxes = [
'thisMonthMarket' => number_format($sHelper->GetTaxes($corpId, 'Market', $dates['ThisMonthStart'], $dates['ThisMonthEnd']), 2, '.', ','),
'thisMonthRefinery' => number_format($sHelper->GetTaxes($corpId, 'Refinery', $dates['ThisMonthStart'], $dates['ThisMonthEnd']), 2, '.', ','),
'lastMonthMarket' => number_format($sHelper->GetTaxes($corpId, 'Market', $dates['LastMonthStart'], $dates['LastMonthEnd']), 2, '.', ','),
'lastMonthRefinery' => number_format($sHelper->GetTaxes($corpId, 'Refinery', $dates['LastMonthStart'], $dates['LastMonthEnd']), 2, '.', ','),
'thisMonthRevMarket' => number_format($sHelper->GetRevenue($corpId, 'Market', $dates['ThisMonthStart'], $dates['ThisMonthEnd']), 2, '.', ','),
'thisMonthRevRefinery' => number_format($sHelper->GetRevenue($corpId, 'Refinery', $dates['ThisMonthStart'], $dates['ThisMonthEnd']), 2, '.', ','),
'lastMonthRevMarket' => number_format($sHelper->GetRevenue($corpId, 'Market', $dates['LastMonthStart'], $dates['LastMonthEnd']), 2, '.', ','),
'lastMonthRevRefinery' => number_format($sHelper->GetRevenue($corpId, 'Refinery', $dates['LastMonthStart'], $dates['LastMonthEnd']), 2, '.', ','),
'thisMonthStart' => $dates['ThisMonthStart']->toFormattedDateString(),
'lastMonthStart' => $dates['LastMonthStart']->toFormattedDateString(),
];
}
public function displayTaxes() { public function displayTaxes() {
//Make the helper esi class //Make the helper esi class
$helper = new Esi(); $helper = new Esi();

View File

@@ -0,0 +1,13 @@
@extends('layouts.b4')
@section('content')
<div class="container">
<h2>Pick the Corporation</h2>
{!! Form::open(['action' => 'StructureController@displayCorpTaxes', 'method' => 'GET']) !!}
<div class="form-group col-md-4">
{{ Form::label('corpId', 'Corporation') }}
{{ Form::select('corpId', $corps, null, ['class' => 'form-control']) }}
</div>
{{ Form::submit('Submit', ['class' => 'btn btn-primary']) }}
{!! Form::close() !!}
</div>
@endsection

View File

@@ -0,0 +1,39 @@
@extends('layouts.b4')
@section('content')
<div class="container">
<div class="card">
<div class="card-header">
Structure Taxes
</div>
<div class="card-body">
<table class="table table-striped">
<thead>
<th>Month</th>
<th>Market Tax</th>
<th>Market Revenue Minus Fuel Cost</th>
<th>Refinery Tax</th>
<th>Refinery Revenue Minus Fuel Cost</th>
</thead>
<tbody>
<tr>
<td>{{ $totalTaxes['thisMonthStart'] }}</td>
<td>{{ $totalTaxes['thisMonthMarket'] }}</td>
<td>{{ $totalTaxes['thisMonthRevMarket'] }}</td>
<td>{{ $totalTaxes['thisMonthRefinery'] }}</td>
<td>{{ $totalTaxes['thisMonthRevRefinery'] }}</td>
</tr>
<tr>
<td>{{ $totalTaxes['lastMonthStart'] }}</td>
<td>{{ $totalTaxes['lastMonthMarket'] }}</td>
<td>{{ $totalTaxes['lastMonthRevMarket'] }}</td>
<td>{{ $totalTaxes['lastMonthRefinery'] }}</td>
<td>{{ $totalTaxes['lastMonthRevRefinery'] }}</td>
</tr>
</tr>
</tbody>
</table>
</div>
</div>
</div>
@endsection