PHPStorm can order methods by alphabet, who knew.

This commit is contained in:
James Cole
2024-02-22 20:11:09 +01:00
parent f9d4a43e05
commit 68c9c4ec3c
221 changed files with 5840 additions and 5843 deletions

View File

@@ -91,59 +91,6 @@ class BudgetReportGenerator
}
}
/**
* Generates the data necessary to create the card that displays
* the budget overview in the general report.
*/
public function general(): void
{
$this->report = [
'budgets' => [],
'sums' => [],
];
$this->generalBudgetReport();
$this->noBudgetReport();
$this->percentageReport();
}
public function getReport(): array
{
return $this->report;
}
public function setAccounts(Collection $accounts): void
{
$this->accounts = $accounts;
}
public function setBudgets(Collection $budgets): void
{
$this->budgets = $budgets;
}
public function setEnd(Carbon $end): void
{
$this->end = $end;
}
public function setStart(Carbon $start): void
{
$this->start = $start;
}
/**
* @throws FireflyException
*/
public function setUser(User $user): void
{
$this->repository->setUser($user);
$this->blRepository->setUser($user);
$this->opsRepository->setUser($user);
$this->nbRepository->setUser($user);
$this->currency = app('amount')->getDefaultCurrencyByUserGroup($user->userGroup);
}
/**
* Process each row of expenses collected for the "Account per budget" partial
*/
@@ -181,6 +128,22 @@ class BudgetReportGenerator
}
}
/**
* Generates the data necessary to create the card that displays
* the budget overview in the general report.
*/
public function general(): void
{
$this->report = [
'budgets' => [],
'sums' => [],
];
$this->generalBudgetReport();
$this->noBudgetReport();
$this->percentageReport();
}
/**
* Start the budgets block on the default report by processing every budget.
*/
@@ -250,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));
@@ -349,4 +312,41 @@ class BudgetReportGenerator
}
}
}
public function getReport(): array
{
return $this->report;
}
public function setAccounts(Collection $accounts): void
{
$this->accounts = $accounts;
}
public function setBudgets(Collection $budgets): void
{
$this->budgets = $budgets;
}
public function setEnd(Carbon $end): void
{
$this->end = $end;
}
public function setStart(Carbon $start): void
{
$this->start = $start;
}
/**
* @throws FireflyException
*/
public function setUser(User $user): void
{
$this->repository->setUser($user);
$this->blRepository->setUser($user);
$this->opsRepository->setUser($user);
$this->nbRepository->setUser($user);
$this->currency = app('amount')->getDefaultCurrencyByUserGroup($user->userGroup);
}
}