StructureController

This commit is contained in:
2018-12-07 04:05:16 -06:00
parent d63517d8e2
commit 49adc3feb5
2 changed files with 17 additions and 8 deletions
@@ -68,22 +68,35 @@ class StructureController extends Controller
*/
$fuelCost = $hFinances->CalculateFuelBlockCost('market');
/**
* Calculate the final taxes and send to display
*/
$tax = CorpStructure::where(['corporation_id' => $corporation, 'structure_type' => 'Citadel'])
->avg('tax');
$rTax = CorpStructure::where(['corporation_id' => $corporation, 'structure_type' => 'Refinery'])
->avg('tax');
$monthTaxesMarket = $monthTaxesMarket - $fuelCost;
$monthTaxesMarket = $hFinance->CalculateTax($monthTaxesMarket, $tax, 'market');
if($monthTaxesMarket < 0.00) {
$monthTaxesMarket = 0.00;
}
$lastTaxesMarket = $lastTaxesMarket - $fuelCost;
$lastTaxesMarket = $hFinance->CalculateTax($lastTaxesMarket, $tax, 'market');
if($lastTaxesMarket < 0.00) {
$lastTaxesMarket = 0.00;
}
$monthTaxesReprocessing = $monthTaxesReprocessing - $fuelCost;
$monthTaxesReprocessing = $hFinance->CalculateTax($monthTaxesReprocessing, $rTax, 'refinery');
if($monthTaxesReprocessing < 0.00) {
$monthTaxesReprocessing = 0.00;
}
$lastTaxesReprocessing = $lastTaxesReprocessing - $fuelCost;
$lastTaxesReprocessing = $hFinance->CalculateTax($lastTaxesReprocessing, $rTax, 'refinery');
if($lastTaxesReprocessing < 0.00) {
$lastTaxesReprocessing = 0.00;
}
+4 -8
View File
@@ -50,7 +50,7 @@ class FinanceHelper {
//We need to calculate the correct ratio based on structure tax,
//Then figure out what is owed to the alliance
if($type === 'market') {
$ratioType = 2.5;
$ratioType = 2.0;
} else {
$ratioType = 1.5;
}
@@ -73,13 +73,9 @@ class FinanceHelper {
* @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();
$monthly = CorpJournal::where(['corporation_id' => $corId, 'ref_type' => $type])
->whereBetween('date', [Carbon::now(), Carbon::now()->subMonth()])
->sum('tax');
return $monthly;
}