choose corp tax history for admins

This commit is contained in:
2018-12-14 18:14:37 -06:00
parent 3b5d1a1b16
commit 7b37936b41
2 changed files with 7 additions and 15 deletions

View File

@@ -39,11 +39,10 @@ class StructureController extends Controller
//Declare the structure tax helper class //Declare the structure tax helper class
$sHelper = new StructureTaxHelper(); $sHelper = new StructureTaxHelper();
//Get the dates we are working with //Get the dates we are working with
$dates = $sHelper->GetTimeFrame(); $dates = $sHelper->GetTimeFrame();
dd($sHelper->GetTaxes($corpId, 'Market', $dates['LastMonthStart'], $dates['LastMonthEnd']));
//Get the market taxes for this month from the database //Get the market taxes for this month from the database
$totalTaxes = [ $totalTaxes = [
'thisMonthMarket' => number_format($sHelper->GetTaxes($corpId, 'Market', $dates['ThisMonthStart'], $dates['ThisMonthEnd']), 2, '.', ','), 'thisMonthMarket' => number_format($sHelper->GetTaxes($corpId, 'Market', $dates['ThisMonthStart'], $dates['ThisMonthEnd']), 2, '.', ','),
@@ -58,6 +57,7 @@ class StructureController extends Controller
'lastMonthStart' => $dates['LastMonthStart']->toFormattedDateString(), 'lastMonthStart' => $dates['LastMonthStart']->toFormattedDateString(),
]; ];
//Return the view with the data passed to it
return view('structures.choosecorptaxes')->with('totalTaxes', $totalTaxes); return view('structures.choosecorptaxes')->with('totalTaxes', $totalTaxes);
} }

View File

@@ -35,27 +35,19 @@ class StructureTaxHelper {
//Get the total taxes produced by the structure(s) over a given set of dates //Get the total taxes produced by the structure(s) over a given set of dates
$revenue = $this->GetRevenue($corpId, $refType, $start, $end); $revenue = $this->GetRevenue($corpId, $refType, $start, $end);
//Calculate the total fuel block cost
$totalFuelCost = $fuelCost * $count; $totalFuelCost = $fuelCost * $count;
var_dump($revenue);
printf("<br>"); //Calculate the total revenue minus the fuel block cost
$totalRevenue = $revenue - $totalFuelCost; $totalRevenue = $revenue - $totalFuelCost;
var_dump($totalRevenue);
printf("<br>");
var_dump($totalFuelCost);
printf("<br>");
var_dump($ratio);
printf("<br>");
//Check to see if the revenue is greater than zero to avoid division by zero error. //Check to see if the revenue is greater than zero to avoid division by zero error.
//Then calculate the tax owed which is revenue divided by ratio previously calcualted. //Then calculate the tax owed which is revenue divided by ratio previously calcualted.
if($revenue > 0.00) { if($totalRevenue > 0.00) {
$taxOwed = $totalRevenue / $ratio; $taxOwed = $totalRevenue / $ratio;
} else { } else {
$taxOwed = 0.00; $taxOwed = 0.00;
} }
//Check for negative number, and if negative, zero it out.
if($taxOwed < 0.00){
$taxOwed = 0.00;
}
//Return the amount //Return the amount
return $taxOwed; return $taxOwed;