diff --git a/app/Http/Controllers/FinancesController.php b/app/Http/Controllers/FinancesController.php index 86749a2ac..573a9f951 100644 --- a/app/Http/Controllers/FinancesController.php +++ b/app/Http/Controllers/FinancesController.php @@ -104,6 +104,10 @@ class FinancesController extends Controller return view('finances.taxes')->with('totalTaxes', $totalTaxes); } + public function displayJumpGateStatistics() { + + } + public function displayTaxes() { //Make the helper esi class $helper = new Esi(); diff --git a/app/Library/FinanceHelper.php b/app/Library/FinanceHelper.php index c524117d3..2e9c00c5f 100644 --- a/app/Library/FinanceHelper.php +++ b/app/Library/FinanceHelper.php @@ -32,9 +32,9 @@ class FinanceHelper { public function CalculateFuelBlockCost($type) { //Calculate how many fuel blocks are used in a month by a structure type if($type === 'market') { - $fuelBlocks = 30*32*24; + $fuelBlocks = 24*30*32; } else if ($type === 'reprocessing') { - $fuelBlocks = 8*30*24; + $fuelBlocks = 24*30*8; } else { $fuelBlocks = 0; } @@ -51,8 +51,6 @@ class FinanceHelper { //Then figure out what is owed to the alliance if($type === 'market') { $ratioType = 2.5; - } else if ($type === 'refinery') { - $ratioType = 1.0; } else { $ratioType = 1.5; } @@ -66,6 +64,26 @@ class FinanceHelper { return $amount; } + /** + * Helper function to calculate a particular type of tax from the database + * + * @param corpId + * @param type + * + * @return tax + */ + public function GetMonthlyTax($corpId, $type) { + $monthly = DB::table('CorpJournals') + ->select(DB::raw('SUM(tax) as monthly')) + ->where([ + 'corporation_id' => $corpId, + 'ref_type' => $type + ])->whereBetween('date', [Carbon::now(), Carbon::now()->subMonth()]) + ->get(); + + return $monthly; + } + public function GetWalletJournal($division, $charId) { //Get hte ESI token for the corporation to add new wallet journals into the database $token = DB::table('EsiTokens')->where('character_id', $charId)->get(); @@ -114,7 +132,7 @@ class FinanceHelper { //For each journal entry, attempt to store it in the database. //The PutWalletJournal function checks to see if it's already in the database. foreach($wallet as $entry) { - if($entry['ref_type'] == 'brokers_fee' || $entry['ref_type'] == 'reprocessing_tax') { + if($entry['ref_type'] == 'brokers_fee' || $entry['ref_type'] == 'reprocessing_tax' || $entry['ref_type'] == 'acceleration_gate_fee') { $this->PutWalletJournal($entry, $corpId, $division); } }