new helper finance function
This commit is contained in:
@@ -104,6 +104,10 @@ class FinancesController extends Controller
|
|||||||
return view('finances.taxes')->with('totalTaxes', $totalTaxes);
|
return view('finances.taxes')->with('totalTaxes', $totalTaxes);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function displayJumpGateStatistics() {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
public function displayTaxes() {
|
public function displayTaxes() {
|
||||||
//Make the helper esi class
|
//Make the helper esi class
|
||||||
$helper = new Esi();
|
$helper = new Esi();
|
||||||
|
|||||||
@@ -32,9 +32,9 @@ class FinanceHelper {
|
|||||||
public function CalculateFuelBlockCost($type) {
|
public function CalculateFuelBlockCost($type) {
|
||||||
//Calculate how many fuel blocks are used in a month by a structure type
|
//Calculate how many fuel blocks are used in a month by a structure type
|
||||||
if($type === 'market') {
|
if($type === 'market') {
|
||||||
$fuelBlocks = 30*32*24;
|
$fuelBlocks = 24*30*32;
|
||||||
} else if ($type === 'reprocessing') {
|
} else if ($type === 'reprocessing') {
|
||||||
$fuelBlocks = 8*30*24;
|
$fuelBlocks = 24*30*8;
|
||||||
} else {
|
} else {
|
||||||
$fuelBlocks = 0;
|
$fuelBlocks = 0;
|
||||||
}
|
}
|
||||||
@@ -51,8 +51,6 @@ class FinanceHelper {
|
|||||||
//Then figure out what is owed to the alliance
|
//Then figure out what is owed to the alliance
|
||||||
if($type === 'market') {
|
if($type === 'market') {
|
||||||
$ratioType = 2.5;
|
$ratioType = 2.5;
|
||||||
} else if ($type === 'refinery') {
|
|
||||||
$ratioType = 1.0;
|
|
||||||
} else {
|
} else {
|
||||||
$ratioType = 1.5;
|
$ratioType = 1.5;
|
||||||
}
|
}
|
||||||
@@ -66,6 +64,26 @@ class FinanceHelper {
|
|||||||
return $amount;
|
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) {
|
public function GetWalletJournal($division, $charId) {
|
||||||
//Get hte ESI token for the corporation to add new wallet journals into the database
|
//Get hte ESI token for the corporation to add new wallet journals into the database
|
||||||
$token = DB::table('EsiTokens')->where('character_id', $charId)->get();
|
$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.
|
//For each journal entry, attempt to store it in the database.
|
||||||
//The PutWalletJournal function checks to see if it's already in the database.
|
//The PutWalletJournal function checks to see if it's already in the database.
|
||||||
foreach($wallet as $entry) {
|
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);
|
$this->PutWalletJournal($entry, $corpId, $division);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user