mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-10-22 20:16:22 +00:00
Code cleanup.
This commit is contained in:
@@ -17,18 +17,15 @@ use FireflyIII\Helpers\Collection\Balance;
|
||||
use FireflyIII\Helpers\Collection\BalanceEntry;
|
||||
use FireflyIII\Helpers\Collection\BalanceHeader;
|
||||
use FireflyIII\Helpers\Collection\BalanceLine;
|
||||
use FireflyIII\Models\Account;
|
||||
use FireflyIII\Models\Budget;
|
||||
use FireflyIII\Models\Budget as BudgetModel;
|
||||
use FireflyIII\Models\LimitRepetition;
|
||||
use FireflyIII\Models\Tag;
|
||||
use FireflyIII\Models\TransactionJournal;
|
||||
use FireflyIII\Models\TransactionType;
|
||||
use FireflyIII\Repositories\Budget\BudgetRepositoryInterface;
|
||||
use FireflyIII\Repositories\Tag\TagRepositoryInterface;
|
||||
use Illuminate\Database\Query\JoinClause;
|
||||
use Illuminate\Support\Collection;
|
||||
use Log;
|
||||
|
||||
/**
|
||||
* Class BalanceReportHelper
|
||||
@@ -67,19 +64,16 @@ class BalanceReportHelper implements BalanceReportHelperInterface
|
||||
public function getBalanceReport(Carbon $start, Carbon $end, Collection $accounts): Balance
|
||||
{
|
||||
$balance = new Balance;
|
||||
Log::debug('Build new report.');
|
||||
// build a balance header:
|
||||
$header = new BalanceHeader;
|
||||
$limitRepetitions = $this->budgetRepository->getAllBudgetLimitRepetitions($start, $end);
|
||||
foreach ($accounts as $account) {
|
||||
$header->addAccount($account);
|
||||
Log::debug('Add account #' . $account->id . ' to header.');
|
||||
}
|
||||
|
||||
/** @var LimitRepetition $repetition */
|
||||
foreach ($limitRepetitions as $repetition) {
|
||||
$budget = $this->budgetRepository->find($repetition->budget_id);
|
||||
Log::debug('Create and add balance line for budget #' . $budget->id);
|
||||
$balance->addBalanceLine($this->createBalanceLine($budget, $repetition, $accounts));
|
||||
}
|
||||
$noBudgetLine = $this->createNoBudgetLine($accounts, $start, $end);
|
||||
@@ -155,7 +149,6 @@ class BalanceReportHelper implements BalanceReportHelperInterface
|
||||
*/
|
||||
private function createBalanceLine(BudgetModel $budget, LimitRepetition $repetition, Collection $accounts): BalanceLine
|
||||
{
|
||||
Log::debug('Create line for budget #' . $budget->id . ' and repetition #' . $repetition->id);
|
||||
$line = new BalanceLine;
|
||||
$budget->amount = $repetition->amount;
|
||||
$line->setBudget($budget);
|
||||
|
Reference in New Issue
Block a user