replacing journals in structure tax helper

This commit is contained in:
2018-12-24 19:19:03 -06:00
parent c4c5178113
commit c070295a5a
5 changed files with 40 additions and 52 deletions
@@ -8,8 +8,9 @@ use Carbon\Carbon;
use App\User;
use App\Models\User\UserRole;
use App\Models\User\UserPermission;
use App\Models\Corporation\CorpJournal;
use App\Models\Corporation\CorpStructure;
use App\Models\Finances\CorpMarketJournal;
use App\Models\Finances\ReprocessingTaxJournal;
class StructureTaxHelper {
private $corpId;
@@ -55,12 +56,12 @@ class StructureTaxHelper {
public function GetRevenue($corpId, $refType, $start, $end) {
$revenue = 0.00;
if($refType == 'Market') {
$revenue = CorpJournal::where(['ref_type' => 'brokers_fee', 'corporation_id' => $corpId])
if($refType == 'Market') {
$revenue = MarketTaxJournal::where(['ref_type' => 'brokers_fee', 'corporation_id' => $corpId])
->whereBetween('date', [$start, $end])
->sum('amount');
} else if($refType == 'Refinery'){
$revenue = CorpJournal::where(['ref_type' => 'reprocessing_tax', 'corporation_id' => $corpId])
$revenue = ReprocessingTaxJournal::where(['ref_type' => 'reprocessing_tax', 'corporation_id' => $corpId])
->whereBetween('date', [$start, $end])
->sum('amount');
} else {
-42
View File
@@ -1,42 +0,0 @@
<?php
namespace App\Models\Corporation;
use Illuminate\Database\Eloquent\Model;
class CorpJournal extends Model
{
/**
* Table Name
*/
protected $table = 'CorpJournals';
/**
* 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',
];
}