mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-09-23 14:26:58 +00:00
Category information. #159
This commit is contained in:
@@ -16,6 +16,7 @@ use FireflyIII\Exceptions\FireflyException;
|
||||
use FireflyIII\Http\Controllers\Controller;
|
||||
use FireflyIII\Repositories\Account\AccountRepositoryInterface;
|
||||
use FireflyIII\Repositories\Budget\BudgetRepositoryInterface;
|
||||
use FireflyIII\Repositories\Category\SingleCategoryRepositoryInterface;
|
||||
use FireflyIII\Support\Binder\AccountList;
|
||||
use Illuminate\Http\Request;
|
||||
use InvalidArgumentException;
|
||||
@@ -51,6 +52,9 @@ class ReportController extends Controller
|
||||
case 'income-entry':
|
||||
$html = $this->incomeEntry($attributes);
|
||||
break;
|
||||
case 'category-entry':
|
||||
$html = $this->categoryEntry($attributes);
|
||||
break;
|
||||
}
|
||||
|
||||
return Response::json(['html' => $html]);
|
||||
@@ -87,20 +91,20 @@ class ReportController extends Controller
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns all the incomes that went to the given asset account.
|
||||
* Returns all expenses in category in range.
|
||||
*
|
||||
* @param $attributes
|
||||
*
|
||||
* @return string
|
||||
* @throws FireflyException
|
||||
*/
|
||||
private function incomeEntry($attributes)
|
||||
private function categoryEntry($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();
|
||||
/** @var SingleCategoryRepositoryInterface $repository */
|
||||
$repository = app('FireflyIII\Repositories\Category\SingleCategoryRepositoryInterface');
|
||||
$category = $repository->find(intval($attributes['categoryId']));
|
||||
$journals = $repository->getJournalsForAccountsInRange($category, $attributes['accounts'], $attributes['startDate'], $attributes['endDate']);
|
||||
$view = view('popup.report.category-entry', compact('journals'))->render();
|
||||
|
||||
return $view;
|
||||
}
|
||||
@@ -124,6 +128,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;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param array $attributes
|
||||
*
|
||||
|
Reference in New Issue
Block a user