From 50575929c9898ce9a61de9eee58383904c0212f5 Mon Sep 17 00:00:00 2001 From: drkthunder02 Date: Wed, 26 Dec 2018 22:41:57 -0600 Subject: [PATCH] jump bridge statistics --- app/Library/Finances/JumpBridgeTax.php | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/app/Library/Finances/JumpBridgeTax.php b/app/Library/Finances/JumpBridgeTax.php index 514243109..3d9de7b60 100644 --- a/app/Library/Finances/JumpBridgeTax.php +++ b/app/Library/Finances/JumpBridgeTax.php @@ -16,12 +16,15 @@ use App\Models\User\UserToCorporation; class JumpBridgeTax { private $date; + private $days; public function __construct($days = null) { if($days === null) { $this->date = Carbon::now(); + $this->days = 0; } else { $this->date = Carbon::now()->subDays($days); + $this->days = $days; } } @@ -110,7 +113,7 @@ class JumpBridgeTax { //Find the amount utilized from the jump bridge by the character $isk = JumpBridgeJournal::where(['first_party_id' => $char->character_id]) - ->whereBetween('date', [$this->date, $this->date->addDays(30)]) + ->whereBetween('date', [$this->date, $this->date->addDays($this->days)]) ->sum('amount'); //We have the character and isk amount, so we need to build an array with these two values as key value pairs. @@ -126,10 +129,11 @@ class JumpBridgeTax { * Returns the overall usage for statistics */ public function OverallTax() { + //Get the total usage $usage = DB::table('jump_bridge_journal') ->select('amount') - ->whereTime('date', '>', $this->date) + ->whereBetween('date', [$this->date, $this->date->addDays($this->days)]) ->sum(['amount']); //Return the usage