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:
@@ -138,41 +138,6 @@ class AccountTasker implements AccountTaskerInterface
|
||||
return $report;
|
||||
}
|
||||
|
||||
/**
|
||||
* @throws FireflyException
|
||||
*/
|
||||
public function getIncomeReport(Carbon $start, Carbon $end, Collection $accounts): array
|
||||
{
|
||||
// get all incomes for the given accounts in the given period!
|
||||
// also transfers!
|
||||
// get all transactions:
|
||||
|
||||
/** @var GroupCollectorInterface $collector */
|
||||
$collector = app(GroupCollectorInterface::class);
|
||||
$collector->setDestinationAccounts($accounts)->setRange($start, $end);
|
||||
$collector->excludeSourceAccounts($accounts);
|
||||
$collector->setTypes([TransactionType::DEPOSIT, TransactionType::TRANSFER])->withAccountInformation();
|
||||
$report = $this->groupIncomeBySource($collector->getExtractedJournals());
|
||||
|
||||
// sort the result
|
||||
// Obtain a list of columns
|
||||
$sum = [];
|
||||
foreach ($report['accounts'] as $accountId => $row) {
|
||||
$sum[$accountId] = (float)$row['sum']; // intentional float
|
||||
}
|
||||
|
||||
array_multisort($sum, SORT_DESC, $report['accounts']);
|
||||
|
||||
return $report;
|
||||
}
|
||||
|
||||
public function setUser(null|Authenticatable|User $user): void
|
||||
{
|
||||
if ($user instanceof User) {
|
||||
$this->user = $user;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @throws FireflyException
|
||||
*/
|
||||
@@ -233,6 +198,34 @@ class AccountTasker implements AccountTaskerInterface
|
||||
return $report;
|
||||
}
|
||||
|
||||
/**
|
||||
* @throws FireflyException
|
||||
*/
|
||||
public function getIncomeReport(Carbon $start, Carbon $end, Collection $accounts): array
|
||||
{
|
||||
// get all incomes for the given accounts in the given period!
|
||||
// also transfers!
|
||||
// get all transactions:
|
||||
|
||||
/** @var GroupCollectorInterface $collector */
|
||||
$collector = app(GroupCollectorInterface::class);
|
||||
$collector->setDestinationAccounts($accounts)->setRange($start, $end);
|
||||
$collector->excludeSourceAccounts($accounts);
|
||||
$collector->setTypes([TransactionType::DEPOSIT, TransactionType::TRANSFER])->withAccountInformation();
|
||||
$report = $this->groupIncomeBySource($collector->getExtractedJournals());
|
||||
|
||||
// sort the result
|
||||
// Obtain a list of columns
|
||||
$sum = [];
|
||||
foreach ($report['accounts'] as $accountId => $row) {
|
||||
$sum[$accountId] = (float)$row['sum']; // intentional float
|
||||
}
|
||||
|
||||
array_multisort($sum, SORT_DESC, $report['accounts']);
|
||||
|
||||
return $report;
|
||||
}
|
||||
|
||||
/**
|
||||
* @throws FireflyException
|
||||
*/
|
||||
@@ -291,4 +284,11 @@ class AccountTasker implements AccountTaskerInterface
|
||||
|
||||
return $report;
|
||||
}
|
||||
|
||||
public function setUser(null|Authenticatable|User $user): void
|
||||
{
|
||||
if ($user instanceof User) {
|
||||
$this->user = $user;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user