sov bill journal

This commit is contained in:
2020-04-03 03:15:46 -05:00
parent a2673187d3
commit 06dd0669fe
11 changed files with 231 additions and 17 deletions
@@ -71,6 +71,18 @@ class HoldingFinancesCommand extends Command
ProcessWalletJournalJob::dispatch($job)->onQueue('journal');
}
//Get the total pages for the journal for the sov bills from the holding corporation
$pages = $finance->GetJournalPageCount(6, $config['primary']);
//Dispatch a job for each page to process
for($i = 1; $i <= $pages; $i++) {
$job = new JobProcessWalletJournal;
$job->division = 6;
$job->charId = $config['primary'];
$job->page = $i;
ProcessWalletJournalJob::dispatch($job)->onQueue('journal');
}
//Mark the job as finished
$task->SetStopStatus();
}
@@ -0,0 +1,46 @@
<?php
namespace App\Http\Controllers\Dashboard;
//Internal Library
use Illuminate\Http\Request;
use App\Http\Controllers\Controller;
use Carbon\Carbon;
use Khill\Lavacharts\Lavacharts;
use Illuminate\Support\Facades\Auth;
//Libraries
use App\Library\Taxes\TaxesHelper;
use App\Library\Wiki\WikiHelper;
use App\Library\Lookups\LookupHelper;
use App\Library\SRP\SRPHelper;
//Models
class AdminDashboardController extends Controller
{
/**
* Create a new controller instance.
*
* @return void
*/
public function __construct()
{
$this->middleware('auth');
$this->middleware('role:Guest');
}
/**
* Show the administration dashboard.
*/
public function displayAdminDashboard() {
if(auth()->user()->hasRole('Admin') || auth()->user()->hasPermission('moon.admin') || auth()->user()->hasPermission('srp.admin') || auth()->user()->hasPermission('contract.admin')) {
//Do nothing and continue on
} else {
redirect('/dashboard');
}
return view('admin.dashboards.dashboard');
}
}
@@ -8,6 +8,7 @@ use Illuminate\Http\Request;
use Illuminate\Support\Facades\Auth;
use Illuminate\Support\Facades\DB;
use Khill\Lavacharts\Lavacharts;
use Carbon\Carbon;
//Models
use App\Models\Esi\EsiScope;
@@ -30,17 +31,6 @@ class DashboardController extends Controller
$this->middleware('role:Guest');
}
/**
* Show the administration dashboard.
*/
public function displayAdminDashboard() {
if(auth()->user()->hasRole('Admin') || auth()->user()->hasPermission('moon.admin') || auth()->user()->hasPermission('srp.admin') || auth()->user()->hasPermission('contract.admin')) {
return view('admin.dashboards.dashboard');
} else {
redirect('/dashboard');
}
}
/**
* Show the application dashboard.
*
@@ -30,6 +30,7 @@ use App\Library\Finances\OfficeFee;
use App\Library\Finances\PlanetProductionTax;
use App\Library\Finances\PISale;
use App\Library\Lookups\LookupHelper;
use App\Library\Finances\SovBillExpenses;
//Seat Stuff
use Seat\Eseye\Exceptions\RequestFailedException;
@@ -47,6 +48,7 @@ class FinanceHelper {
$industry = new StructureIndustryTax();
$office = new OfficeFee();
$esiHelper = new Esi();
$sovBillHelper = new SovBillExpenses();
$lookup = new LookupHelper;
//Get the ESI refresh token for the corporation to add new wallet journals into the database
@@ -113,6 +115,8 @@ class FinanceHelper {
$industry->InsertStructureIndustryTax($entry, $corpId, $division);
} else if($entry['ref_type'] == 'office_rental_fee' && $entry['second_party_id'] == 98287666) {
$office->InsertOfficeFee($entry, $corpId, $division);
} else if($entry['ref_type'] == 'infrastructure_hub_bill' && $entry['second_party_id'] == 9828766) {
$sovBillHelper->InsertSovBillExpense($entry, $corpId, $division);
}
}
}
+63
View File
@@ -0,0 +1,63 @@
<?php
/**
* W4RP Services
* GNU Public License
*/
namespace App\Library\Finances;
//Library
use App\Library\Esi\Esi;
//Models
use App\Models\Finances\SovBillJournal;
class SovBillExpenses {
public function InsertSovBillExpense($journal, $corpId, $division) {
//Create the ESI Helper class
$esiHelper = new Esi;
//Check to see if we can find the entry in the database already.
//If we don't then add it to the database
if(!SovBillJournal::where(['id' => $journal['id']])->exists()) {
$entry = new SovBillJournal;
$entry->id = $journal['id'];
$entry->corporation_id = $corpId;
$entry->division = $division;
if(isset($journal['amount'])) {
$entry->amount = $journal['amount'];
}
if(isset($journal['balance'])) {
$entry->balance = $journal['balance'];
}
if(isset($journal['context_id'])) {
$entry->context_id = $journal['context_id'];
}
if(isset($journal['context_id_type'])) {
$entry->context_id_type = $journal['context_id_type'];
}
$entry->date = $esiHelper->DecodeDate($journal['date']);
$entry->description = $journal['description'];
if(isset($journal['first_party_id'])) {
$entry->first_party_id = $journal['first_party_id'];
}
if(isset($journal['reason'])) {
$entry->reason = $journal['reason'];
}
$entry->ref_type = $journal['ref_type'];
if(isset($journal['second_party_id'])) {
$entry->second_party_id = $journal['second_party_id'];
}
if(isset($journal['tax'])) {
$entry->tax = $journal['tax'];
}
if(isset($journal['tax_receiver_id'])) {
$entry->tax_receiver_id = $journal['tax_receiver_id'];
}
$entry->save();
}
}
}
?>
+41
View File
@@ -0,0 +1,41 @@
<?php
namespace App\Models\Finances;
use Illuminate\Database\Eloquent\Model;
class SovBillJournal extends Model
{
/**
* Table Name
*/
protected $table = 'sov_bill_journal';
/**
* Timestamps
*/
public $timestamps = true;
/**
* The attributes that are mass assignable
*
* @var array
*/
protected $fillable = [
'id',
'corporation_id',
'division',
'amount',
'balance',
'context_id',
'context_id_type',
'date',
'description',
'first_party_id',
'reason',
'ref_type',
'second_party_id',
'tax',
'tax_receiver_id',
];
}