mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-09-20 11:19:16 +00:00
Fixed a bug where certain reports would not show incomes from shared accounts.
This commit is contained in:
@@ -254,10 +254,11 @@ class TransactionController extends BaseController
|
|||||||
Session::flash('errors', $messages['errors']);
|
Session::flash('errors', $messages['errors']);
|
||||||
if ($messages['errors']->count() > 0) {
|
if ($messages['errors']->count() > 0) {
|
||||||
Session::flash('error', 'Could not store transaction: ' . $messages['errors']->first());
|
Session::flash('error', 'Could not store transaction: ' . $messages['errors']->first());
|
||||||
|
return Redirect::route('transactions.create', $data['what'])->withInput();
|
||||||
}
|
}
|
||||||
|
|
||||||
// return to create screen:
|
// 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();
|
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')
|
->leftJoin('transaction_types', 'transaction_types.id', '=', 'transaction_journals.transaction_type_id')
|
||||||
// not shared, withdrawal
|
->where('transaction_types.type', 'Withdrawal')
|
||||||
->where(
|
->where('acm_from.data', '!=', '"sharedExpense"')
|
||||||
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?
|
|
||||||
->before($end)
|
->before($end)
|
||||||
->after($start)
|
->after($start)
|
||||||
->where('transaction_journals.user_id', \Auth::user()->id)
|
->where('transaction_journals.user_id', \Auth::user()->id)
|
||||||
@@ -336,10 +321,11 @@ class ReportQuery implements ReportQueryInterface
|
|||||||
*
|
*
|
||||||
* @param Carbon $start
|
* @param Carbon $start
|
||||||
* @param Carbon $end
|
* @param Carbon $end
|
||||||
|
* @param int $limit
|
||||||
*
|
*
|
||||||
* @return Collection
|
* @return Collection
|
||||||
*/
|
*/
|
||||||
public function journalsByRevenueAccount(Carbon $start, Carbon $end)
|
public function journalsByRevenueAccount(Carbon $start, Carbon $end, $limit = 15)
|
||||||
{
|
{
|
||||||
return \TransactionJournal::
|
return \TransactionJournal::
|
||||||
leftJoin(
|
leftJoin(
|
||||||
@@ -365,8 +351,24 @@ class ReportQuery implements ReportQueryInterface
|
|||||||
}
|
}
|
||||||
)
|
)
|
||||||
->leftJoin('transaction_types', 'transaction_types.id', '=', 'transaction_journals.transaction_type_id')
|
->leftJoin('transaction_types', 'transaction_types.id', '=', 'transaction_journals.transaction_type_id')
|
||||||
->where('transaction_types.type', 'Deposit')
|
->where(
|
||||||
->where('acm_to.data', '!=', '"sharedExpense"')
|
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)
|
->before($end)->after($start)
|
||||||
->where('transaction_journals.user_id', \Auth::user()->id)
|
->where('transaction_journals.user_id', \Auth::user()->id)
|
||||||
->groupBy('t_from.account_id')->orderBy('amount')
|
->groupBy('t_from.account_id')->orderBy('amount')
|
||||||
|
@@ -22,11 +22,15 @@
|
|||||||
{{$journal->date->format('j F Y')}}
|
{{$journal->date->format('j F Y')}}
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
@if($journal->transactions[1]->account->accounttype->description == 'Cash account')
|
@foreach($journal->transactions as $t)
|
||||||
|
@if(floatval($t->amount < 0))
|
||||||
|
@if($t->account->accounttype->description == 'Cash account')
|
||||||
<span class="text-success">(cash)</span>
|
<span class="text-success">(cash)</span>
|
||||||
@else
|
@else
|
||||||
<a href="{{route('accounts.show',$journal->transactions[1]->account_id)}}">{{{$journal->transactions[1]->account->name}}}</a>
|
<a href="{{route('accounts.show',$t->account_id)}}">{{{$t->account->name}}}</a>
|
||||||
@endif
|
@endif
|
||||||
|
@endif
|
||||||
|
@endforeach
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
@endforeach
|
@endforeach
|
||||||
|
Reference in New Issue
Block a user