Small fixes.

This commit is contained in:
James Cole 2015-03-10 19:58:05 +01:00
parent 114788567d
commit e5c19b7562
2 changed files with 6 additions and 5 deletions

View File

@ -7,6 +7,7 @@ use Carbon\Carbon;
use FireflyIII\Models\Account; use FireflyIII\Models\Account;
use Illuminate\Database\Query\JoinClause; use Illuminate\Database\Query\JoinClause;
use Illuminate\Support\Collection; use Illuminate\Support\Collection;
use Steam;
/** /**
* Class ReportHelper * Class ReportHelper
@ -49,7 +50,7 @@ class ReportHelper implements ReportHelperInterface
$end = clone $date; $end = clone $date;
$end->endOfMonth(); $end->endOfMonth();
// all budgets // all budgets
$set = \Auth::user()->budgets() $set = Auth::user()->budgets()
->leftJoin( ->leftJoin(
'budget_limits', function (JoinClause $join) use ($date) { 'budget_limits', function (JoinClause $join) use ($date) {
$join->on('budget_limits.budget_id', '=', 'budgets.id')->where('budget_limits.startdate', '=', $date->format('Y-m-d')); $join->on('budget_limits.budget_id', '=', 'budgets.id')->where('budget_limits.startdate', '=', $date->format('Y-m-d'));
@ -139,7 +140,7 @@ class ReportHelper implements ReportHelperInterface
} }
} }
$accounts = \Auth::user()->accounts()->accountTypeIn(['Default account', 'Asset account'])->orderBy('accounts.name', 'ASC')->get(['accounts.*']) $accounts = Auth::user()->accounts()->accountTypeIn(['Default account', 'Asset account'])->orderBy('accounts.name', 'ASC')->get(['accounts.*'])
->filter( ->filter(
function (Account $account) use ($sharedAccounts) { function (Account $account) use ($sharedAccounts) {
if (!in_array($account->id, $sharedAccounts)) { if (!in_array($account->id, $sharedAccounts)) {
@ -155,8 +156,8 @@ class ReportHelper implements ReportHelperInterface
foreach ($accounts as $account) { foreach ($accounts as $account) {
$report[] = [ $report[] = [
'start' => \Steam::balance($account, $start), 'start' => Steam::balance($account, $start),
'end' => \Steam::balance($account, $end), 'end' => Steam::balance($account, $end),
'account' => $account, 'account' => $account,
'shared' => $account->accountRole == 'sharedAsset' 'shared' => $account->accountRole == 'sharedAsset'
]; ];

View File

@ -83,7 +83,7 @@ class ReportQuery implements ReportQueryInterface
->leftJoin('budget_transaction_journal', 'budget_transaction_journal.transaction_journal_id', '=', 'otherJournals.id') ->leftJoin('budget_transaction_journal', 'budget_transaction_journal.transaction_journal_id', '=', 'otherJournals.id')
->before($end)->after($start) ->before($end)->after($start)
->where('transaction_types.type', 'Withdrawal') ->where('transaction_types.type', 'Withdrawal')
->where('transaction_journals.user_id', \Auth::user()->id) ->where('transaction_journals.user_id', Auth::user()->id)
->whereNull('budget_transaction_journal.budget_id')->whereNull('transaction_journals.deleted_at') ->whereNull('budget_transaction_journal.budget_id')->whereNull('transaction_journals.deleted_at')
->whereNull('otherJournals.deleted_at') ->whereNull('otherJournals.deleted_at')
->where('transactions.account_id', $account->id) ->where('transactions.account_id', $account->id)