modified table for moons and made a tax summary
This commit is contained in:
@@ -59,7 +59,7 @@ class MoonsController extends Controller
|
||||
}
|
||||
|
||||
if($today > $rentalTemp) {
|
||||
$color = 'table-success';
|
||||
$color = 'table-primary';
|
||||
} else {
|
||||
$color = 'table-danger';
|
||||
}
|
||||
|
||||
@@ -31,56 +31,6 @@ class StructureController extends Controller
|
||||
$this->middleware('permission:structure.operator');
|
||||
}
|
||||
|
||||
public function displayReprocessingTaxes() {
|
||||
$this->middleware('role:Admin');
|
||||
|
||||
$months = 3;
|
||||
$taxes = array();
|
||||
$corpId = 98287666;
|
||||
|
||||
//Declare the structure tax helper class
|
||||
$sHelper = new StructureTaxHelper();
|
||||
|
||||
//Get the dates we are working with
|
||||
$dates = $sHelper->GetTimeFrameInMonths($months);
|
||||
|
||||
foreach($dates as $date) {
|
||||
$taxes[] = [
|
||||
'date' => $date['start']->toFormattedDateString(),
|
||||
'tax' => number_format($sHelper->GetTaxes($corpId, 'Refinery', $date['start'], $date['end']), 2, '.', ','),
|
||||
'revenue' => number_format($sHelper->GetRevenue($corpId, 'Refinery', $date['start'], $date['end']), 2, '.', ',')
|
||||
];
|
||||
}
|
||||
|
||||
//Return the view with the data passed to it
|
||||
return view('structures/user/reprocessingtaxes')->with('taxes', $taxes);
|
||||
}
|
||||
|
||||
public function displayIndustryTaxes() {
|
||||
$this->middleware('role:Admin');
|
||||
|
||||
$months = 3;
|
||||
$taxes = array();
|
||||
|
||||
//Declare the structure tax helper class
|
||||
$sHelper = new StructureTaxHelper();
|
||||
|
||||
//Get the dates we are working with
|
||||
$dates = $sHelper->GetTimeFrameInMonths($months);
|
||||
|
||||
foreach($dates as $date) {
|
||||
$tax = StructureIndustryTaxJournal::select('amount')
|
||||
->whereBetween('date', [$date['start'], $date['end']])
|
||||
->sum('amount');
|
||||
$taxes[] = [
|
||||
'date' => $date['start']->toFormattedDateString(),
|
||||
'tax' => number_format($tax, 2, '.', ',')
|
||||
];
|
||||
}
|
||||
|
||||
return view('structures.user.industrytaxes')->with('taxes', $taxes);
|
||||
}
|
||||
|
||||
public function chooseCorpTaxes() {
|
||||
$this->middleware('role:Admin');
|
||||
|
||||
|
||||
68
app/Http/Controllers/TaxesController.php
Normal file
68
app/Http/Controllers/TaxesController.php
Normal file
@@ -0,0 +1,68 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
use Illuminate\Http\Request;
|
||||
|
||||
use Auth;
|
||||
use DB;
|
||||
use Carbon\Carbon;
|
||||
|
||||
use App\Library\Esi\Esi;
|
||||
use App\Library\Lookups\LookupHelper;
|
||||
|
||||
use App\Library\Structures\StructureTaxHelper;
|
||||
use App\Library\Taxes\TaxesHelper;
|
||||
|
||||
class FinancesController extends Controller
|
||||
{
|
||||
public function __construct() {
|
||||
$this->middleware('auth');
|
||||
$this->middleware('role:Admin');
|
||||
$this->middleware('permission:structure.operator');
|
||||
}
|
||||
|
||||
public function displayTaxSummary() {
|
||||
$months = 3;
|
||||
$pi = array();
|
||||
$industry = array();
|
||||
$reprocessing = array();
|
||||
$office = array();
|
||||
$corpId = 98287666;
|
||||
|
||||
//Declare the tax helper class
|
||||
$tHelper = new TaxesHelper();
|
||||
|
||||
//Get the dates we are working with
|
||||
$dates = $tHelepr->GetTimeFrameInMonths($months);
|
||||
|
||||
foreach($dates as $date) {
|
||||
$pis[] = [
|
||||
'date' => $date['start']->toFormattedDateString(),
|
||||
'gross' => number_format($tHelper->GetPIGross($start, $end), 2, ".", ","),
|
||||
];
|
||||
|
||||
$industrys[] = [
|
||||
'date' => $date['start']->toFormattedDateString(),
|
||||
'tax' => number_format($tHelper->GetIndustryGross($start, $end), 2, ".", ","),
|
||||
];
|
||||
|
||||
$reprocessings[] = [
|
||||
'date' => $date['start']->toFormattedDateString(),
|
||||
'tax' => number_format($tHelper->GetReprocessingGross($start, $end), 2, ".", ","),
|
||||
];
|
||||
|
||||
$offices[] = [
|
||||
'date' => $date['start']->toFormattedDateString(),
|
||||
'tax' => number_format($tHelper->GetOfficeGross($start, $end), 2, ".", ","),
|
||||
];
|
||||
}
|
||||
|
||||
//Return the view with the compact variable list
|
||||
return view('/taxes/admin/displaystreams')->with('pi', $pi)
|
||||
->with('industry', $industry)
|
||||
->with('reprocessing', $reprocessing)
|
||||
->with('office', $office);
|
||||
|
||||
}
|
||||
}
|
||||
@@ -108,6 +108,9 @@ class FinanceHelper {
|
||||
} else if($entry['ref_type'] == 'industry_job_tax' && $entry['second_party_id'] == 98287666) {
|
||||
$industry = new StructureIndustryTax();
|
||||
$industry->InsertStructureIndustryTax($entry, $corpId, $division);
|
||||
} else if($entry['ref_type'] == 'office_rental_fee' && $entry['second_party_id'] == 98287666) {
|
||||
$office = new OfficeFee();
|
||||
$office->InsertOfficeFee($entry, $corpId, $division);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
123
app/Library/Taxes/TaxesHelper.php
Normal file
123
app/Library/Taxes/TaxesHelper.php
Normal file
@@ -0,0 +1,123 @@
|
||||
<?php
|
||||
|
||||
namespace App\Library\Taxes;
|
||||
|
||||
use DB;
|
||||
use Carbon\Carbon;
|
||||
|
||||
use App\User;
|
||||
|
||||
use App\Models\User\UserRole;
|
||||
use App\Models\User\UserPermission;
|
||||
|
||||
use App\Models\Finances\ReprocessingTaxJournal;
|
||||
use App\Models\Finances\StructureIndustryTaxJournal;
|
||||
use App\Models\Finances\PlanetProductionTaxJournal;
|
||||
use App\Models\Finances\OfficeFeesJournal;
|
||||
|
||||
|
||||
class TaxesHelper {
|
||||
|
||||
private $corpId;
|
||||
private $refType;
|
||||
private $start;
|
||||
private $end;
|
||||
|
||||
public function __construct($corp = null, $ref = null, $st = null, $en = null) {
|
||||
$this->corpId = $corp;
|
||||
$this->refType = $ref;
|
||||
$this->start = $st;
|
||||
$this->end = $en;
|
||||
}
|
||||
|
||||
public function GetIndustryGross($start, $end) {
|
||||
$revenue = 0.00;
|
||||
|
||||
$revenue = StructureIndustryTaxJournal::where(['ref_type' => 'facility_industry_tax', 'second_party_id' => '98287666'])
|
||||
->whereBetween('date', [$start, $end])
|
||||
->sum('amount');
|
||||
|
||||
return $revenue;
|
||||
}
|
||||
|
||||
public function GetReprocessingGross($start, $end) {
|
||||
$revenue = 0.00;
|
||||
|
||||
$revenue = ReprocessingTaxJournal::where(['ref_type' => 'reprocessing_tax', 'second_party_id' => '98287666'])
|
||||
->whereBetween('date', [$start, $end])
|
||||
->sum('amount');
|
||||
|
||||
return $revenue;
|
||||
}
|
||||
|
||||
public function GetPIGross($start, $end) {
|
||||
$revenueImport = 0.00;
|
||||
$revenueExport = 0.00;
|
||||
|
||||
$revenueImport = PlanetProductionTaxJournal::where(['ref_type' => 'planetary_import_tax', 'second_party_id' => '98287666'])
|
||||
->whereBetween('date', [$start, $end])
|
||||
->sum('amount');
|
||||
$revenueExport = PlanetProductionTaxJournal::where(['ref_type' => 'planetary_export_tax', 'second_party_id' => '98287666'])
|
||||
->whereBetween('date', [$start, $end])
|
||||
->sum('amount');
|
||||
|
||||
$finalRevenue = $revenueImport + $revenueExport;
|
||||
|
||||
return $finalRevenue;
|
||||
}
|
||||
|
||||
public function GetOfficeGross($start, $end) {
|
||||
$revenue = 0.00;
|
||||
|
||||
$revenue = OfficeFeesJournal::where(['ref_type' => 'office_rental_fee', 'second_party_id' => '98287666'])
|
||||
->whereBetween('date', [$start, $end])
|
||||
->sum('amount');
|
||||
|
||||
return $revenue;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a set of dates from now until the amount of months has passed
|
||||
*
|
||||
* @var integer
|
||||
* @returns array
|
||||
*/
|
||||
public function GetTimeFrameInMonths($months) {
|
||||
//Declare an array of dates
|
||||
$dates = array();
|
||||
//Setup the start of the array as the basis of our start and end dates
|
||||
$start = Carbon::now()->startOfMonth();
|
||||
$end = Carbon::now()->endOfMonth();
|
||||
$end->hour = 23;
|
||||
$end->minute = 59;
|
||||
$end->second = 59;
|
||||
|
||||
if($months == 1) {
|
||||
$dates = [
|
||||
'start' => $start,
|
||||
'end' => $end,
|
||||
];
|
||||
|
||||
return $dates;
|
||||
}
|
||||
|
||||
//Create an array of dates
|
||||
for($i = 0; $i < $months; $i++) {
|
||||
if($i == 0) {
|
||||
$dates[$i]['start'] = $start;
|
||||
$dates[$i]['end'] = $end;
|
||||
}
|
||||
|
||||
$start = Carbon::now()->startOfMonth()->subMonths($i);
|
||||
$end = Carbon::now()->endOfMonth()->subMonths($i);
|
||||
$end->hour = 23;
|
||||
$end->minute = 59;
|
||||
$end->second = 59;
|
||||
$dates[$i]['start'] = $start;
|
||||
$dates[$i]['end'] = $end;
|
||||
}
|
||||
|
||||
//Return the dates back to the calling function
|
||||
return $dates;
|
||||
}
|
||||
}
|
||||
@@ -1,28 +0,0 @@
|
||||
@extends('layouts.b4')
|
||||
@section('content')
|
||||
|
||||
<div class="container">
|
||||
<div class="card">
|
||||
<div class="card-header">
|
||||
Structure Industry Taxes
|
||||
</div>
|
||||
<div class="card-body">
|
||||
<table class="table table-striped">
|
||||
<thead>
|
||||
<th>Month</th>
|
||||
<th>Industry Taxes</th>
|
||||
</thead>
|
||||
<tbody>
|
||||
@foreach($taxes as $tax)
|
||||
<tr>
|
||||
<td>{{ $tax['date'] }}</td>
|
||||
<td>{{ $tax['tax'] }}</td>
|
||||
</tr>
|
||||
@endforeach
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@endsection
|
||||
97
resources/views/taxes/admin/displaystreams.blade.php
Normal file
97
resources/views/taxes/admin/displaystreams.blade.php
Normal file
@@ -0,0 +1,97 @@
|
||||
@extends('layouts.b4')
|
||||
@section('content')
|
||||
|
||||
<div class="row">
|
||||
<div class="container">
|
||||
<div class="card-header">
|
||||
PI Taxes
|
||||
</div>
|
||||
<div class="card-body">
|
||||
<table class="table table-striped">
|
||||
<thead>
|
||||
<th>Month</th>
|
||||
<th>PI Taxes</th>
|
||||
</thead>
|
||||
<tbody>
|
||||
@foreach($pis as $pi)
|
||||
<tr>
|
||||
<td>{{ $pi['date'] }}</td>
|
||||
<td>{{ $pi['tax'] }}</td>
|
||||
</tr>
|
||||
@endforeach
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
<div class="container">
|
||||
<div class="card-header">
|
||||
Office Taxes
|
||||
</div>
|
||||
<div class="card-body">
|
||||
<table class="table table-striped">
|
||||
<thead>
|
||||
<th>Month</th>
|
||||
<th>Office Taxes</th>
|
||||
</thead>
|
||||
<tbody>
|
||||
@foreach($offices as $office)
|
||||
<tr>
|
||||
<td>{{ $office['date'] }}</td>
|
||||
<td>{{ $office['tax'] }}</td>
|
||||
</tr>
|
||||
@endforeach
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<br><br>
|
||||
<div class="row">
|
||||
<div class="container">
|
||||
<div class="card-header">
|
||||
Industry Taxes
|
||||
</div>
|
||||
<div class="card-body">
|
||||
<table class="table table-striped">
|
||||
<thead>
|
||||
<th>Month</th>
|
||||
<th>Industry Taxes</th>
|
||||
</thead>
|
||||
<tbody>
|
||||
@foreach($industrys as $industry)
|
||||
<tr>
|
||||
<td>{{ $industry['date'] }}</td>
|
||||
<td>{{ $industry['tax'] }}</td>
|
||||
</tr>
|
||||
@endforeach
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
<div class="container">
|
||||
<div class="card-header">
|
||||
Reprocessing Taxes
|
||||
</div>
|
||||
<div class="card-body">
|
||||
<table class="table table-striped">
|
||||
<thead>
|
||||
<th>Month</th>
|
||||
<th>Reprocessing Taxes</th>
|
||||
</thead>
|
||||
<tbody>
|
||||
@foreach($reprocessings as $reprocessing)
|
||||
<tr>
|
||||
<td>{{ $reprocessing['date'] }}</td>
|
||||
<td>{{ $reprocessing['tax'] }}</td>
|
||||
</tr>
|
||||
@endforeach
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@endsection
|
||||
@@ -66,6 +66,9 @@ Route::group(['middleware' => ['auth']], function(){
|
||||
Route::get('/structures/admin/taxes/reprocessing', 'StructureController@displayReprocessingTaxes');
|
||||
Route::get('/structures/admin/display', 'StructureController@displayAdminPanel');
|
||||
|
||||
//Taxes Controller display pages
|
||||
Route::get('/taxes/display', 'TaxesController@displayTaxSummary');
|
||||
|
||||
//Scopes Controller display pages
|
||||
Route::get('/scopes/select', 'EsiScopeController@displayScopes');
|
||||
Route::post('redirectToProvider', 'EsiScopeController@redirectToProvider');
|
||||
|
||||
Reference in New Issue
Block a user