mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-02-25 18:45:27 -06:00
Show the balance after the occurrence of a transaction (experimental).
This commit is contained in:
parent
74e852b8bd
commit
60ef80c1a5
@ -72,6 +72,20 @@ class Account extends Ardent
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function balanceBeforeJournal(TransactionJournal $journal)
|
||||||
|
{
|
||||||
|
return floatval(
|
||||||
|
$this->transactions()
|
||||||
|
->leftJoin(
|
||||||
|
'transaction_journals', 'transaction_journals.id', '=', 'transactions.transaction_journal_id'
|
||||||
|
)
|
||||||
|
->where('transaction_journals.date', '<=', $journal->date->format('Y-m-d'))
|
||||||
|
->where('transaction_journals.created_at', '<=', $journal->created_at->format('Y-m-d H:i:s'))
|
||||||
|
->where('transaction_journals.id','!=',$journal->id)
|
||||||
|
->sum('transactions.amount')
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Transactions.
|
* Transactions.
|
||||||
*
|
*
|
||||||
|
@ -46,12 +46,16 @@
|
|||||||
<div class="col-lg-6 col-md-6 col-sm-12">
|
<div class="col-lg-6 col-md-6 col-sm-12">
|
||||||
<h3>Transactions</h3>
|
<h3>Transactions</h3>
|
||||||
@foreach($journal->transactions as $t)
|
@foreach($journal->transactions as $t)
|
||||||
<h4>{{{$t->account->name}}}<br /><small>{{{$t->account->accounttype->description}}}</small></h4>
|
<h4><a href="{{route('accounts.show',$t->account->id)}}">{{{$t->account->name}}}</a><br /><small>{{{$t->account->accounttype->description}}}</small></h4>
|
||||||
<table class="table">
|
<table class="table">
|
||||||
<tr>
|
<tr>
|
||||||
<td>Amount</td>
|
<td>Amount</td>
|
||||||
<td>{{mf($t->amount)}}</td>
|
<td>{{mf($t->amount)}}</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>New balance</td>
|
||||||
|
<td>{{mf($t->account->balanceBeforeJournal($journal))}} → {{mf($t->account->balanceBeforeJournal($journal) + $t->amount)}}</td>
|
||||||
|
</tr>
|
||||||
@if(!is_null($t->description))
|
@if(!is_null($t->description))
|
||||||
<tr>
|
<tr>
|
||||||
<td>Description</td>
|
<td>Description</td>
|
||||||
|
Loading…
Reference in New Issue
Block a user