added tax history functions back in but no links yet

This commit is contained in:
2019-01-05 00:20:09 -06:00
parent d76f50e539
commit 8db45f24d0
3 changed files with 36 additions and 5 deletions

View File

@@ -79,6 +79,37 @@ class StructureController extends Controller
return view('structures.taxes')->with('totalTaxes', $totalTaxes); return view('structures.taxes')->with('totalTaxes', $totalTaxes);
} }
public function displayTaxHistory(Request $request) {
//Get the months from the request
$months = $request->months;
//Make the helper esi class
$helper = new Esi();
//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->GetTimeFrameInMonths($months);
//Build the array for displaying the data on the view
$totalTaxes = array();
for($i = 0; $i < $months; $i++) {
$totalTaxes[$i] = [
'MarketTaxes' => number_format($sHelper->GetTaxes($corpId, 'Market', $dates[$i]['start'], $dates[$i]['end']), 2, '.', ','),
'MarketRevenue' => number_format($Helper->GetRevenue($corpId, 'Market', $dates[$i]['start'], $dates[$i]['end']), 2, '.', ','),
'MonthStart' => $dates[$i]['start']->toFormattedDateString(),
];
}
return view('structures.taxhistory')->with(compact('totalTaxes', 'months'));
//return view('structures.taxhistory')->with('totalTaxes', $totalTaxes);
}
public function displayJumpBridgeFuel() { public function displayJumpBridgeFuel() {
} }

View File

@@ -145,7 +145,7 @@ class StructureTaxHelper {
* @var integer * @var integer
* @returns array * @returns array
*/ */
public function GetTimeFrameMonths($months) { public function GetTimeFrameInMonths($months) {
//Declare an array of dates //Declare an array of dates
$dates = array(); $dates = array();
//Setup the start of the array as the basis of our start and end dates //Setup the start of the array as the basis of our start and end dates

View File

@@ -10,13 +10,13 @@
<table class="table table-striped"> <table class="table table-striped">
<thead> <thead>
<th>Month</th> <th>Month</th>
<th>Market Tax</th> <th>Market Tax Minus Fuel Cost / Month</th>
<th>Market Revenue Minus Fuel Cost</th> <th>Market Revenue</th>
</thead> </thead>
<tbody> <tbody>
@for($i = 0; $i < 12; $i++) @for($i = 0; $i < $months; $i++)
<tr> <tr>
<td>{{ $totalTaxes[$i]['start'] }}</td> <td>{{ $totalTaxes[$i]['MonthStart'] }}</td>
<td>{{ $totalTaxes[$i]['MarketTax'] }}</td> <td>{{ $totalTaxes[$i]['MarketTax'] }}</td>
<td>{{ $totalTaxes[$i]['MarketRevenue'] }}</td> <td>{{ $totalTaxes[$i]['MarketRevenue'] }}</td>
</tr> </tr>