mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-02-25 18:45:27 -06:00
Fixed some other displays of money
This commit is contained in:
parent
568ab26db1
commit
411f77fd29
@ -81,7 +81,10 @@ class CategoryController extends Controller
|
|||||||
$set = $repository->getCategoriesAndExpensesCorrected($start, $end);
|
$set = $repository->getCategoriesAndExpensesCorrected($start, $end);
|
||||||
|
|
||||||
foreach ($set as $entry) {
|
foreach ($set as $entry) {
|
||||||
$chart->addRow($entry['name'], floatval($entry['sum']));
|
$sum = floatval($entry['sum']);
|
||||||
|
if($sum != 0) {
|
||||||
|
$chart->addRow($entry['name'], $sum);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$chart->generate();
|
$chart->generate();
|
||||||
|
@ -133,7 +133,7 @@ class TagController extends Controller
|
|||||||
* changes to an advancePayment.
|
* changes to an advancePayment.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
if ($tag->tagMode == 'balancingAct') {
|
if ($tag->tagMode == 'balancingAct' || $tag->tagMode == 'nothing') {
|
||||||
foreach ($tag->transactionjournals as $journal) {
|
foreach ($tag->transactionjournals as $journal) {
|
||||||
if ($journal->transactionType->type == 'Transfer') {
|
if ($journal->transactionType->type == 'Transfer') {
|
||||||
$allowToAdvancePayment = false;
|
$allowToAdvancePayment = false;
|
||||||
|
@ -96,12 +96,12 @@ class TransactionJournal extends Model
|
|||||||
}
|
}
|
||||||
// if journal is part of advancePayment AND journal is a withdrawal,
|
// if journal is part of advancePayment AND journal is a withdrawal,
|
||||||
// then journal is being repaid by other journals, so the actual amount will lower:
|
// then journal is being repaid by other journals, so the actual amount will lower:
|
||||||
/** @var Tag $tag */
|
/** @var Tag $advancePayment */
|
||||||
$tag = $this->tags()->where('tagMode', 'advancePayment')->first();
|
$advancePayment = $this->tags()->where('tagMode', 'advancePayment')->first();
|
||||||
if ($tag && $this->transactionType->type == 'Withdrawal') {
|
if ($advancePayment && $this->transactionType->type == 'Withdrawal') {
|
||||||
|
|
||||||
// loop other deposits, remove from our amount.
|
// loop other deposits, remove from our amount.
|
||||||
$others = $tag->transactionJournals()->transactionTypes(['Deposit'])->get();
|
$others = $advancePayment->transactionJournals()->transactionTypes(['Deposit'])->get();
|
||||||
foreach ($others as $other) {
|
foreach ($others as $other) {
|
||||||
$amount -= $other->actualAmount;
|
$amount -= $other->actualAmount;
|
||||||
}
|
}
|
||||||
@ -111,10 +111,27 @@ class TransactionJournal extends Model
|
|||||||
|
|
||||||
// if this journal is part of an advancePayment AND the journal is a deposit,
|
// if this journal is part of an advancePayment AND the journal is a deposit,
|
||||||
// then the journal amount is correcting a withdrawal, and the amount is zero:
|
// then the journal amount is correcting a withdrawal, and the amount is zero:
|
||||||
if ($tag && $this->transactionType->type == 'Deposit') {
|
if ($advancePayment && $this->transactionType->type == 'Deposit') {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// is balancing act?
|
||||||
|
$balancingAct = $this->tags()->where('tagMode', 'balancingAct')->first();
|
||||||
|
if ($balancingAct) {
|
||||||
|
// this is the transfer
|
||||||
|
|
||||||
|
// this is the expense:
|
||||||
|
if ($this->transactionType->type == 'Withdrawal') {
|
||||||
|
$transfer = $balancingAct->transactionJournals()->transactionTypes(['Transfer'])->first();
|
||||||
|
if ($transfer) {
|
||||||
|
$amount -= $transfer->actualAmount;
|
||||||
|
|
||||||
|
return $amount;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return $amount;
|
return $amount;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,6 +1,5 @@
|
|||||||
<div class="list-group">
|
<div class="list-group">
|
||||||
{% for journal in transactions %}
|
{% for journal in transactions %}
|
||||||
{% if journal.amount != 0 %}
|
|
||||||
|
|
||||||
<a class="list-group-item" title="{{journal.date.format('jS M Y')}}" href="{{route('transactions.show',journal.id)}}">
|
<a class="list-group-item" title="{{journal.date.format('jS M Y')}}" href="{{route('transactions.show',journal.id)}}">
|
||||||
|
|
||||||
@ -14,6 +13,5 @@
|
|||||||
</span>
|
</span>
|
||||||
|
|
||||||
</a>
|
</a>
|
||||||
{% endif %}
|
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
</div>
|
</div>
|
||||||
|
Loading…
Reference in New Issue
Block a user