mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-02-25 18:45:27 -06:00
More hip report stuff.
This commit is contained in:
@@ -162,70 +162,6 @@ class ReportController extends Controller
|
||||
$categories = $this->helper->getCategoryReport($start, $end, $shared);
|
||||
$balance = $this->helper->getBalanceReport($start, $end, $shared);
|
||||
|
||||
// /**
|
||||
// * DO BUDGETS.
|
||||
// */
|
||||
// /** @var \FireflyIII\Repositories\Budget\BudgetRepositoryInterface $repository */
|
||||
// $repository = App::make('FireflyIII\Repositories\Budget\BudgetRepositoryInterface');
|
||||
// $set = $repository->getBudgets();
|
||||
// $budgets = new Collection;
|
||||
// $budgetSums = ['budgeted' => 0, 'spent' => 0, 'left' => 0, 'overspent' => 0];
|
||||
// /** @var Budget $budget */
|
||||
// foreach ($set as $budget) {
|
||||
// $repetitions = $repository->getBudgetLimitRepetitions($budget, $start, $end);
|
||||
// if ($repetitions->count() == 0) {
|
||||
// $exp = $repository->spentInPeriod($budget, $start, $end, $shared);
|
||||
// $budgets->push([$budget, null, 0, 0, $exp]);
|
||||
// $budgetSums['overspent'] += $exp;
|
||||
// continue;
|
||||
// }
|
||||
// /** @var LimitRepetition $repetition */
|
||||
// foreach ($repetitions as $repetition) {
|
||||
// $exp = $repository->spentInPeriod($budget, $repetition->startdate, $repetition->enddate, $shared);
|
||||
// $left = $exp < floatval($repetition->amount) ? floatval($repetition->amount) - $exp : 0;
|
||||
// $spent = $exp > floatval($repetition->amount) ? 0 : $exp;
|
||||
// $overspent = $exp > floatval($repetition->amount) ? $exp - floatval($repetition->amount) : 0;
|
||||
//
|
||||
// $budgetSums['budgeted'] += floatval($repetition->amount);
|
||||
// $budgetSums['spent'] += $spent;
|
||||
// $budgetSums['left'] += $left;
|
||||
// $budgetSums['overspent'] += $overspent;
|
||||
//
|
||||
// $budgets->push([$budget, $repetition, $left, $spent, $overspent]);
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// $noBudgetExpenses = $repository->getWithoutBudgetSum($start, $end);
|
||||
// $budgets->push([null, null, 0, 0, $noBudgetExpenses]);
|
||||
// $budgetSums['overspent'] += $noBudgetExpenses;
|
||||
// unset($noBudgetExpenses, $repository, $set, $repetition, $repetitions, $exp);
|
||||
|
||||
// /**
|
||||
// * GET CATEGORIES:
|
||||
// */
|
||||
// /** @var \FireflyIII\Repositories\Category\CategoryRepositoryInterface $repository */
|
||||
// $repository = App::make('FireflyIII\Repositories\Category\CategoryRepositoryInterface');
|
||||
// $set = $repository->getCategories();
|
||||
// $categories = [];
|
||||
// $categorySum = 0;
|
||||
// foreach ($set as $category) {
|
||||
// $spent = $repository->spentInPeriod($category, $start, $end, $shared);
|
||||
// $categories[] = [$category, $spent];
|
||||
// $categorySum += $spent;
|
||||
// }
|
||||
// // no category:
|
||||
//
|
||||
// // sort with callback:
|
||||
// uasort(
|
||||
// $categories, function ($a, $b) {
|
||||
// if ($a[1] == $b[1]) {
|
||||
// return 0;
|
||||
// }
|
||||
//
|
||||
// return ($a[1] < $b[1]) ? 1 : -1;
|
||||
// }
|
||||
// );
|
||||
// unset($set, $repository, $spent);
|
||||
|
||||
return view(
|
||||
'reports.month',
|
||||
@@ -240,103 +176,6 @@ class ReportController extends Controller
|
||||
)
|
||||
);
|
||||
|
||||
|
||||
// get all income and expenses. it's OK.
|
||||
// $income = $this->query->incomeInPeriod($start, $end, $shared);
|
||||
// $expensesSet = $this->query->journalsByExpenseAccount($start, $end, $shared);
|
||||
//
|
||||
// /**
|
||||
// * INCLUDE ORIGINAL BUDGET REPORT HERE:
|
||||
// */
|
||||
// // should show shared reports?
|
||||
// /** @var Preference $pref */
|
||||
// $accountAmounts = []; // array with sums of spent amounts on each account.
|
||||
// $accounts = $this->query->getAllAccounts($start, $end, $shared); // all accounts and some data.
|
||||
//
|
||||
// foreach ($accounts as $account) {
|
||||
//
|
||||
// $budgets = $this->query->getBudgetSummary($account, $start, $end);// get budget summary for this account:
|
||||
// $balancedAmount = $this->query->balancedTransactionsSum($account, $start, $end);
|
||||
// $accountAmounts[$account->id] = $balancedAmount;
|
||||
// // balance out the transactions (see transaction groups & tags) ^^
|
||||
//
|
||||
// // array with budget information for each account:
|
||||
// $array = [];
|
||||
// // should always hide account
|
||||
// $hide = true;
|
||||
// // loop all budgets
|
||||
// /** @var \FireflyIII\Models\Budget $budget */
|
||||
// foreach ($budgets as $budget) {
|
||||
// $id = intval($budget->id);
|
||||
// $data = $budget->toArray();
|
||||
// $array[$id] = $data;
|
||||
//
|
||||
// // no longer hide account if any budget has money in it.
|
||||
// if (floatval($data['queryAmount']) != 0) {
|
||||
// $hide = false;
|
||||
// }
|
||||
// $accountAmounts[$account->id] += $data['queryAmount'];
|
||||
// }
|
||||
// $account->hide = $hide;
|
||||
// $account->budgetInformation = $array;
|
||||
// $account->balancedAmount = $balancedAmount;
|
||||
//
|
||||
// }
|
||||
// /**
|
||||
// * END ORIGINAL BUDGET REPORT
|
||||
// */
|
||||
//
|
||||
// /**
|
||||
// * Start getBudgetsForMonth DONE
|
||||
// */
|
||||
// $budgets = $this->helper->getBudgetsForMonth($date, $shared);
|
||||
//
|
||||
// /**
|
||||
// * End getBudgetsForMonth DONE
|
||||
// */
|
||||
// /**
|
||||
// * Start getCategoriesForMonth DONE
|
||||
// */
|
||||
// // all categories.
|
||||
// $result = $this->query->journalsByCategory($start, $end);
|
||||
// $categories = Steam::makeArray($result);
|
||||
//
|
||||
//
|
||||
// // all transfers
|
||||
// if ($shared === false) {
|
||||
// $result = $this->query->sharedExpensesByCategory($start, $end);
|
||||
// $transfers = Steam::makeArray($result);
|
||||
// $merged = Steam::mergeArrays($categories, $transfers);
|
||||
// } else {
|
||||
// $merged = $categories;
|
||||
// }
|
||||
//
|
||||
//
|
||||
// // sort.
|
||||
// $sorted = Steam::sortNegativeArray($merged);
|
||||
//
|
||||
// // limit to $limit:
|
||||
// $categories = Steam::limitArray($sorted, 10);
|
||||
//
|
||||
// /**
|
||||
// * End getCategoriesForMonth DONE
|
||||
// */
|
||||
//
|
||||
//
|
||||
// // clean up and sort expenses:
|
||||
// $expenses = Steam::makeArray($expensesSet);
|
||||
// $expenses = Steam::sortArray($expenses);
|
||||
// $expenses = Steam::limitArray($expenses, 10);
|
||||
|
||||
//
|
||||
//
|
||||
// return view(
|
||||
// 'reports.month',
|
||||
// compact(
|
||||
// 'income', 'expenses', 'budgets', 'accounts', 'categories', 'shared',
|
||||
// 'date', 'subTitle', 'displaySum', 'subTitleIcon'
|
||||
// )
|
||||
// );
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user