diff --git a/app/Http/Controllers/BudgetController.php b/app/Http/Controllers/BudgetController.php index e680e5e2c5..00587db566 100644 --- a/app/Http/Controllers/BudgetController.php +++ b/app/Http/Controllers/BudgetController.php @@ -233,20 +233,15 @@ class BudgetController extends Controller $journals = $repository->getJournals($budget, $repetition); if (is_null($repetition->id)) { - $start = $repository->firstActivity($budget); - $end = new Carbon; - $set = $budget->limitrepetitions()->orderBy('startdate', 'DESC')->get(); - //$set = $repository->getBudgetLimits($budget); - //$subTitle = e($budget->name); + $start = $repository->firstActivity($budget); + $end = new Carbon; + $set = $budget->limitrepetitions()->orderBy('startdate', 'DESC')->get(); + $subTitle = e($budget->name); } else { - $start = $repetition->startdate; - $end = $repetition->enddate; - $set = new Collection([$repetition]); - // $spentArray = $repository->spentPerDay($budget, $start, $end); - // $budgetLimit = $repetition->budgetLimit; - // $budgetLimit->spent = $this->getSumOfRange($start, $end, $spentArray); // bit weird but it works. - // $limits = new Collection([$budgetLimit]); - //$subTitle = trans('firefly.budget_in_month', ['name' => $budget->name, 'month' => $repetition->startdate->formatLocalized($this->monthFormat)]); + $start = $repetition->startdate; + $end = $repetition->enddate; + $set = new Collection([$repetition]); + $subTitle = trans('firefly.budget_in_month', ['name' => $budget->name, 'month' => $repetition->startdate->formatLocalized($this->monthFormat)]); } $spentArray = $repository->spentPerDay($budget, $start, $end); @@ -258,13 +253,6 @@ class BudgetController extends Controller $limits->push($entry); } - // loop limits and set the amount spent for each limit. - // /** @var BudgetLimit $budgetLimit */ - // foreach ($set as $budgetLimit) { - // $start = $budgetLimit->startdate; - // $end = $budgetLimit->lim - // } - $journals->setPath('/budgets/show/' . $budget->id); return view('budgets.show', compact('limits', 'budget', 'repetition', 'journals', 'subTitle')); diff --git a/app/Repositories/Budget/BudgetRepository.php b/app/Repositories/Budget/BudgetRepository.php index 8e45a05653..ca8723bc5f 100644 --- a/app/Repositories/Budget/BudgetRepository.php +++ b/app/Repositories/Budget/BudgetRepository.php @@ -203,17 +203,6 @@ class BudgetRepository extends ComponentRepository implements BudgetRepositoryIn ->get(['limit_repetitions.*', 'budget_limits.budget_id']); } - /** - * @param Budget $budget - * - * @return Collection - */ - public function getBudgetLimits(Budget $budget) - { - return $budget->budgetLimits()->orderBy('startdate', 'DESC')->get(); - } - - /** * Returns an array with the following key:value pairs: * diff --git a/app/Repositories/Budget/BudgetRepositoryInterface.php b/app/Repositories/Budget/BudgetRepositoryInterface.php index af0eedc769..1bec454037 100644 --- a/app/Repositories/Budget/BudgetRepositoryInterface.php +++ b/app/Repositories/Budget/BudgetRepositoryInterface.php @@ -160,13 +160,6 @@ interface BudgetRepositoryInterface */ public function getAllBudgetLimitRepetitions(Carbon $start, Carbon $end); - /** - * @param Budget $budget - * - * @return Collection - */ - public function getBudgetLimits(Budget $budget); - /** * @return Collection */