Fix list for no budget #159

This commit is contained in:
James Cole
2016-04-01 16:23:12 +02:00
parent 144a6130f2
commit 3fbedf323f
5 changed files with 42 additions and 15 deletions

View File

@@ -66,11 +66,12 @@ class ReportController extends Controller
$repository = app('FireflyIII\Repositories\Budget\BudgetRepositoryInterface');
$budget = $repository->find(intval($attributes['budgetId']));
if (is_null($budget->id)) {
throw new FireflyException('Could not find a budget for value "' . e($attributes['budgetId']) . '".');
$journals = $repository->getWithoutBudgetForAccounts($attributes['accounts'], $attributes['startDate'], $attributes['endDate']);
} else {
// get all expenses in budget in period:
$journals = $repository->getExpenses($budget, $attributes['accounts'], $attributes['startDate'], $attributes['endDate']);
}
// get all expenses in budget in period:
$journals = $repository->getExpenses($budget, $attributes['accounts'], $attributes['startDate'], $attributes['endDate']);
$view = view('popup.report.budget-spent-amount', compact('journals'))->render();