diff --git a/app/Http/Controllers/StructureController.php b/app/Http/Controllers/StructureController.php index 11c28eb1b..45dfc3d4a 100644 --- a/app/Http/Controllers/StructureController.php +++ b/app/Http/Controllers/StructureController.php @@ -42,13 +42,9 @@ class StructureController extends Controller //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(), ]; @@ -70,17 +66,12 @@ class StructureController extends Controller //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(), ]; diff --git a/app/Library/Structures/StructureTaxHelper.php b/app/Library/Structures/StructureTaxHelper.php index a26120d80..02cad829d 100644 --- a/app/Library/Structures/StructureTaxHelper.php +++ b/app/Library/Structures/StructureTaxHelper.php @@ -139,6 +139,34 @@ class StructureTaxHelper { return $dates; } + /** + * Returns a set of dates from now until the amount of months has passed + * + * @var integer + * @returns array + */ + public function GetTimeFrameMonths($months) { + //Declare an array of dates + $dates = array(); + //Setup the start of the array as the basis of our start and end dates + $start = Carbon::now()->startOfMonth(); + $end = Carbon::now()->endOfMonth(); + $end->hour = 23; + $end->minute = 59; + $end->second = 59; + + //Create an array of dates + for($i = 0; $i < $months; $i++) { + $dates[$i]['start'] = $start; + $dates[$i]['end'] = $end; + $start = $start->subMonth(); + $end = $end->subMonth(); + } + + //Return the dates back to the calling function + return $dates; + } + private function GetStructureTax($corpId, $structureType) { $tax = CorpStructure::where(['corporation_id' => $corpId, 'structure_type' => $structureType])->avg('tax');