More code for #159 [skip ci]

This commit is contained in:
James Cole
2016-04-03 11:14:36 +02:00
parent 885b56c465
commit 03691c81c2
4 changed files with 88 additions and 13 deletions

View File

@@ -48,6 +48,9 @@ class ReportController extends Controller
case 'expense-entry':
$html = $this->expenseEntry($attributes);
break;
case 'income-entry':
$html = $this->incomeEntry($attributes);
break;
}
return Response::json(['html' => $html]);
@@ -83,6 +86,25 @@ class ReportController extends Controller
return $view;
}
/**
* Returns all the incomes that went to the given asset account.
*
* @param $attributes
*
* @return string
* @throws FireflyException
*/
private function incomeEntry($attributes)
{
/** @var AccountRepositoryInterface $repository */
$repository = app('FireflyIII\Repositories\Account\AccountRepositoryInterface');
$account = $repository->find(intval($attributes['accountId']));
$journals = $repository->getIncomeByDestination($account, $attributes['accounts'], $attributes['startDate'], $attributes['endDate']);
$view = view('popup.report.income-entry', compact('journals'))->render();
return $view;
}
/**
* Returns all the expenses that went to the given expense account.
*