Various code cleanup.

This commit is contained in:
James Cole
2023-11-05 19:41:37 +01:00
parent a0564751d6
commit 1d2e95f5af
136 changed files with 1171 additions and 514 deletions

View File

@@ -164,7 +164,7 @@ class BillController extends Controller
'entries' => [],
],
];
$currencyId = (int)$bill->transaction_currency_id;
$currencyId = $bill->transaction_currency_id;
foreach ($journals as $journal) {
$date = $journal['date']->isoFormat((string)trans('config.month_and_day_js', [], $locale));
$chartData[0]['entries'][$date] = $bill->amount_min; // minimum amount of bill

View File

@@ -181,7 +181,7 @@ class BudgetController extends Controller
while ($start <= $end) {
$current = clone $start;
$expenses = $this->opsRepository->sumExpenses($current, $current, null, $budgetCollection, $currency);
$spent = $expenses[(int)$currency->id]['sum'] ?? '0';
$spent = $expenses[$currency->id]['sum'] ?? '0';
$amount = bcadd($amount, $spent);
$format = $start->isoFormat((string)trans('config.month_and_day_js', [], $locale));
$entries[$format] = $amount;

View File

@@ -193,7 +193,7 @@ class CategoryController extends Controller
if (null !== $category) {
/** @var OperationsRepositoryInterface $opsRepository */
$opsRepository = app(OperationsRepositoryInterface::class);
$categoryId = (int)$category->id;
$categoryId = $category->id;
// this gives us all currencies
$collection = new Collection([$category]);
$expenses = $opsRepository->listExpenses($start, $end, null, $collection);