This commit is contained in:
James Cole 2019-11-19 17:39:55 +01:00
parent 4ae7501114
commit 3ec15a3b7b
No known key found for this signature in database
GPG Key ID: C16961E655E74B5E
2 changed files with 10 additions and 1 deletions

View File

@ -129,7 +129,9 @@ class HomeController extends Controller
foreach ($accounts as $account) {
/** @var GroupCollectorInterface $collector */
$collector = app(GroupCollectorInterface::class);
$collector->setAccounts(new Collection([$account]))->setRange($start, $end)->setLimit(10)->setPage(1);
$collector->setAccounts(new Collection([$account]))
->withAccountInformation()
->setRange($start, $end)->setLimit(10)->setPage(1);
$set = $collector->getGroups();
$transactions[] = [$set, $account];
}

View File

@ -25,6 +25,7 @@ namespace FireflyIII\Support\Twig;
use Carbon\Carbon;
use DB;
use FireflyIII\Models\AccountType;
use FireflyIII\Models\Transaction;
use FireflyIII\Models\TransactionJournal;
use FireflyIII\Models\TransactionType;
@ -274,12 +275,18 @@ class TransactionGroupTwig extends Twig_Extension
$type = $array['transaction_type_type'] ?? TransactionType::WITHDRAWAL;
$amount = $array['amount'] ?? '0';
$colored = true;
// withdrawals are negative
if ($type !== TransactionType::WITHDRAWAL) {
$amount = bcmul($amount, '-1');
}
$destinationType = $array['destination_account_type'] ?? 'invalid';
if ($type === TransactionType::OPENING_BALANCE && AccountType::INITIAL_BALANCE === $destinationType) {
$amount = bcmul($amount, '-1');
}
if ($type === TransactionType::TRANSFER) {
$colored = false;
}
$result = app('amount')->formatFlat($array['currency_symbol'], (int)$array['currency_decimal_places'], $amount, $colored);
if ($type === TransactionType::TRANSFER) {
$result = sprintf('<span class="text-info">%s</span>', $result);