From 2d9a6ab24e669c23d2bcad6ee36e0b03bddc2b4f Mon Sep 17 00:00:00 2001 From: drkthunder02 Date: Sun, 4 Aug 2019 02:07:23 -0500 Subject: [PATCH] admin dashboard taxes for srp addition --- .../Controllers/Dashboard/AdminController.php | 18 +++++++- app/Library/Taxes/TaxesHelper.php | 23 ++++++++++ resources/views/admin/dashboard.blade.php | 44 ++++++++++++++++++- 3 files changed, 82 insertions(+), 3 deletions(-) diff --git a/app/Http/Controllers/Dashboard/AdminController.php b/app/Http/Controllers/Dashboard/AdminController.php index f2808fb99..c7a018fc6 100644 --- a/app/Http/Controllers/Dashboard/AdminController.php +++ b/app/Http/Controllers/Dashboard/AdminController.php @@ -34,6 +34,8 @@ class AdminController extends Controller $permission = array(); $entities = array(); $corpId = 98287666; + $srpActual = array(); + $srpLoss = array(); /** Taxes Pane */ //Declare classes needed for displaying items on the page @@ -42,6 +44,18 @@ class AdminController extends Controller $dates = $tHelper->GetTimeFrameInMonths($months); //Get the data for the Taxes Pane foreach($dates as $date) { + //Get the srp actual pay out for the date range + $srpActual[] = [ + 'date' => $date['start']->toFormattedDateString(), + 'gross' => number_format($tHelpeer->GetAllianceSRPActual($date['start'], $date['end']), 2, ".", ","), + ]; + + //Get the srp loss value for the date range + $srpLoss[] = [ + 'date' => $date['start']->toFormattedDateString(), + 'gross' => number_format($tHelpeer->GetAllianceSRPActual($date['start'], $date['end']), 2, ".", ","), + ]; + //Get the pi taxes for the date range $pis[] = [ 'date' => $date['start']->toFormattedDateString(), @@ -127,7 +141,9 @@ class AdminController extends Controller ->with('jumpgates', $jumpgates) ->with('reprocessings', $reprocessings) ->with('entities', $entities) - ->with('pigross', $pigross); + ->with('pigross', $pigross) + ->with('srpActual', $srpActual) + ->with('srpLoss', $srpLoss); } public function displayModifyUser(Request $request) { diff --git a/app/Library/Taxes/TaxesHelper.php b/app/Library/Taxes/TaxesHelper.php index 0780e640e..5ca3f984d 100644 --- a/app/Library/Taxes/TaxesHelper.php +++ b/app/Library/Taxes/TaxesHelper.php @@ -18,6 +18,7 @@ use App\Models\Finances\JumpBridgeJournal; use App\Models\Finances\PISaleJournal; use App\Models\Finances\AllianceMarketJournal; use App\Models\Finances\CorpMarketStructure; +use App\Models\SRP\SrpShips; class TaxesHelper { @@ -33,6 +34,28 @@ class TaxesHelper { $this->end = $en; } + public function GetAllianceSRPActual($start, $end) { + $actual = 0.00; + + $actual = SrpShips::where([ + 'approved' => 'Approved', + ])->whereBetween('created_at', [$start, $end]) + ->sum('paid_value'); + + return $actual; + } + + public function GetAllianceSRPLoss($start, $end) { + $loss = 0.00; + + $loss = SrpShips::where([ + 'approved' => 'Approved', + ])->whereBetween('created_at', [$start, $end]) + ->sum('loss_value'); + + return $loss; + } + public function GetAllianceMarketGross($start, $end, $corpId) { $revenue = 0.00; diff --git a/resources/views/admin/dashboard.blade.php b/resources/views/admin/dashboard.blade.php index 835664dd0..56f627a19 100644 --- a/resources/views/admin/dashboard.blade.php +++ b/resources/views/admin/dashboard.blade.php @@ -300,10 +300,50 @@
- +
+
+ SRP Actual Paid Out +
+
+ + + + + + + @foreach($srpActual as $srp) + + + + + @endforeach + +
MonthSRP Actual
{{ $srp['date'] }}{{ $srp['gross'] }}
+
+
- +
+
+ SRP Loss Values +
+
+ + + + + + + @foreach($srpLoss as $srp) + + + + + @endforeach + +
MonthSRP Loss
{{ $srp['date'] }}{{ $srp['gross'] }}
+
+