mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-11-17 07:08:19 +00:00
Code cleanup
This commit is contained in:
@@ -109,22 +109,22 @@ class AccountController extends Controller
|
||||
|
||||
// loop the end balances. This is an array for each account ($expenses)
|
||||
foreach ($endBalances as $accountId => $expenses) {
|
||||
$accountId = (int)$accountId;
|
||||
$accountId = (int) $accountId;
|
||||
// loop each expense entry (each entry can be a different currency).
|
||||
foreach ($expenses as $currencyId => $endAmount) {
|
||||
$currencyId = (int)$currencyId;
|
||||
$currencyId = (int) $currencyId;
|
||||
|
||||
// see if there is an accompanying start amount.
|
||||
// grab the difference and find the currency.
|
||||
$startAmount = (string)($startBalances[$accountId][$currencyId] ?? '0');
|
||||
$diff = bcsub((string)$endAmount, $startAmount);
|
||||
$startAmount = (string) ($startBalances[$accountId][$currencyId] ?? '0');
|
||||
$diff = bcsub((string) $endAmount, $startAmount);
|
||||
$currencies[$currencyId] ??= $this->currencyRepository->find($currencyId);
|
||||
if (0 !== bccomp($diff, '0')) {
|
||||
// store the values in a temporary array.
|
||||
$tempData[] = [
|
||||
'name' => $accountNames[$accountId],
|
||||
'difference' => $diff,
|
||||
'diff_float' => (float)$diff, // intentional float
|
||||
'diff_float' => (float) $diff, // intentional float
|
||||
'currency_id' => $currencyId,
|
||||
];
|
||||
}
|
||||
@@ -143,7 +143,7 @@ class AccountController extends Controller
|
||||
foreach ($currencies as $currencyId => $currency) {
|
||||
$dataSet
|
||||
= [
|
||||
'label' => (string)trans('firefly.spent'),
|
||||
'label' => (string) trans('firefly.spent'),
|
||||
'type' => 'bar',
|
||||
'currency_symbol' => $currency->symbol,
|
||||
'currency_code' => $currency->code,
|
||||
@@ -200,7 +200,7 @@ class AccountController extends Controller
|
||||
|
||||
/** @var array $journal */
|
||||
foreach ($journals as $journal) {
|
||||
$budgetId = (int)$journal['budget_id'];
|
||||
$budgetId = (int) $journal['budget_id'];
|
||||
$key = sprintf('%d-%d', $budgetId, $journal['currency_id']);
|
||||
$budgetIds[] = $budgetId;
|
||||
if (!array_key_exists($key, $result)) {
|
||||
@@ -220,7 +220,7 @@ class AccountController extends Controller
|
||||
foreach ($result as $row) {
|
||||
$budgetId = $row['budget_id'];
|
||||
$name = $names[$budgetId];
|
||||
$label = (string)trans('firefly.name_in_currency', ['name' => $name, 'currency' => $row['currency_name']]);
|
||||
$label = (string) trans('firefly.name_in_currency', ['name' => $name, 'currency' => $row['currency_name']]);
|
||||
$chartData[$label] = ['amount' => $row['total'], 'currency_symbol' => $row['currency_symbol'], 'currency_code' => $row['currency_code']];
|
||||
}
|
||||
|
||||
@@ -268,7 +268,7 @@ class AccountController extends Controller
|
||||
if (!array_key_exists($key, $result)) {
|
||||
$result[$key] = [
|
||||
'total' => '0',
|
||||
'category_id' => (int)$journal['category_id'],
|
||||
'category_id' => (int) $journal['category_id'],
|
||||
'currency_name' => $journal['currency_name'],
|
||||
'currency_symbol' => $journal['currency_symbol'],
|
||||
'currency_code' => $journal['currency_code'],
|
||||
@@ -281,7 +281,7 @@ class AccountController extends Controller
|
||||
foreach ($result as $row) {
|
||||
$categoryId = $row['category_id'];
|
||||
$name = $names[$categoryId] ?? '(unknown)';
|
||||
$label = (string)trans('firefly.name_in_currency', ['name' => $name, 'currency' => $row['currency_name']]);
|
||||
$label = (string) trans('firefly.name_in_currency', ['name' => $name, 'currency' => $row['currency_name']]);
|
||||
$chartData[$label] = ['amount' => $row['total'], 'currency_symbol' => $row['currency_symbol'], 'currency_code' => $row['currency_code']];
|
||||
}
|
||||
|
||||
@@ -367,7 +367,7 @@ class AccountController extends Controller
|
||||
foreach ($result as $row) {
|
||||
$categoryId = $row['category_id'];
|
||||
$name = $names[$categoryId] ?? '(unknown)';
|
||||
$label = (string)trans('firefly.name_in_currency', ['name' => $name, 'currency' => $row['currency_name']]);
|
||||
$label = (string) trans('firefly.name_in_currency', ['name' => $name, 'currency' => $row['currency_name']]);
|
||||
$chartData[$label] = ['amount' => $row['total'], 'currency_symbol' => $row['currency_symbol'], 'currency_code' => $row['currency_code']];
|
||||
}
|
||||
$data = $this->generator->multiCurrencyPieChart($chartData);
|
||||
@@ -434,14 +434,14 @@ class AccountController extends Controller
|
||||
Log::debug(sprintf('$current date is %s', $current->format('Y-m-d')));
|
||||
if ('1D' === $step) {
|
||||
// per day the entire period, balance for every day.
|
||||
$format = (string)trans('config.month_and_day_js', [], $locale);
|
||||
$format = (string) trans('config.month_and_day_js', [], $locale);
|
||||
$range = app('steam')->balanceInRange($account, $start, $end, $currency);
|
||||
$previous = array_values($range)[0];
|
||||
while ($end >= $current) {
|
||||
$theDate = $current->format('Y-m-d');
|
||||
$balance = $range[$theDate] ?? $previous;
|
||||
$label = $current->isoFormat($format);
|
||||
$entries[$label] = (float)$balance;
|
||||
$entries[$label] = (float) $balance;
|
||||
$previous = $balance;
|
||||
$current->addDay();
|
||||
}
|
||||
@@ -449,7 +449,7 @@ class AccountController extends Controller
|
||||
if ('1W' === $step || '1M' === $step || '1Y' === $step) {
|
||||
while ($end >= $current) {
|
||||
Log::debug(sprintf('Current is: %s', $current->format('Y-m-d')));
|
||||
$balance = (float)app('steam')->balance($account, $current, $currency);
|
||||
$balance = (float) app('steam')->balance($account, $current, $currency);
|
||||
$label = app('navigation')->periodShow($current, $step);
|
||||
$entries[$label] = $balance;
|
||||
$current = app('navigation')->addPeriod($current, $step, 0);
|
||||
@@ -510,22 +510,22 @@ class AccountController extends Controller
|
||||
|
||||
// loop the end balances. This is an array for each account ($expenses)
|
||||
foreach ($endBalances as $accountId => $expenses) {
|
||||
$accountId = (int)$accountId;
|
||||
$accountId = (int) $accountId;
|
||||
// loop each expense entry (each entry can be a different currency).
|
||||
foreach ($expenses as $currencyId => $endAmount) {
|
||||
$currencyId = (int)$currencyId;
|
||||
$currencyId = (int) $currencyId;
|
||||
|
||||
// see if there is an accompanying start amount.
|
||||
// grab the difference and find the currency.
|
||||
$startAmount = (string)($startBalances[$accountId][$currencyId] ?? '0');
|
||||
$diff = bcsub((string)$endAmount, $startAmount);
|
||||
$startAmount = (string) ($startBalances[$accountId][$currencyId] ?? '0');
|
||||
$diff = bcsub((string) $endAmount, $startAmount);
|
||||
$currencies[$currencyId] ??= $this->currencyRepository->find($currencyId);
|
||||
if (0 !== bccomp($diff, '0')) {
|
||||
// store the values in a temporary array.
|
||||
$tempData[] = [
|
||||
'name' => $accountNames[$accountId],
|
||||
'difference' => $diff,
|
||||
'diff_float' => (float)$diff, // intentional float
|
||||
'diff_float' => (float) $diff, // intentional float
|
||||
'currency_id' => $currencyId,
|
||||
];
|
||||
}
|
||||
@@ -544,7 +544,7 @@ class AccountController extends Controller
|
||||
foreach ($currencies as $currencyId => $currency) {
|
||||
$dataSet
|
||||
= [
|
||||
'label' => (string)trans('firefly.earned'),
|
||||
'label' => (string) trans('firefly.earned'),
|
||||
'type' => 'bar',
|
||||
'currency_symbol' => $currency->symbol,
|
||||
'currency_code' => $currency->code,
|
||||
|
||||
@@ -72,7 +72,7 @@ class BillController extends Controller
|
||||
*/
|
||||
foreach ($paid as $info) {
|
||||
$amount = $info['sum'];
|
||||
$label = (string)trans('firefly.paid_in_currency', ['currency' => $info['name']]);
|
||||
$label = (string) trans('firefly.paid_in_currency', ['currency' => $info['name']]);
|
||||
$chartData[$label] = [
|
||||
'amount' => $amount,
|
||||
'currency_symbol' => $info['symbol'],
|
||||
@@ -85,7 +85,7 @@ class BillController extends Controller
|
||||
*/
|
||||
foreach ($unpaid as $info) {
|
||||
$amount = $info['sum'];
|
||||
$label = (string)trans('firefly.unpaid_in_currency', ['currency' => $info['name']]);
|
||||
$label = (string) trans('firefly.unpaid_in_currency', ['currency' => $info['name']]);
|
||||
$chartData[$label] = [
|
||||
'amount' => $amount,
|
||||
'currency_symbol' => $info['symbol'],
|
||||
@@ -136,21 +136,21 @@ class BillController extends Controller
|
||||
$chartData = [
|
||||
[
|
||||
'type' => 'line',
|
||||
'label' => (string)trans('firefly.min-amount'),
|
||||
'label' => (string) trans('firefly.min-amount'),
|
||||
'currency_symbol' => $bill->transactionCurrency->symbol,
|
||||
'currency_code' => $bill->transactionCurrency->code,
|
||||
'entries' => [],
|
||||
],
|
||||
[
|
||||
'type' => 'line',
|
||||
'label' => (string)trans('firefly.max-amount'),
|
||||
'label' => (string) trans('firefly.max-amount'),
|
||||
'currency_symbol' => $bill->transactionCurrency->symbol,
|
||||
'currency_code' => $bill->transactionCurrency->code,
|
||||
'entries' => [],
|
||||
],
|
||||
[
|
||||
'type' => 'bar',
|
||||
'label' => (string)trans('firefly.journal-amount'),
|
||||
'label' => (string) trans('firefly.journal-amount'),
|
||||
'currency_symbol' => $bill->transactionCurrency->symbol,
|
||||
'currency_code' => $bill->transactionCurrency->code,
|
||||
'entries' => [],
|
||||
@@ -158,7 +158,7 @@ class BillController extends Controller
|
||||
];
|
||||
$currencyId = $bill->transaction_currency_id;
|
||||
foreach ($journals as $journal) {
|
||||
$date = $journal['date']->isoFormat((string)trans('config.month_and_day_js', [], $locale));
|
||||
$date = $journal['date']->isoFormat((string) trans('config.month_and_day_js', [], $locale));
|
||||
$chartData[0]['entries'][$date] = $bill->amount_min; // minimum amount of bill
|
||||
$chartData[1]['entries'][$date] = $bill->amount_max; // maximum amount of bill
|
||||
|
||||
|
||||
@@ -172,12 +172,12 @@ class BudgetController extends Controller
|
||||
$expenses = $this->opsRepository->sumExpenses($current, $current, null, $budgetCollection, $currency);
|
||||
$spent = $expenses[$currency->id]['sum'] ?? '0';
|
||||
$amount = bcadd($amount, $spent);
|
||||
$format = $start->isoFormat((string)trans('config.month_and_day_js', [], $locale));
|
||||
$format = $start->isoFormat((string) trans('config.month_and_day_js', [], $locale));
|
||||
$entries[$format] = $amount;
|
||||
|
||||
$start->addDay();
|
||||
}
|
||||
$data = $this->generator->singleSet((string)trans('firefly.left'), $entries);
|
||||
$data = $this->generator->singleSet((string) trans('firefly.left'), $entries);
|
||||
// add currency symbol from budget limit:
|
||||
$data['datasets'][0]['currency_symbol'] = $budgetLimit->transactionCurrency->symbol;
|
||||
$data['datasets'][0]['currency_code'] = $budgetLimit->transactionCurrency->code;
|
||||
@@ -220,7 +220,7 @@ class BudgetController extends Controller
|
||||
|
||||
// group by asset account ID:
|
||||
foreach ($journals as $journal) {
|
||||
$key = sprintf('%d-%d', (int)$journal['source_account_id'], $journal['currency_id']);
|
||||
$key = sprintf('%d-%d', (int) $journal['source_account_id'], $journal['currency_id']);
|
||||
$result[$key] ??= [
|
||||
'amount' => '0',
|
||||
'currency_symbol' => $journal['currency_symbol'],
|
||||
@@ -233,7 +233,7 @@ class BudgetController extends Controller
|
||||
$names = $this->getAccountNames(array_keys($result));
|
||||
foreach ($result as $combinedId => $info) {
|
||||
$parts = explode('-', $combinedId);
|
||||
$assetId = (int)$parts[0];
|
||||
$assetId = (int) $parts[0];
|
||||
$title = sprintf('%s (%s)', $names[$assetId] ?? '(empty)', $info['currency_name']);
|
||||
$chartData[$title]
|
||||
= [
|
||||
@@ -293,7 +293,7 @@ class BudgetController extends Controller
|
||||
$names = $this->getCategoryNames(array_keys($result));
|
||||
foreach ($result as $combinedId => $info) {
|
||||
$parts = explode('-', $combinedId);
|
||||
$categoryId = (int)$parts[0];
|
||||
$categoryId = (int) $parts[0];
|
||||
$title = sprintf('%s (%s)', $names[$categoryId] ?? '(empty)', $info['currency_name']);
|
||||
$chartData[$title] = [
|
||||
'amount' => $info['amount'],
|
||||
@@ -353,7 +353,7 @@ class BudgetController extends Controller
|
||||
$names = $this->getAccountNames(array_keys($result));
|
||||
foreach ($result as $combinedId => $info) {
|
||||
$parts = explode('-', $combinedId);
|
||||
$opposingId = (int)$parts[0];
|
||||
$opposingId = (int) $parts[0];
|
||||
$name = $names[$opposingId] ?? 'no name';
|
||||
$title = sprintf('%s (%s)', $name, $info['currency_name']);
|
||||
$chartData[$title] = [
|
||||
@@ -422,14 +422,14 @@ class BudgetController extends Controller
|
||||
$preferredRange = app('navigation')->preferredRangeFormat($start, $end);
|
||||
$chartData = [
|
||||
[
|
||||
'label' => (string)trans('firefly.box_spent_in_currency', ['currency' => $currency->name]),
|
||||
'label' => (string) trans('firefly.box_spent_in_currency', ['currency' => $currency->name]),
|
||||
'type' => 'bar',
|
||||
'entries' => [],
|
||||
'currency_symbol' => $currency->symbol,
|
||||
'currency_code' => $currency->code,
|
||||
],
|
||||
[
|
||||
'label' => (string)trans('firefly.box_budgeted_in_currency', ['currency' => $currency->name]),
|
||||
'label' => (string) trans('firefly.box_budgeted_in_currency', ['currency' => $currency->name]),
|
||||
'type' => 'bar',
|
||||
'currency_symbol' => $currency->symbol,
|
||||
'currency_code' => $currency->code,
|
||||
@@ -500,7 +500,7 @@ class BudgetController extends Controller
|
||||
$currentStart = app('navigation')->addPeriod($currentStart, $preferredRange, 0);
|
||||
}
|
||||
|
||||
$data = $this->generator->singleSet((string)trans('firefly.spent'), $chartData);
|
||||
$data = $this->generator->singleSet((string) trans('firefly.spent'), $chartData);
|
||||
$cache->store($data);
|
||||
|
||||
return response()->json($data);
|
||||
|
||||
@@ -171,7 +171,7 @@ class BudgetReportController extends Controller
|
||||
$chartData[$spentKey] ??= [
|
||||
'label' => sprintf(
|
||||
'%s (%s)',
|
||||
(string)trans('firefly.spent_in_specific_budget', ['budget' => $budget->name]),
|
||||
(string) trans('firefly.spent_in_specific_budget', ['budget' => $budget->name]),
|
||||
$currency['currency_name']
|
||||
),
|
||||
'type' => 'bar',
|
||||
|
||||
@@ -185,7 +185,7 @@ class CategoryController extends Controller
|
||||
$inKey = sprintf('%d-in', $currencyId);
|
||||
$chartData[$outKey]
|
||||
= [
|
||||
'label' => sprintf('%s (%s)', (string)trans('firefly.spent'), $currencyInfo['currency_name']),
|
||||
'label' => sprintf('%s (%s)', (string) trans('firefly.spent'), $currencyInfo['currency_name']),
|
||||
'entries' => [],
|
||||
'type' => 'bar',
|
||||
'backgroundColor' => 'rgba(219, 68, 55, 0.5)', // red
|
||||
@@ -193,7 +193,7 @@ class CategoryController extends Controller
|
||||
|
||||
$chartData[$inKey]
|
||||
= [
|
||||
'label' => sprintf('%s (%s)', (string)trans('firefly.earned'), $currencyInfo['currency_name']),
|
||||
'label' => sprintf('%s (%s)', (string) trans('firefly.earned'), $currencyInfo['currency_name']),
|
||||
'entries' => [],
|
||||
'type' => 'bar',
|
||||
'backgroundColor' => 'rgba(0, 141, 76, 0.5)', // green
|
||||
|
||||
@@ -218,7 +218,7 @@ class CategoryReportController extends Controller
|
||||
$chartData[$spentKey] ??= [
|
||||
'label' => sprintf(
|
||||
'%s (%s)',
|
||||
(string)trans('firefly.spent_in_specific_category', ['category' => $category->name]),
|
||||
(string) trans('firefly.spent_in_specific_category', ['category' => $category->name]),
|
||||
$currency['currency_name']
|
||||
),
|
||||
'type' => 'bar',
|
||||
@@ -245,7 +245,7 @@ class CategoryReportController extends Controller
|
||||
$chartData[$spentKey] ??= [
|
||||
'label' => sprintf(
|
||||
'%s (%s)',
|
||||
(string)trans('firefly.earned_in_specific_category', ['category' => $category->name]),
|
||||
(string) trans('firefly.earned_in_specific_category', ['category' => $category->name]),
|
||||
$currency['currency_name']
|
||||
),
|
||||
'type' => 'bar',
|
||||
|
||||
@@ -164,7 +164,7 @@ class DoubleReportController extends Controller
|
||||
$chartData[$spentKey] ??= [
|
||||
'label' => sprintf(
|
||||
'%s (%s)',
|
||||
(string)trans('firefly.spent_in_specific_double', ['account' => $name]),
|
||||
(string) trans('firefly.spent_in_specific_double', ['account' => $name]),
|
||||
$currency['currency_name']
|
||||
),
|
||||
'type' => 'bar',
|
||||
@@ -190,7 +190,7 @@ class DoubleReportController extends Controller
|
||||
$chartData[$earnedKey] ??= [
|
||||
'label' => sprintf(
|
||||
'%s (%s)',
|
||||
(string)trans('firefly.earned_in_specific_double', ['account' => $name]),
|
||||
(string) trans('firefly.earned_in_specific_double', ['account' => $name]),
|
||||
$currency['currency_name']
|
||||
),
|
||||
'type' => 'bar',
|
||||
|
||||
@@ -103,27 +103,27 @@ class ExpenseReportController extends Controller
|
||||
/** @var Account $exp */
|
||||
$exp = $combination->first();
|
||||
$chartData[$exp->id.'-in'] = [
|
||||
'label' => sprintf('%s (%s)', $name, (string)trans('firefly.income')),
|
||||
'label' => sprintf('%s (%s)', $name, (string) trans('firefly.income')),
|
||||
'type' => 'bar',
|
||||
'yAxisID' => 'y-axis-0',
|
||||
'entries' => [],
|
||||
];
|
||||
$chartData[$exp->id.'-out'] = [
|
||||
'label' => sprintf('%s (%s)', $name, (string)trans('firefly.expenses')),
|
||||
'label' => sprintf('%s (%s)', $name, (string) trans('firefly.expenses')),
|
||||
'type' => 'bar',
|
||||
'yAxisID' => 'y-axis-0',
|
||||
'entries' => [],
|
||||
];
|
||||
// total in, total out:
|
||||
$chartData[$exp->id.'-total-in'] = [
|
||||
'label' => sprintf('%s (%s)', $name, (string)trans('firefly.sum_of_income')),
|
||||
'label' => sprintf('%s (%s)', $name, (string) trans('firefly.sum_of_income')),
|
||||
'type' => 'line',
|
||||
'fill' => false,
|
||||
'yAxisID' => 'y-axis-1',
|
||||
'entries' => [],
|
||||
];
|
||||
$chartData[$exp->id.'-total-out'] = [
|
||||
'label' => sprintf('%s (%s)', $name, (string)trans('firefly.sum_of_expenses')),
|
||||
'label' => sprintf('%s (%s)', $name, (string) trans('firefly.sum_of_expenses')),
|
||||
'type' => 'line',
|
||||
'fill' => false,
|
||||
'yAxisID' => 'y-axis-1',
|
||||
|
||||
@@ -95,7 +95,7 @@ class PiggyBankController extends Controller
|
||||
}
|
||||
);
|
||||
$currentSum = $filtered->sum('amount');
|
||||
$label = $oldest->isoFormat((string)trans('config.month_and_day_js', [], $locale));
|
||||
$label = $oldest->isoFormat((string) trans('config.month_and_day_js', [], $locale));
|
||||
$chartData[$label] = $currentSum;
|
||||
$oldest = app('navigation')->addPeriod($oldest, $step, 0);
|
||||
}
|
||||
@@ -105,7 +105,7 @@ class PiggyBankController extends Controller
|
||||
}
|
||||
);
|
||||
$finalSum = $finalFiltered->sum('amount');
|
||||
$finalLabel = $today->isoFormat((string)trans('config.month_and_day_js', [], $locale));
|
||||
$finalLabel = $today->isoFormat((string) trans('config.month_and_day_js', [], $locale));
|
||||
$chartData[$finalLabel] = $finalSum;
|
||||
|
||||
$data = $this->generator->singleSet($piggyBank->name, $chartData);
|
||||
|
||||
@@ -109,7 +109,7 @@ class ReportController extends Controller
|
||||
continue;
|
||||
}
|
||||
$currencyId = $netWorthItem['currency_id'];
|
||||
$label = $current->isoFormat((string)trans('config.month_and_day_js', [], $locale));
|
||||
$label = $current->isoFormat((string) trans('config.month_and_day_js', [], $locale));
|
||||
if (!array_key_exists($currencyId, $chartData)) {
|
||||
$chartData[$currencyId] = [
|
||||
'label' => 'Net worth in '.$netWorthItem['currency_name'],
|
||||
@@ -175,13 +175,13 @@ class ReportController extends Controller
|
||||
/** @var array $journal */
|
||||
foreach ($journals as $journal) {
|
||||
$period = $journal['date']->format($format);
|
||||
$currencyId = (int)$journal['currency_id'];
|
||||
$currencyId = (int) $journal['currency_id'];
|
||||
$data[$currencyId] ??= [
|
||||
'currency_id' => $currencyId,
|
||||
'currency_symbol' => $journal['currency_symbol'],
|
||||
'currency_code' => $journal['currency_code'],
|
||||
'currency_name' => $journal['currency_name'],
|
||||
'currency_decimal_places' => (int)$journal['currency_decimal_places'],
|
||||
'currency_decimal_places' => (int) $journal['currency_decimal_places'],
|
||||
];
|
||||
$data[$currencyId][$period] ??= [
|
||||
'period' => $period,
|
||||
@@ -198,8 +198,8 @@ class ReportController extends Controller
|
||||
TransactionTypeEnum::DEPOSIT->value === $journal['transaction_type_type']
|
||||
|| ((
|
||||
TransactionTypeEnum::TRANSFER->value === $journal['transaction_type_type']
|
||||
|| TransactionTypeEnum::RECONCILIATION->value === $journal['transaction_type_type']
|
||||
|| TransactionTypeEnum::OPENING_BALANCE->value === $journal['transaction_type_type']
|
||||
|| TransactionTypeEnum::RECONCILIATION->value === $journal['transaction_type_type']
|
||||
|| TransactionTypeEnum::OPENING_BALANCE->value === $journal['transaction_type_type']
|
||||
)
|
||||
&& in_array($journal['destination_account_id'], $ids, true))) {
|
||||
$key = 'earned';
|
||||
@@ -214,7 +214,7 @@ class ReportController extends Controller
|
||||
foreach ($data as $currency) {
|
||||
Log::debug(sprintf('Now processing currency "%s"', $currency['currency_name']));
|
||||
$income = [
|
||||
'label' => (string)trans('firefly.box_earned_in_currency', ['currency' => $currency['currency_name']]),
|
||||
'label' => (string) trans('firefly.box_earned_in_currency', ['currency' => $currency['currency_name']]),
|
||||
'type' => 'bar',
|
||||
'backgroundColor' => 'rgba(0, 141, 76, 0.5)', // green
|
||||
'currency_id' => $currency['currency_id'],
|
||||
@@ -223,7 +223,7 @@ class ReportController extends Controller
|
||||
'entries' => [],
|
||||
];
|
||||
$expense = [
|
||||
'label' => (string)trans('firefly.box_spent_in_currency', ['currency' => $currency['currency_name']]),
|
||||
'label' => (string) trans('firefly.box_spent_in_currency', ['currency' => $currency['currency_name']]),
|
||||
'type' => 'bar',
|
||||
'backgroundColor' => 'rgba(219, 68, 55, 0.5)', // red
|
||||
'currency_id' => $currency['currency_id'],
|
||||
|
||||
@@ -222,7 +222,7 @@ class TagReportController extends Controller
|
||||
$chartData[$spentKey] ??= [
|
||||
'label' => sprintf(
|
||||
'%s (%s)',
|
||||
(string)trans('firefly.spent_in_specific_tag', ['tag' => $tag->tag]),
|
||||
(string) trans('firefly.spent_in_specific_tag', ['tag' => $tag->tag]),
|
||||
$currency['currency_name']
|
||||
),
|
||||
'type' => 'bar',
|
||||
@@ -249,7 +249,7 @@ class TagReportController extends Controller
|
||||
$chartData[$spentKey] ??= [
|
||||
'label' => sprintf(
|
||||
'%s (%s)',
|
||||
(string)trans('firefly.earned_in_specific_tag', ['tag' => $tag->tag]),
|
||||
(string) trans('firefly.earned_in_specific_tag', ['tag' => $tag->tag]),
|
||||
$currency['currency_name']
|
||||
),
|
||||
'type' => 'bar',
|
||||
|
||||
@@ -74,7 +74,7 @@ class TransactionController extends Controller
|
||||
// group by category.
|
||||
/** @var array $journal */
|
||||
foreach ($result as $journal) {
|
||||
$budget = $journal['budget_name'] ?? (string)trans('firefly.no_budget');
|
||||
$budget = $journal['budget_name'] ?? (string) trans('firefly.no_budget');
|
||||
$title = sprintf('%s (%s)', $budget, $journal['currency_symbol']);
|
||||
$data[$title] ??= [
|
||||
'amount' => '0',
|
||||
@@ -124,7 +124,7 @@ class TransactionController extends Controller
|
||||
// group by category.
|
||||
/** @var array $journal */
|
||||
foreach ($result as $journal) {
|
||||
$category = $journal['category_name'] ?? (string)trans('firefly.no_category');
|
||||
$category = $journal['category_name'] ?? (string) trans('firefly.no_category');
|
||||
$title = sprintf('%s (%s)', $category, $journal['currency_symbol']);
|
||||
$data[$title] ??= [
|
||||
'amount' => '0',
|
||||
|
||||
Reference in New Issue
Block a user