mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2024-12-28 01:41:14 -06:00
Various fixes in report pages.
This commit is contained in:
parent
d2131c371b
commit
260b611293
@ -301,8 +301,8 @@ class AccountRepository implements AccountRepositoryInterface
|
||||
}
|
||||
|
||||
/**
|
||||
* This method will call AccountRepositoryInterface::journalsInPeriod and get all deposits made by the given $accounts,
|
||||
* as well as the transfers that move away from those $accounts. This is a slightly sharper selection
|
||||
* This method will call AccountRepositoryInterface::journalsInPeriod and get all deposits made to the given $accounts,
|
||||
* as well as the transfers that move away to those $accounts. This is a slightly sharper selection
|
||||
* than made by journalsInPeriod itself.
|
||||
*
|
||||
* @param Collection $accounts
|
||||
|
@ -108,8 +108,8 @@ interface AccountRepositoryInterface
|
||||
public function getSavingsAccounts(Carbon $start, Carbon $end): Collection;
|
||||
|
||||
/**
|
||||
* This method will call AccountRepositoryInterface::journalsInPeriod and get all deposits made by the given $accounts,
|
||||
* as well as the transfers that move away from those $accounts. This is a slightly sharper selection
|
||||
* This method will call AccountRepositoryInterface::journalsInPeriod and get all deposits made to the given $accounts,
|
||||
* as well as the transfers that move away to those $accounts. This is a slightly sharper selection
|
||||
* than made by journalsInPeriod itself.
|
||||
*
|
||||
* @param Collection $accounts
|
||||
|
@ -11,7 +11,6 @@ use FireflyIII\User;
|
||||
use Illuminate\Database\Query\JoinClause;
|
||||
use Illuminate\Pagination\LengthAwarePaginator;
|
||||
use Illuminate\Support\Collection;
|
||||
use Log;
|
||||
|
||||
/**
|
||||
* Class CategoryRepository
|
||||
@ -197,7 +196,7 @@ class CategoryRepository implements CategoryRepositoryInterface
|
||||
}
|
||||
);
|
||||
// create paginator
|
||||
$offset = ($page - 1) * $pageSize;
|
||||
$offset = ($page - 1) * $pageSize;
|
||||
$subSet = $complete->slice($offset, $pageSize)->all();
|
||||
$paginator = new LengthAwarePaginator($subSet, $complete->count(), $pageSize, $page);
|
||||
|
||||
@ -458,8 +457,13 @@ class CategoryRepository implements CategoryRepositoryInterface
|
||||
->distinct()
|
||||
->transactionTypes($types)
|
||||
->leftJoin(
|
||||
'transactions as t', function (JoinClause $join) {
|
||||
$join->on('t.transaction_journal_id', '=', 'transaction_journals.id')->where('amount', '<', 0);
|
||||
'transactions as source', function (JoinClause $join) {
|
||||
$join->on('source.transaction_journal_id', '=', 'transaction_journals.id')->where('source.amount', '<', 0);
|
||||
}
|
||||
)
|
||||
->leftJoin(
|
||||
'transactions as destination', function (JoinClause $join) {
|
||||
$join->on('destination.transaction_journal_id', '=', 'transaction_journals.id')->where('destination.amount', '>', 0);
|
||||
}
|
||||
);
|
||||
|
||||
@ -468,7 +472,9 @@ class CategoryRepository implements CategoryRepositoryInterface
|
||||
}
|
||||
if ($accounts->count() > 0) {
|
||||
$accountIds = $accounts->pluck('id')->toArray();
|
||||
$query->whereIn('t.account_id', $accountIds);
|
||||
$set = join(', ', $accountIds);
|
||||
$query->whereRaw('(source.account_id in (' . $set . ') XOR destination.account_id in (' . $set . '))');
|
||||
|
||||
}
|
||||
if ($categories->count() > 0) {
|
||||
$categoryIds = $categories->pluck('id')->toArray();
|
||||
@ -477,7 +483,7 @@ class CategoryRepository implements CategoryRepositoryInterface
|
||||
}
|
||||
|
||||
// that should do it:
|
||||
$first = strval($query->sum('t.amount'));
|
||||
$first = strval($query->sum('source.amount'));
|
||||
|
||||
// then collection transactions (harder)
|
||||
$query = $this->user->transactions()
|
||||
|
@ -70,9 +70,6 @@
|
||||
{% if not hideCategory %}
|
||||
<td class="hidden-xs">
|
||||
{{ journalCategories(journal)|raw }}
|
||||
{% if journal.categories[0] %}
|
||||
<a href="{{ route('categories.show',journal.categories[0].id) }}">{{ journal.categories[0].name }}</a>
|
||||
{% endif %}
|
||||
</td>
|
||||
{% endif %}
|
||||
</tr>
|
||||
|
Loading…
Reference in New Issue
Block a user