mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-02-25 18:45:27 -06:00
Fixed a bug where certain reports would not show incomes from shared accounts.
This commit is contained in:
parent
1068dcb8a4
commit
03e0510c4f
@ -254,10 +254,11 @@ class TransactionController extends BaseController
|
||||
Session::flash('errors', $messages['errors']);
|
||||
if ($messages['errors']->count() > 0) {
|
||||
Session::flash('error', 'Could not store transaction: ' . $messages['errors']->first());
|
||||
return Redirect::route('transactions.create', $data['what'])->withInput();
|
||||
}
|
||||
|
||||
// return to create screen:
|
||||
if ($data['post_submit_action'] == 'validate_only' || $messages['errors']->count() > 0) {
|
||||
if ($data['post_submit_action'] == 'validate_only') {
|
||||
return Redirect::route('transactions.create', $data['what'])->withInput();
|
||||
}
|
||||
|
||||
|
@ -306,23 +306,8 @@ class ReportQuery implements ReportQueryInterface
|
||||
}
|
||||
)
|
||||
->leftJoin('transaction_types', 'transaction_types.id', '=', 'transaction_journals.transaction_type_id')
|
||||
// not shared, withdrawal
|
||||
->where(
|
||||
function ($q) {
|
||||
$q->where(
|
||||
function ($q) {
|
||||
$q->where('transaction_types.type', 'Withdrawal');
|
||||
$q->where('acm_from.data', '!=', '"sharedExpense"');
|
||||
}
|
||||
)->orWhere(
|
||||
function ($q) {
|
||||
$q->where('transaction_types.type', 'Transfer');
|
||||
$q->where('acm_from.data', '=', '"sharedExpense"');
|
||||
}
|
||||
);
|
||||
}
|
||||
)
|
||||
// shared, transfer?
|
||||
->where('transaction_types.type', 'Withdrawal')
|
||||
->where('acm_from.data', '!=', '"sharedExpense"')
|
||||
->before($end)
|
||||
->after($start)
|
||||
->where('transaction_journals.user_id', \Auth::user()->id)
|
||||
@ -336,10 +321,11 @@ class ReportQuery implements ReportQueryInterface
|
||||
*
|
||||
* @param Carbon $start
|
||||
* @param Carbon $end
|
||||
* @param int $limit
|
||||
*
|
||||
* @return Collection
|
||||
*/
|
||||
public function journalsByRevenueAccount(Carbon $start, Carbon $end)
|
||||
public function journalsByRevenueAccount(Carbon $start, Carbon $end, $limit = 15)
|
||||
{
|
||||
return \TransactionJournal::
|
||||
leftJoin(
|
||||
@ -365,8 +351,24 @@ class ReportQuery implements ReportQueryInterface
|
||||
}
|
||||
)
|
||||
->leftJoin('transaction_types', 'transaction_types.id', '=', 'transaction_journals.transaction_type_id')
|
||||
->where('transaction_types.type', 'Deposit')
|
||||
->where('acm_to.data', '!=', '"sharedExpense"')
|
||||
->where(
|
||||
function ($query) {
|
||||
$query->where(
|
||||
function ($q) {
|
||||
$q->where('transaction_types.type', 'Deposit');
|
||||
$q->where('acm_to.data', '!=', '"sharedExpense"');
|
||||
}
|
||||
);
|
||||
$query->orWhere(
|
||||
function ($q) {
|
||||
$q->where('transaction_types.type', 'Transfer');
|
||||
$q->where('acm_from.data', '=', '"sharedExpense"');
|
||||
}
|
||||
);
|
||||
}
|
||||
)
|
||||
// ->where('transaction_types.type', 'Deposit')
|
||||
// ->where('acm_to.data', '!=', '"sharedExpense"')
|
||||
->before($end)->after($start)
|
||||
->where('transaction_journals.user_id', \Auth::user()->id)
|
||||
->groupBy('t_from.account_id')->orderBy('amount')
|
||||
|
@ -9,24 +9,28 @@
|
||||
<td>
|
||||
<?php $tableSum += floatval($journal->transactions[1]->amount);?>
|
||||
@if($journal->transactiontype->type == 'Withdrawal')
|
||||
<span class="text-danger">{{Amount::formatTransaction($journal->transactions[1],false)}}</span>
|
||||
<span class="text-danger">{{Amount::formatTransaction($journal->transactions[1],false)}}</span>
|
||||
@endif
|
||||
@if($journal->transactiontype->type == 'Deposit')
|
||||
<span class="text-success">{{Amount::formatTransaction($journal->transactions[1],false)}}</span>
|
||||
<span class="text-success">{{Amount::formatTransaction($journal->transactions[1],false)}}</span>
|
||||
@endif
|
||||
@if($journal->transactiontype->type == 'Transfer')
|
||||
<span class="text-info">{{Amount::formatTransaction($journal->transactions[1],false)}}</span>
|
||||
<span class="text-info">{{Amount::formatTransaction($journal->transactions[1],false)}}</span>
|
||||
@endif
|
||||
</td>
|
||||
<td>
|
||||
{{$journal->date->format('j F Y')}}
|
||||
</td>
|
||||
<td>
|
||||
@if($journal->transactions[1]->account->accounttype->description == 'Cash account')
|
||||
<span class="text-success">(cash)</span>
|
||||
@else
|
||||
<a href="{{route('accounts.show',$journal->transactions[1]->account_id)}}">{{{$journal->transactions[1]->account->name}}}</a>
|
||||
@endif
|
||||
@foreach($journal->transactions as $t)
|
||||
@if(floatval($t->amount < 0))
|
||||
@if($t->account->accounttype->description == 'Cash account')
|
||||
<span class="text-success">(cash)</span>
|
||||
@else
|
||||
<a href="{{route('accounts.show',$t->account_id)}}">{{{$t->account->name}}}</a>
|
||||
@endif
|
||||
@endif
|
||||
@endforeach
|
||||
</td>
|
||||
</tr>
|
||||
@endforeach
|
||||
|
Loading…
Reference in New Issue
Block a user