Firefly III: a personal finances manager
PHP accountingbudgetbudgetingbudgetscash-flowcashflowcredit-carddockerexpensesfinancefinancesfinanciallinuxmoneypaycheckpersonal-financephpphp7
Shared expense should of course be shared asset.
James Coleb261b0b44713
diff --git a/app/Helpers/Report/ReportHelper.php b/app/Helpers/Report/ReportHelper.phpindex 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.phpindex 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.phpindex 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.phpindex d367bc5b18..d1258ec14b 100644--- a/resources/views/list/accounts.blade.php+++ b/resources/views/list/accounts.blade.php@@ -2,7 +2,9 @@<tr><th> </th><th>Name</th>+ @if(isset($what) && $what == 'asset')<th>Role</th>+ @endif<th>Current balance</th><th>Active</th><th>Last activity</th>@@ -16,7 +18,9 @@</div></td><td><a href="{{route('accounts.show',$account->id)}}">{{{$account->name}}}</a></td>+ @if(isset($what) && $what == 'asset')<td>{{{$account->accountRole}}}</td>+ @endif<td>{!! Amount::format(Steam::balance($account)) !!}</td><td>@if($account->active)