mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-10-12 15:35:15 +00:00
PHPStorm can order methods by alphabet, who knew.
This commit is contained in:
@@ -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);
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user