mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-12-12 01:42:32 +00:00
Auto commit for release 'branch-v6.2' on 2024-12-23
This commit is contained in:
@@ -114,7 +114,7 @@ class AccountController extends Controller
|
||||
$accountId = (int) $accountId;
|
||||
// loop each expense entry (each entry can be a different currency).
|
||||
foreach ($expenses as $currencyCode => $endAmount) {
|
||||
if(3 !== strlen($currencyCode)) {
|
||||
if (3 !== strlen($currencyCode)) {
|
||||
continue;
|
||||
}
|
||||
// see if there is an accompanying start amount.
|
||||
@@ -516,7 +516,7 @@ class AccountController extends Controller
|
||||
$accountId = (int) $accountId;
|
||||
// loop each expense entry (each entry can be a different currency).
|
||||
foreach ($expenses as $currencyCode => $endAmount) {
|
||||
if(3 !== strlen($currencyCode)) {
|
||||
if (3 !== strlen($currencyCode)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
|
||||
@@ -568,13 +568,13 @@ trait PeriodOverview
|
||||
}
|
||||
$entries[]
|
||||
= [
|
||||
'title' => $title,
|
||||
'route' => route('transactions.index', [$transactionType, $currentDate['start']->format('Y-m-d'), $currentDate['end']->format('Y-m-d')]),
|
||||
'total_transactions' => count($spent) + count($earned) + count($transferred),
|
||||
'spent' => $this->groupByCurrency($spent),
|
||||
'earned' => $this->groupByCurrency($earned),
|
||||
'transferred' => $this->groupByCurrency($transferred),
|
||||
];
|
||||
'title' => $title,
|
||||
'route' => route('transactions.index', [$transactionType, $currentDate['start']->format('Y-m-d'), $currentDate['end']->format('Y-m-d')]),
|
||||
'total_transactions' => count($spent) + count($earned) + count($transferred),
|
||||
'spent' => $this->groupByCurrency($spent),
|
||||
'earned' => $this->groupByCurrency($earned),
|
||||
'transferred' => $this->groupByCurrency($transferred),
|
||||
];
|
||||
}
|
||||
|
||||
return $entries;
|
||||
|
||||
@@ -213,16 +213,16 @@ class BudgetReportGenerator
|
||||
// make sum information:
|
||||
$this->report['sums'][$currencyId]
|
||||
??= [
|
||||
'budgeted' => '0',
|
||||
'spent' => '0',
|
||||
'left' => '0',
|
||||
'overspent' => '0',
|
||||
'currency_id' => $currencyId,
|
||||
'currency_code' => $limitCurrency->code,
|
||||
'currency_name' => $limitCurrency->name,
|
||||
'currency_symbol' => $limitCurrency->symbol,
|
||||
'currency_decimal_places' => $limitCurrency->decimal_places,
|
||||
];
|
||||
'budgeted' => '0',
|
||||
'spent' => '0',
|
||||
'left' => '0',
|
||||
'overspent' => '0',
|
||||
'currency_id' => $currencyId,
|
||||
'currency_code' => $limitCurrency->code,
|
||||
'currency_name' => $limitCurrency->name,
|
||||
'currency_symbol' => $limitCurrency->symbol,
|
||||
'currency_decimal_places' => $limitCurrency->decimal_places,
|
||||
];
|
||||
$this->report['sums'][$currencyId]['budgeted'] = bcadd($this->report['sums'][$currencyId]['budgeted'], $limit->amount);
|
||||
$this->report['sums'][$currencyId]['spent'] = bcadd($this->report['sums'][$currencyId]['spent'], $spent);
|
||||
$this->report['sums'][$currencyId]['left'] = bcadd($this->report['sums'][$currencyId]['left'], bcadd($limit->amount, $spent));
|
||||
|
||||
@@ -275,10 +275,10 @@ class Steam
|
||||
->get(['transactions.amount'])->toArray()
|
||||
;
|
||||
$return['balance'] = $this->sumTransactions($array, 'amount');
|
||||
//Log::debug(sprintf('balance is %s', $return['balance']));
|
||||
// Log::debug(sprintf('balance is %s', $return['balance']));
|
||||
// add virtual balance:
|
||||
$return['balance'] = bcadd('' === (string) $account->virtual_balance ? '0' : $account->virtual_balance, $return['balance']);
|
||||
//Log::debug(sprintf('balance is %s (with virtual balance)', $return['balance']));
|
||||
// Log::debug(sprintf('balance is %s (with virtual balance)', $return['balance']));
|
||||
|
||||
// then, native balance (if necessary(
|
||||
if ($native->id !== $currency->id) {
|
||||
@@ -288,19 +288,20 @@ class Steam
|
||||
->get(['transactions.native_amount'])->toArray()
|
||||
;
|
||||
$return['native_balance'] = $this->sumTransactions($array, 'native_amount');
|
||||
// Log::debug(sprintf('native_balance is %s', $return['native_balance']));
|
||||
// Log::debug(sprintf('native_balance is %s', $return['native_balance']));
|
||||
$return['native_balance'] = bcadd('' === (string) $account->native_virtual_balance ? '0' : $account->native_virtual_balance, $return['balance']);
|
||||
// Log::debug(sprintf('native_balance is %s (with virtual balance)', $return['native_balance']));
|
||||
// Log::debug(sprintf('native_balance is %s (with virtual balance)', $return['native_balance']));
|
||||
}
|
||||
|
||||
// balance(s) in other currencies.
|
||||
$array = $account->transactions()
|
||||
->leftJoin('transaction_journals', 'transaction_journals.id', '=', 'transactions.transaction_journal_id')
|
||||
->leftJoin('transaction_currencies', 'transaction_currencies.id', '=', 'transactions.transaction_currency_id')
|
||||
->where('transaction_journals.date', '<=', $date->format('Y-m-d H:i:s'))
|
||||
->get(['transaction_currencies.code', 'transactions.amount'])->toArray();
|
||||
$others = $this->groupAndSumTransactions($array, 'code', 'amount');
|
||||
// Log::debug('All others are (joined)', $others);
|
||||
$array = $account->transactions()
|
||||
->leftJoin('transaction_journals', 'transaction_journals.id', '=', 'transactions.transaction_journal_id')
|
||||
->leftJoin('transaction_currencies', 'transaction_currencies.id', '=', 'transactions.transaction_currency_id')
|
||||
->where('transaction_journals.date', '<=', $date->format('Y-m-d H:i:s'))
|
||||
->get(['transaction_currencies.code', 'transactions.amount'])->toArray()
|
||||
;
|
||||
$others = $this->groupAndSumTransactions($array, 'code', 'amount');
|
||||
// Log::debug('All others are (joined)', $others);
|
||||
|
||||
return array_merge($return, $others);
|
||||
}
|
||||
@@ -350,7 +351,7 @@ class Steam
|
||||
|
||||
/** @var Transaction $entry */
|
||||
foreach ($set as $entry) {
|
||||
$date = new Carbon($entry->max_date, config('app.timezone'));
|
||||
$date = new Carbon($entry->max_date, config('app.timezone'));
|
||||
$date->setTimezone(config('app.timezone'));
|
||||
$list[(int)$entry->account_id] = $date;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user