diff --git a/app/Http/Controllers/MoonsController.php b/app/Http/Controllers/MoonsController.php
index 43b214358..c9e1c8b19 100644
--- a/app/Http/Controllers/MoonsController.php
+++ b/app/Http/Controllers/MoonsController.php
@@ -35,8 +35,6 @@ class MoonsController extends Controller
$rentalEnd = date('m/d/Y', $moon->RentalEnd);
$price = $moonCalc->SpatialMoons($moon->FirstOre, $moon->FirstQuantity, $moon->SecondOre, $moon->SecondQuantity,
$moon->ThirdOre, $moon->ThirdQuantity, $moon->FourthOre, $moon->FourthQuantity);
- $allyPrice = $moonCalc->SpatialMoonsOutOfAlliance($moon->FirstOre, $moon->FirstQuantity, $moon->SecondOre, $moon->SecondQuantity,
- $moon->ThirdOre, $moon->ThirdQuantity, $moon->FourthOre, $moon->FourthQuantity);
//Add the data to the html string to be passed to the view
$html .= '
';
$html .= '| ' . $spm . ' | ';
@@ -49,8 +47,8 @@ class MoonsController extends Controller
$html .= '' . $moon->ThirdQuantity . ' | ';
$html .= '' . $moon->FourthOre . ' | ';
$html .= '' . $moon->FourthQuantity . ' | ';
- $html .= '' . $price . ' | ';
- $html .= '' . $allyPrice . ' | ';
+ $html .= '' . $price['alliance'] . ' | ';
+ $html .= '' . $price['outofalliance'] . ' | ';
$html .= '' . $moon->RentalCorp . ' | ';
$html .= '' . $rentalEnd . ' | ';
$html .= '
';
diff --git a/app/Library/MoonCalc.php b/app/Library/MoonCalc.php
index b88a6627d..466683a74 100644
--- a/app/Library/MoonCalc.php
+++ b/app/Library/MoonCalc.php
@@ -118,9 +118,11 @@ class MoonCalc {
//Calculate the total to price to be mined in one month
$totalPriceMined = $firstTotal + $secondTotal + $thirdTotal + $fourthTotal;
//Calculate the rental price. Refined rate is already included in the price from rental composition
- $rentalPrice = $totalPriceMined * ($config[0]->RentalTax / 100.00);
+ $rentalPrice['alliance'] = $totalPriceMined * ($config[0]->RentalTax / 100.00);
+ $rentalPrice['outofalliance'] = $totalPriceMined * (config[0]->AllyRentalTax / 100.00);
//Format the rental price to the appropriate number
- $rentalPrice = number_format($rentalPrice, "2", ".", ",");
+ $rentalPrice['alliance'] = number_format($rentalPrice['alliance'], "2", ".", ",");
+ $rentalPrice['outofalliance'] = number_format($rentalPrice['outofalliance'], "2", ".", ",");
//Return the rental price to the caller
return $rentalPrice;
@@ -175,139 +177,11 @@ class MoonCalc {
//Calculate the total to price to be mined in one month
$totalPriceMined = $firstTotal + $secondTotal + $thirdTotal + $fourthTotal;
//Calculate the rental price. Refined rate is already included in the price from rental composition
- $rentalPrice = $totalPriceMined * ($config[0]->RentalTax / 100.00);
+ $rentalPrice['alliance'] = $totalPriceMined * ($config[0]->RentalTax / 100.00);
+ $rentalPrice['outofalliance'] = $totalPriceMined * ($config[0]->AllyRentalTax / 100.00);
//Format the rental price to the appropriate number
- $rentalPrice = number_format($rentalPrice, "2", ".", ",");
-
- //Return the rental price to the caller
- return $rentalPrice;
- }
-
- public function SpatialMoonsOutOfAlliance($firstOre, $firstQuan, $secondOre, $secondQuan, $thirdOre, $thirdQuan, $fourthOre, $fourthQuan) {
- //Always assume a 1 month pull which equates to 5.55m3 per second or 2,592,000 seconds
- //Total pull size is 14,385,600 m3
- $totalPull = 5.55 * (3600.00 * 24.00 * 30.00);
- //Get the configuration for pricing calculations
- $config = DB::table('Config')->get();
- if($firstQuan >= 1.00) {
- $firstPerc = $this->ConvertToPercentage($firstQuan);
- } else {
- $firstPerc = $firstQuan;
- }
- if($secondQuan >= 1.00) {
- $secondPerc = $this->ConvertToPercentage($secondQuan);
- } else {
- $secondPerc = $secondQuan;
- }
- if($thirdQuan >= 1.00) {
- $thirdPerc = $this->ConvertToPercentage($thirdQuan);
- } else {
- $thirdPerc = $thirdQuan;
- }
- if($fourthQuan >= 1.00) {
- $fourthPerc = $this->ConvertToPercentage($fourthQuan);
- } else {
- $fourthPerc = $fourthQuan;
- }
- if($firstOre != "None") {
- $firstTotal = $this->CalcPrice($firstOre, $firstPerc);
- } else {
- $firstTotal = 0.00;
- }
- if($secondOre != "None") {
- $secondTotal = $this->CalcPrice($secondOre, $secondPerc);
- } else {
- $secondTotal = 0.00;
- }
- if($thirdOre != "None") {
- $thirdTotal = $this->CalcPrice($thirdOre, $thirdPerc);
- } else {
- $thirdTotal = 0.00;
- }
- if($fourthOre != "None") {
- $fourthTotal = $this->CalcPrice($fourthOre, $fourthPerc);
- } else {
- $fourthTotal = 0.00;
- }
- //Calculate the total to price to be mined in one month
- $totalPriceMined = $firstTotal + $secondTotal + $thirdTotal + $fourthTotal;
- //Calculate the rental price. Refined rate is already included in the price from rental composition
- $rentalPrice = $totalPriceMined * ($config[0]->AllyRentalTax / 100.00);
- //Format the rental price to the appropriate number
- $rentalPrice = number_format($rentalPrice, "2", ".", ",");
-
- //Return the rental price to the caller
- return $rentalPrice;
- }
-
- public function SpatialMoonsOutOfAllianceOnlyGoo($firstOre, $firstQuan, $secondOre, $secondQuan, $thirdOre, $thirdQuan, $fourthOre, $fourthQuan) {
- //Always assume a 1 month pull which equates to 5.55m3 per second or 2,592,000 seconds
- //Total pull size is 14,385,600 m3
- $totalPull = 5.55 * (3600.00 * 24.00 * 30.00);
- //Get the configuration for pricing calculations
- $config = DB::table('Config')->get();
- if($firstQuan >= 1.00) {
- $firstPerc = $this->ConvertToPercentage($firstQuan);
- } else {
- $firstPerc = $firstQuan;
- }
- if($secondQuan >= 1.00) {
- $secondPerc = $this->ConvertToPercentage($secondQuan);
- } else {
- $secondPerc = $secondQuan;
- }
- if($thirdQuan >= 1.00) {
- $thirdPerc = $this->ConvertToPercentage($thirdQuan);
- } else {
- $thirdPerc = $thirdQuan;
- }
- if($fourthQuan >= 1.00) {
- $fourthPerc = $this->ConvertToPercentage($fourthQuan);
- } else {
- $fourthPerc = $fourthQuan;
- }
- if($firstOre != "None") {
- if($this->IsRMoon($firstOre)) {
- $firstTotal = $this->CalcPrice($firstOre, $firstPerc);
- } else {
- $firstTotal = 0.00;
- }
- } else {
- $firstTotal = 0.00;
- }
- if($secondOre != "None") {
- if($this->IsRMoon($secondOre)) {
- $secondTotal = $this->CalcPrice($secondOre, $secondPerc);
- } else {
- $secondTotal = 0.00;
- }
- } else {
- $secondTotal = 0.00;
- }
- if($thirdOre != "None") {
- if($this->IsRMoon($thirdOre)) {
- $thirdTotal = $this->CalcPrice($thirdOre, $thirdPerc);
- } else {
- $thirdTotal = 0.00;
- }
- } else {
- $thirdTotal = 0.00;
- }
- if($fourthOre != "None") {
- if($this->IsRMoon($fourthOre)) {
- $fourthTotal = $this->CalcPrice($fourthOre, $fourthPerc);
- } else {
- $fourthTotal = 0.00;
- }
- } else {
- $fourthTotal = 0.00;
- }
- //Calculate the total to price to be mined in one month
- $totalPriceMined = $firstTotal + $secondTotal + $thirdTotal + $fourthTotal;
- //Calculate the rental price. Refined rate is already included in the price from rental composition
- $rentalPrice = $totalPriceMined * ($config[0]->AllyRentalTax / 100.00);
- //Format the rental price to the appropriate number
- $rentalPrice = number_format($rentalPrice, "2", ".", ",");
+ $rentalPrice['alliance'] = number_format($rentalPrice['alliance'], "2", ".", ",");
+ $rentalPrice['outofalliance'] = number_format($rentalPrice['outofalliance'], "2", ".", ",");
//Return the rental price to the caller
return $rentalPrice;