From b261b0b447137428e29b4d09060953f7f170fb7c Mon Sep 17 00:00:00 2001 From: James Cole Date: Mon, 2 Mar 2015 11:27:46 +0100 Subject: [PATCH] Shared expense should of course be shared asset. --- app/Helpers/Report/ReportHelper.php | 4 ++-- app/Helpers/Report/ReportQuery.php | 24 ++++++++++++------------ config/firefly.php | 4 ++-- resources/views/list/accounts.blade.php | 4 ++++ 4 files changed, 20 insertions(+), 16 deletions(-) diff --git a/app/Helpers/Report/ReportHelper.php b/app/Helpers/Report/ReportHelper.php index 210b67c991..e8677d01d0 100644 --- a/app/Helpers/Report/ReportHelper.php +++ b/app/Helpers/Report/ReportHelper.php @@ -141,7 +141,7 @@ class ReportHelper implements ReportHelperInterface $sharedCollection = \Auth::user()->accounts() ->leftJoin('account_meta', 'account_meta.account_id', '=', 'accounts.id') ->where('account_meta.name', '=', 'accountRole') - ->where('account_meta.data', '=', json_encode('sharedExpense')) + ->where('account_meta.data', '=', json_encode('sharedAsset')) ->get(['accounts.id']); foreach ($sharedCollection as $account) { @@ -166,7 +166,7 @@ class ReportHelper implements ReportHelperInterface 'start' => \Steam::balance($account, $start), 'end' => \Steam::balance($account, $end), 'account' => $account, - 'shared' => $account->accountRole == 'sharedExpense' + 'shared' => $account->accountRole == 'sharedAsset' ]; } diff --git a/app/Helpers/Report/ReportQuery.php b/app/Helpers/Report/ReportQuery.php index 3992719f89..d0067b25bd 100644 --- a/app/Helpers/Report/ReportQuery.php +++ b/app/Helpers/Report/ReportQuery.php @@ -44,7 +44,7 @@ class ReportQuery implements ReportQueryInterface ->where('active', 1) ->where( function (Builder $query) { - $query->where('account_meta.data', '!=', '"sharedExpense"'); + $query->where('account_meta.data', '!=', '"sharedAsset"'); $query->orWhereNull('account_meta.data'); } ) @@ -119,7 +119,7 @@ class ReportQuery implements ReportQueryInterface ) ->where( function (Builder $query) { - $query->where('account_meta.data', '!=', '"sharedExpense"'); + $query->where('account_meta.data', '!=', '"sharedAsset"'); $query->orWhereNull('account_meta.data'); } ) @@ -211,13 +211,13 @@ class ReportQuery implements ReportQueryInterface $query->where( function ($q) { $q->where('transaction_types.type', 'Deposit'); - $q->where('acm_to.data', '!=', '"sharedExpense"'); + $q->where('acm_to.data', '!=', '"sharedAsset"'); } ); $query->orWhere( function ($q) { $q->where('transaction_types.type', 'Transfer'); - $q->where('acm_from.data', '=', '"sharedExpense"'); + $q->where('acm_from.data', '=', '"sharedAsset"'); } ); } @@ -264,7 +264,7 @@ class ReportQuery implements ReportQueryInterface ->leftJoin('transaction_types', 'transaction_journals.transaction_type_id', '=', 'transaction_types.id') ->where('transaction_journals.date', '>=', $start->format('Y-m-d')) ->where('transaction_journals.date', '<=', $end->format('Y-m-d')) - ->where('account_meta.data', '!=', '"sharedExpense"') + ->where('account_meta.data', '!=', '"sharedAsset"') ->where('transaction_types.type', 'Withdrawal') ->groupBy('budgets.id') ->orderBy('budgets.name', 'ASC') @@ -301,7 +301,7 @@ class ReportQuery implements ReportQueryInterface ->leftJoin('transaction_types', 'transaction_journals.transaction_type_id', '=', 'transaction_types.id') ->where('transaction_journals.date', '>=', $start->format('Y-m-d')) ->where('transaction_journals.date', '<=', $end->format('Y-m-d')) - ->where('account_meta.data', '!=', '"sharedExpense"') + ->where('account_meta.data', '!=', '"sharedAsset"') ->where('transaction_types.type', 'Withdrawal') ->groupBy('categories.id') ->orderBy('amount') @@ -351,13 +351,13 @@ class ReportQuery implements ReportQueryInterface $query->where( function ($q) { $q->where('transaction_types.type', 'Withdrawal'); - $q->where('acm_from.data', '!=', '"sharedExpense"'); + $q->where('acm_from.data', '!=', '"sharedAsset"'); } ); $query->orWhere( function ($q) { $q->where('transaction_types.type', 'Transfer'); - $q->where('acm_to.data', '=', '"sharedExpense"'); + $q->where('acm_to.data', '=', '"sharedAsset"'); } ); } @@ -409,13 +409,13 @@ class ReportQuery implements ReportQueryInterface $query->where( function ($q) { $q->where('transaction_types.type', 'Deposit'); - $q->where('acm_to.data', '!=', '"sharedExpense"'); + $q->where('acm_to.data', '!=', '"sharedAsset"'); } ); $query->orWhere( function ($q) { $q->where('transaction_types.type', 'Transfer'); - $q->where('acm_from.data', '=', '"sharedExpense"'); + $q->where('acm_from.data', '=', '"sharedAsset"'); } ); } @@ -452,7 +452,7 @@ class ReportQuery implements ReportQueryInterface $join->on('account_meta.account_id', '=', 'accounts.id')->where('account_meta.name', '=', 'accountRole'); } ) - ->where('account_meta.data', '"sharedExpense"') + ->where('account_meta.data', '"sharedAsset"') ->after($start) ->before($end) ->where('transaction_types.type', 'Transfer') @@ -494,7 +494,7 @@ class ReportQuery implements ReportQueryInterface 'category_transaction_journal', 'category_transaction_journal.transaction_journal_id', '=', 'transaction_journals.id' ) ->leftJoin('categories', 'category_transaction_journal.category_id', '=', 'categories.id') - ->where('account_meta.data', '"sharedExpense"') + ->where('account_meta.data', '"sharedAsset"') ->after($start) ->before($end) ->where('transaction_types.type', 'Transfer') diff --git a/config/firefly.php b/config/firefly.php index 004b9803bf..a52e464077 100644 --- a/config/firefly.php +++ b/config/firefly.php @@ -18,8 +18,8 @@ return [ ], 'accountRoles' => [ - 'defaultExpense' => 'Default expense account', - 'sharedExpense' => 'Shared expense account' + 'defaultAsset' => 'Default asset account', + 'sharedAsset' => 'Shared asset account' ], 'range_to_text' => [ diff --git a/resources/views/list/accounts.blade.php b/resources/views/list/accounts.blade.php index d367bc5b18..d1258ec14b 100644 --- a/resources/views/list/accounts.blade.php +++ b/resources/views/list/accounts.blade.php @@ -2,7 +2,9 @@   Name + @if(isset($what) && $what == 'asset') Role + @endif Current balance Active Last activity @@ -16,7 +18,9 @@ {{{$account->name}}} + @if(isset($what) && $what == 'asset') {{{$account->accountRole}}} + @endif {!! Amount::format(Steam::balance($account)) !!} @if($account->active)