display taxes history
This commit is contained in:
@@ -23,6 +23,33 @@ class StructureController extends Controller
|
|||||||
$this->middleware('permission:structure.operator');
|
$this->middleware('permission:structure.operator');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function displayTaxesHistory() {
|
||||||
|
//Make the helper esi class
|
||||||
|
$helper = new Esi();
|
||||||
|
|
||||||
|
//Get the character's corporation from esi
|
||||||
|
$corpId = $helper->FindCorporationId(Auth::user()->character_id);
|
||||||
|
|
||||||
|
//Get the dates we are working with
|
||||||
|
$dates = $this->GetLongTimeFrame();
|
||||||
|
|
||||||
|
//Create the totalTaxes array
|
||||||
|
$totalTaxes = [];
|
||||||
|
|
||||||
|
//Create the array for totalTaxes in order to send in the data to the view
|
||||||
|
for($i = 0; $i < 12; $i++) {
|
||||||
|
$totalTaxes[$i] = [
|
||||||
|
'MarketTax' => number_format($this->GetTaxes($corpId, 'Market', $dates[$i]['start'], $dates[$i]['end']), 2, '.', ','),
|
||||||
|
'MarketRevenue' => number_format($this->GetRevenue($corpId, 'Market', $dates[$i]['start'], $dates[$i]['end']), 2, '.', ','),
|
||||||
|
'RefineryTax' => number_format($this->GetTaxes($corpId, 'Refinery', $dates[$i]['start'], $dates[$i]['end']), 2, '.', ','),
|
||||||
|
'RefineryRevenue' => number_format($this->GetRevenue($corpId, 'Refinery', $dates[$i]['start'], $dates[$i]['end']), 2, '.', ','),
|
||||||
|
'start' => $dates[$i]['start']->toFormattedDateString(),
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
return view('structures.taxhistory')->with('totalTaxes', $totalTaxes);
|
||||||
|
}
|
||||||
|
|
||||||
public function displayTaxes() {
|
public function displayTaxes() {
|
||||||
//Make the helper esi class
|
//Make the helper esi class
|
||||||
$helper = new Esi();
|
$helper = new Esi();
|
||||||
@@ -44,9 +71,7 @@ class StructureController extends Controller
|
|||||||
'lastMonthRevMarket' => number_format($this->GetRevenue($corpId, 'Market', $dates['LastMonthStart'], $dates['LastMonthEnd']), 2, '.', ','),
|
'lastMonthRevMarket' => number_format($this->GetRevenue($corpId, 'Market', $dates['LastMonthStart'], $dates['LastMonthEnd']), 2, '.', ','),
|
||||||
'lastMonthRevRefinery' => number_format($this->GetRevenue($corpId, 'Refinery', $dates['LastMonthStart'], $dates['LastMonthEnd']), 2, '.', ','),
|
'lastMonthRevRefinery' => number_format($this->GetRevenue($corpId, 'Refinery', $dates['LastMonthStart'], $dates['LastMonthEnd']), 2, '.', ','),
|
||||||
'thisMonthStart' => $dates['ThisMonthStart']->toFormattedDateString(),
|
'thisMonthStart' => $dates['ThisMonthStart']->toFormattedDateString(),
|
||||||
'thisMonthEnd' => $dates['ThisMonthEnd']->toFormattedDateString(),
|
|
||||||
'lastMonthStart' => $dates['LastMonthStart']->toFormattedDateString(),
|
'lastMonthStart' => $dates['LastMonthStart']->toFormattedDateString(),
|
||||||
'lastMonthEnd' => $dates['LastMonthEnd']->toFormattedDateString(),
|
|
||||||
];
|
];
|
||||||
|
|
||||||
return view('structures.taxes')->with('totalTaxes', $totalTaxes);
|
return view('structures.taxes')->with('totalTaxes', $totalTaxes);
|
||||||
@@ -134,6 +159,32 @@ class StructureController extends Controller
|
|||||||
return $cost;
|
return $cost;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private function GetLongTimeFrame() {
|
||||||
|
$start = Carbon::now()->startOfMonth();
|
||||||
|
$end = Carbon::now()->endOfMonth();
|
||||||
|
$end->hour = 23;
|
||||||
|
$end->minute = 59;
|
||||||
|
$end->second = 59;
|
||||||
|
|
||||||
|
$dates = array();
|
||||||
|
$dates[0] = [
|
||||||
|
'start' => $start,
|
||||||
|
'end' => $end,
|
||||||
|
];
|
||||||
|
|
||||||
|
//Cycle through the for loop and build the array
|
||||||
|
for($i = 1; $i <= 12; $i++) {
|
||||||
|
$start = $start->subMonth();
|
||||||
|
$end = $end->subMonth();
|
||||||
|
$dates[$i] = [
|
||||||
|
'start' => $start,
|
||||||
|
'end' => $end,
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
return $dates;
|
||||||
|
}
|
||||||
|
|
||||||
private function GetTimeFrame() {
|
private function GetTimeFrame() {
|
||||||
$start = Carbon::now()->startOfMonth();
|
$start = Carbon::now()->startOfMonth();
|
||||||
$end = Carbon::now()->endOfMonth();
|
$end = Carbon::now()->endOfMonth();
|
||||||
|
|||||||
@@ -53,6 +53,7 @@
|
|||||||
<a class="nav-link dropdown-toggle" href="#" id="navbarDropdoownMenuLink" role="button" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">Structures</a>
|
<a class="nav-link dropdown-toggle" href="#" id="navbarDropdoownMenuLink" role="button" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">Structures</a>
|
||||||
<div class="dropdown-menu" aria-labelledby="navbarDropDownMenuLink">
|
<div class="dropdown-menu" aria-labelledby="navbarDropDownMenuLink">
|
||||||
<a class="dropdown-item" href="/structures/taxes/display">Current Taxes</a>
|
<a class="dropdown-item" href="/structures/taxes/display">Current Taxes</a>
|
||||||
|
<a class="dropdown-item" href="/structures/taxes/history">Tax History</a>
|
||||||
<a class="dropdown-item" href="/structures/register">Register Structure</a>
|
<a class="dropdown-item" href="/structures/register">Register Structure</a>
|
||||||
</div>
|
</div>
|
||||||
</li>
|
</li>
|
||||||
|
|||||||
33
resources/views/structures/taxhistory.blade.php
Normal file
33
resources/views/structures/taxhistory.blade.php
Normal file
@@ -0,0 +1,33 @@
|
|||||||
|
@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>
|
||||||
|
@foreach($i = 0; $i < 12; $i++)
|
||||||
|
<tr>
|
||||||
|
<td>{{ $totalTaxes[$i]['start'] }}</td>
|
||||||
|
<td>{{ $totalTaxes[$i]['MarketTax'] }}</td>
|
||||||
|
<td>{{ $totalTaxes[$i]['MarketRevenue'] }}</td>
|
||||||
|
<td>{{ $totalTaxes[$i]['RefineryTax'] }}</td>
|
||||||
|
<td>{{ $totalTaxes[$i]['RefineryRevenue'] }}</td>
|
||||||
|
</tr>
|
||||||
|
@endforeach
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
@endsection
|
||||||
Reference in New Issue
Block a user