mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-11-06 01:45:22 +00:00
Move some stuff over to AJAX thing.
This commit is contained in:
@@ -173,7 +173,10 @@ class ReportController extends Controller
|
||||
/** @var CategoryRepositoryInterface $repository */
|
||||
$repository = app(CategoryRepositoryInterface::class);
|
||||
$category = $repository->find(intval($attributes['categoryId']));
|
||||
$journals = $repository->journalsInPeriod(new Collection([$category]), $attributes['accounts'], [], $attributes['startDate'], $attributes['endDate']);
|
||||
$types = [TransactionType::WITHDRAWAL, TransactionType::TRANSFER];
|
||||
$journals = $repository->journalsInPeriod(
|
||||
new Collection([$category]), $attributes['accounts'], $types, $attributes['startDate'], $attributes['endDate']
|
||||
);
|
||||
$view = view('popup.report.category-entry', compact('journals', 'category'))->render();
|
||||
|
||||
return $view;
|
||||
|
||||
49
app/Http/Controllers/Report/InOutController.php
Normal file
49
app/Http/Controllers/Report/InOutController.php
Normal file
@@ -0,0 +1,49 @@
|
||||
<?php
|
||||
/**
|
||||
* InOutController.php
|
||||
* Copyright (C) 2016 thegrumpydictator@gmail.com
|
||||
*
|
||||
* This software may be modified and distributed under the terms of the
|
||||
* Creative Commons Attribution-ShareAlike 4.0 International License.
|
||||
*
|
||||
* See the LICENSE file for details.
|
||||
*/
|
||||
|
||||
declare(strict_types = 1);
|
||||
|
||||
namespace FireflyIII\Http\Controllers\Report;
|
||||
|
||||
|
||||
use Carbon\Carbon;
|
||||
use FireflyIII\Helpers\Report\ReportHelperInterface;
|
||||
use FireflyIII\Http\Controllers\Controller;
|
||||
use Illuminate\Support\Collection;
|
||||
use Response;
|
||||
|
||||
/**
|
||||
* Class InOutController
|
||||
*
|
||||
* @package FireflyIII\Http\Controllers\Report
|
||||
*/
|
||||
class InOutController extends Controller
|
||||
{
|
||||
|
||||
|
||||
public function inOutReport(ReportHelperInterface $helper, Carbon $start, Carbon $end, Collection $accounts)
|
||||
{
|
||||
|
||||
$incomes = $helper->getIncomeReport($start, $end, $accounts);
|
||||
$expenses = $helper->getExpenseReport($start, $end, $accounts);
|
||||
$incomeTopLength = 8;
|
||||
$expenseTopLength = 8;
|
||||
|
||||
return Response::json(
|
||||
[
|
||||
'income' => view('reports.partials.income', compact('incomes', 'incomeTopLength'))->render(),
|
||||
'expenses' => view('reports.partials.expenses', compact('expenses', 'expenseTopLength'))->render(),
|
||||
'incomes_expenses' => view('reports.partials.income-vs-expenses', compact('expenses', 'incomes'))->render(),
|
||||
]
|
||||
);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -22,7 +22,6 @@ use FireflyIII\Models\Account;
|
||||
use FireflyIII\Models\AccountType;
|
||||
use FireflyIII\Models\Transaction;
|
||||
use FireflyIII\Repositories\Account\AccountRepositoryInterface;
|
||||
use FireflyIII\Repositories\Account\AccountRepositoryInterface as ARI;
|
||||
use FireflyIII\Repositories\Account\AccountTaskerInterface;
|
||||
use FireflyIII\Repositories\Budget\BudgetRepositoryInterface;
|
||||
use FireflyIII\Repositories\Category\CategoryRepositoryInterface;
|
||||
@@ -226,12 +225,7 @@ class ReportController extends Controller
|
||||
*/
|
||||
private function defaultMonth(string $reportType, Carbon $start, Carbon $end, Collection $accounts)
|
||||
{
|
||||
$incomeTopLength = 8;
|
||||
$expenseTopLength = 8;
|
||||
|
||||
// get report stuff!
|
||||
$incomes = $this->helper->getIncomeReport($start, $end, $accounts);
|
||||
$expenses = $this->helper->getExpenseReport($start, $end, $accounts);
|
||||
$budgets = $this->budgetHelper->getBudgetReport($start, $end, $accounts);
|
||||
$categories = $this->helper->getCategoryReport($start, $end, $accounts);
|
||||
$balance = $this->balanceHelper->getBalanceReport($start, $end, $accounts);
|
||||
@@ -247,8 +241,7 @@ class ReportController extends Controller
|
||||
compact(
|
||||
'start', 'end', 'reportType',
|
||||
'tags',
|
||||
'incomes', 'incomeTopLength',
|
||||
'expenses', 'expenseTopLength',
|
||||
'incomes',
|
||||
'budgets', 'balance',
|
||||
'categories',
|
||||
'bills',
|
||||
@@ -268,13 +261,8 @@ class ReportController extends Controller
|
||||
private function defaultMultiYear(string $reportType, Carbon $start, Carbon $end, Collection $accounts)
|
||||
{
|
||||
|
||||
$incomeTopLength = 8;
|
||||
$expenseTopLength = 8;
|
||||
// list of users stuff:
|
||||
$budgets = app(BudgetRepositoryInterface::class)->getActiveBudgets();
|
||||
$categories = app(CategoryRepositoryInterface::class)->getCategories();
|
||||
$incomes = $this->helper->getIncomeReport($start, $end, $accounts);
|
||||
$expenses = $this->helper->getExpenseReport($start, $end, $accounts);
|
||||
$tags = $this->helper->tagReport($start, $end, $accounts);
|
||||
|
||||
// and some id's, joined:
|
||||
@@ -288,9 +276,7 @@ class ReportController extends Controller
|
||||
return view(
|
||||
'reports.default.multi-year',
|
||||
compact(
|
||||
'budgets', 'accounts', 'categories', 'start', 'end', 'accountIds', 'reportType',
|
||||
'incomes', 'expenses',
|
||||
'incomeTopLength', 'expenseTopLength', 'tags'
|
||||
'budgets', 'accounts', 'categories', 'start', 'end', 'accountIds', 'reportType', 'tags'
|
||||
)
|
||||
);
|
||||
}
|
||||
@@ -305,11 +291,6 @@ class ReportController extends Controller
|
||||
*/
|
||||
private function defaultYear(string $reportType, Carbon $start, Carbon $end, Collection $accounts)
|
||||
{
|
||||
$incomeTopLength = 8;
|
||||
$expenseTopLength = 8;
|
||||
|
||||
$incomes = $this->helper->getIncomeReport($start, $end, $accounts);
|
||||
$expenses = $this->helper->getExpenseReport($start, $end, $accounts);
|
||||
$tags = $this->helper->tagReport($start, $end, $accounts);
|
||||
$budgets = $this->budgetHelper->budgetYearOverview($start, $end, $accounts);
|
||||
|
||||
@@ -328,8 +309,7 @@ class ReportController extends Controller
|
||||
return view(
|
||||
'reports.default.year',
|
||||
compact(
|
||||
'start', 'incomes', 'reportType', 'accountIds', 'end',
|
||||
'expenses', 'incomeTopLength', 'expenseTopLength', 'tags', 'budgets'
|
||||
'start', 'reportType', 'accountIds', 'end', 'tags', 'budgets'
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
@@ -75,12 +75,24 @@ class Range
|
||||
|
||||
// set view variables.
|
||||
$this->configureView();
|
||||
|
||||
// set more view variables:
|
||||
$this->configureList();
|
||||
}
|
||||
|
||||
return $theNext($request);
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
private function configureList()
|
||||
{
|
||||
$pref = Preferences::get('list-length', config('firefly.list_length', 10))->data;
|
||||
View::share('listLength', $pref);
|
||||
}
|
||||
|
||||
private function configureView()
|
||||
{
|
||||
$pref = Preferences::get('language', config('firefly.default_language', 'en_US'));
|
||||
|
||||
@@ -241,6 +241,7 @@ class CategoryRepository implements CategoryRepositoryInterface
|
||||
if (count($types) > 0) {
|
||||
$query->transactionTypes($types);
|
||||
}
|
||||
|
||||
if ($accounts->count() > 0) {
|
||||
$accountIds = $accounts->pluck('id')->toArray();
|
||||
$query->leftJoin('transactions as t', 't.transaction_journal_id', '=', 'transaction_journals.id');
|
||||
@@ -275,7 +276,7 @@ class CategoryRepository implements CategoryRepositoryInterface
|
||||
}
|
||||
|
||||
|
||||
$second = $query->get(['transaction_journals.*']);
|
||||
$second = $query->get(['transaction_journals.*','transaction_types.type as transaction_type_type']);
|
||||
|
||||
$complete = $complete->merge($first);
|
||||
$complete = $complete->merge($second);
|
||||
|
||||
Reference in New Issue
Block a user