mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-02-25 18:45:27 -06:00
Some work on bread crumbs and reports.
This commit is contained in:
parent
dc25086eab
commit
0df6c3a8dc
@ -1,7 +1,26 @@
|
||||
<?php
|
||||
use DaveJamesMiller\Breadcrumbs\Generator;
|
||||
|
||||
/*
|
||||
* Back home.
|
||||
*/
|
||||
Breadcrumbs::register('home', function($breadcrumbs) {
|
||||
$breadcrumbs->push('Home', route('index'));
|
||||
});
|
||||
Breadcrumbs::register(
|
||||
'home',
|
||||
function (Generator $breadcrumbs) {
|
||||
|
||||
$breadcrumbs->push('Home', route('index'));
|
||||
}
|
||||
);
|
||||
|
||||
Breadcrumbs::register(
|
||||
'accounts.index', function (Generator $breadcrumbs, $what) {
|
||||
$breadcrumbs->parent('home');
|
||||
$breadcrumbs->push(ucfirst($what) . ' accounts', route('accounts.index', $what));
|
||||
}
|
||||
);
|
||||
Breadcrumbs::register(
|
||||
'accounts.show', function (Generator $breadcrumbs, $what, \Account $account) {
|
||||
$breadcrumbs->parent('accounts.index',$what);
|
||||
$breadcrumbs->push($account->name, route('accounts.show', $account->id));
|
||||
}
|
||||
);
|
@ -1,6 +1,5 @@
|
||||
<?php
|
||||
use Carbon\Carbon;
|
||||
use Illuminate\Support\Collection;
|
||||
|
||||
/**
|
||||
* Class ReportController
|
||||
@ -177,7 +176,7 @@ class ReportController extends BaseController
|
||||
*/
|
||||
$deposits = $journals->filter(
|
||||
function (TransactionJournal $journal) {
|
||||
if ($journal->transactionType->type == 'Withdrawal' && count($journal->budgets) == 0) {
|
||||
if ($journal->transactionType->type == 'Deposit' && count($journal->budgets) == 0) {
|
||||
return $journal;
|
||||
}
|
||||
}
|
||||
@ -220,22 +219,30 @@ class ReportController extends BaseController
|
||||
*/
|
||||
$deposits = $deposits->filter(
|
||||
function (TransactionJournal $journal) {
|
||||
echo 'Now at #'.$journal->id.': '.$journal->description.'<br>';
|
||||
foreach ($journal->transactions as $transaction) {
|
||||
|
||||
if (floatval($transaction->amount) < 0) {
|
||||
$account = $transaction->account;
|
||||
// find counter transfer:
|
||||
$counters = $account->transactions()->where('amount', floatval($transaction->amount))
|
||||
$counters = $account->transactions()->where('amount', floatval($transaction->amount) * -1)
|
||||
->where('account_id', '=', $transaction->account_id)
|
||||
->leftJoin('transaction_journals', 'transaction_journals.id', '=', 'transactions.transaction_journal_id')
|
||||
->where('transaction_journals.description', 'LIKE', '%' . e($journal->description) . '%')
|
||||
->count();
|
||||
if($counters == 0) {
|
||||
->get(['transactions.*']);
|
||||
/** @var Transaction $transaction */
|
||||
foreach($counters as $transaction) {
|
||||
echo 'Found possible counter: #'.$transaction->transaction_journal_id.': '.$transaction->transactionJournal->description.'<br>';
|
||||
}
|
||||
if($counters->count() == 0) {
|
||||
return $journal;
|
||||
}
|
||||
}
|
||||
}
|
||||
echo '<br>';
|
||||
}
|
||||
);
|
||||
exit;
|
||||
|
||||
return View::make('reports.unbalanced', compact('start', 'end', 'title', 'subTitle', 'subTitleIcon', 'mainTitleIcon', 'withdrawals','deposits'));
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user