mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2026-01-06 06:01:21 +00:00
Merge remote-tracking branch 'upstream/develop' into fix-transfer-sign
This commit is contained in:
@@ -286,6 +286,12 @@ class TransactionGroupTwig extends AbstractExtension
|
||||
$sourceAccountId = $journal['source_account_id'];
|
||||
$amount = $this->signAmount($amount, $type, $destinationType, $sourceAccountId, $account->id);
|
||||
|
||||
// withdrawals are negative
|
||||
if ($type !== TransactionType::WITHDRAWAL) {
|
||||
$amount = bcmul($amount, '-1');
|
||||
}
|
||||
|
||||
|
||||
if ($type === TransactionType::TRANSFER) {
|
||||
$colored = false;
|
||||
}
|
||||
@@ -345,9 +351,8 @@ class TransactionGroupTwig extends AbstractExtension
|
||||
$amount = bcmul($amount, '-1');
|
||||
}
|
||||
|
||||
// negative opening balance
|
||||
if ($type === TransactionType::OPENING_BALANCE)
|
||||
if (AccountType::INITIAL_BALANCE === $destinationType) {
|
||||
// opening balance and it goes to initial balance? its expense.
|
||||
if ($type === TransactionType::OPENING_BALANCE && AccountType::INITIAL_BALANCE === $destinationType) {
|
||||
$amount = bcmul($amount, '-1');
|
||||
}
|
||||
|
||||
@@ -357,6 +362,11 @@ class TransactionGroupTwig extends AbstractExtension
|
||||
$amount = bcmul($amount, '-1');
|
||||
}
|
||||
|
||||
// reconciliation and it goes to reconciliation?
|
||||
if ($type === TransactionType::RECONCILIATION && AccountType::RECONCILIATION === $destinationType) {
|
||||
$amount = bcmul($amount, '-1');
|
||||
}
|
||||
|
||||
return $amount;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user