mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-02-25 18:45:27 -06:00
Refactor names.
This commit is contained in:
parent
a2f852fecf
commit
59f57c96e9
@ -52,7 +52,7 @@ class ReportHelper implements ReportHelperInterface
|
|||||||
*
|
*
|
||||||
* @return CategoryCollection
|
* @return CategoryCollection
|
||||||
*/
|
*/
|
||||||
public function getCategoryReportForList(Carbon $start, Carbon $end, Collection $accounts)
|
public function getCategoryReport(Carbon $start, Carbon $end, Collection $accounts)
|
||||||
{
|
{
|
||||||
$object = new CategoryCollection;
|
$object = new CategoryCollection;
|
||||||
|
|
||||||
@ -118,7 +118,7 @@ class ReportHelper implements ReportHelperInterface
|
|||||||
*
|
*
|
||||||
* @return AccountCollection
|
* @return AccountCollection
|
||||||
*/
|
*/
|
||||||
public function getAccountReportForList(Carbon $start, Carbon $end, Collection $accounts)
|
public function getAccountReport(Carbon $start, Carbon $end, Collection $accounts)
|
||||||
{
|
{
|
||||||
$startAmount = '0';
|
$startAmount = '0';
|
||||||
$endAmount = '0';
|
$endAmount = '0';
|
||||||
@ -167,10 +167,10 @@ class ReportHelper implements ReportHelperInterface
|
|||||||
*
|
*
|
||||||
* @return Income
|
* @return Income
|
||||||
*/
|
*/
|
||||||
public function getIncomeReportForList($start, $end, Collection $accounts)
|
public function getIncomeReport($start, $end, Collection $accounts)
|
||||||
{
|
{
|
||||||
$object = new Income;
|
$object = new Income;
|
||||||
$set = $this->query->incomeInPeriodCorrectedForList($start, $end, $accounts);
|
$set = $this->query->incomeInPeriod($start, $end, $accounts);
|
||||||
foreach ($set as $entry) {
|
foreach ($set as $entry) {
|
||||||
$object->addToTotal($entry->amount_positive);
|
$object->addToTotal($entry->amount_positive);
|
||||||
$object->addOrCreateIncome($entry);
|
$object->addOrCreateIncome($entry);
|
||||||
@ -188,10 +188,10 @@ class ReportHelper implements ReportHelperInterface
|
|||||||
*
|
*
|
||||||
* @return Expense
|
* @return Expense
|
||||||
*/
|
*/
|
||||||
public function getExpenseReportForList($start, $end, Collection $accounts)
|
public function getExpenseReport($start, $end, Collection $accounts)
|
||||||
{
|
{
|
||||||
$object = new Expense;
|
$object = new Expense;
|
||||||
$set = $this->query->expenseInPeriodCorrectedForList($start, $end, $accounts);
|
$set = $this->query->expenseInPeriod($start, $end, $accounts);
|
||||||
foreach ($set as $entry) {
|
foreach ($set as $entry) {
|
||||||
$object->addToTotal($entry->amount); // can be positive, if it's a transfer
|
$object->addToTotal($entry->amount); // can be positive, if it's a transfer
|
||||||
$object->addOrCreateExpense($entry);
|
$object->addOrCreateExpense($entry);
|
||||||
@ -207,7 +207,7 @@ class ReportHelper implements ReportHelperInterface
|
|||||||
*
|
*
|
||||||
* @return BudgetCollection
|
* @return BudgetCollection
|
||||||
*/
|
*/
|
||||||
public function getBudgetReportForList(Carbon $start, Carbon $end, Collection $accounts)
|
public function getBudgetReport(Carbon $start, Carbon $end, Collection $accounts)
|
||||||
{
|
{
|
||||||
$object = new BudgetCollection;
|
$object = new BudgetCollection;
|
||||||
/** @var \FireflyIII\Repositories\Budget\BudgetRepositoryInterface $repository */
|
/** @var \FireflyIII\Repositories\Budget\BudgetRepositoryInterface $repository */
|
||||||
@ -280,7 +280,7 @@ class ReportHelper implements ReportHelperInterface
|
|||||||
*
|
*
|
||||||
* @return Balance
|
* @return Balance
|
||||||
*/
|
*/
|
||||||
public function getBalanceReportForList(Carbon $start, Carbon $end, Collection $accounts)
|
public function getBalanceReport(Carbon $start, Carbon $end, Collection $accounts)
|
||||||
{
|
{
|
||||||
$repository = app('FireflyIII\Repositories\Budget\BudgetRepositoryInterface');
|
$repository = app('FireflyIII\Repositories\Budget\BudgetRepositoryInterface');
|
||||||
$tagRepository = app('FireflyIII\Repositories\Tag\TagRepositoryInterface');
|
$tagRepository = app('FireflyIII\Repositories\Tag\TagRepositoryInterface');
|
||||||
@ -309,7 +309,7 @@ class ReportHelper implements ReportHelperInterface
|
|||||||
$balanceEntry->setAccount($account);
|
$balanceEntry->setAccount($account);
|
||||||
|
|
||||||
// get spent:
|
// get spent:
|
||||||
$spent = $this->query->spentInBudgetCorrected($account, $budget, $start, $end); // I think shared is irrelevant.
|
$spent = $this->query->spentInBudget($account, $budget, $start, $end); // I think shared is irrelevant.
|
||||||
|
|
||||||
$balanceEntry->setSpent($spent);
|
$balanceEntry->setSpent($spent);
|
||||||
$line->addBalanceEntry($balanceEntry);
|
$line->addBalanceEntry($balanceEntry);
|
||||||
@ -375,7 +375,7 @@ class ReportHelper implements ReportHelperInterface
|
|||||||
*
|
*
|
||||||
* @return BillCollection
|
* @return BillCollection
|
||||||
*/
|
*/
|
||||||
public function getBillReportForList(Carbon $start, Carbon $end, Collection $accounts)
|
public function getBillReport(Carbon $start, Carbon $end, Collection $accounts)
|
||||||
{
|
{
|
||||||
/** @var \FireflyIII\Repositories\Bill\BillRepositoryInterface $repository */
|
/** @var \FireflyIII\Repositories\Bill\BillRepositoryInterface $repository */
|
||||||
$repository = app('FireflyIII\Repositories\Bill\BillRepositoryInterface');
|
$repository = app('FireflyIII\Repositories\Bill\BillRepositoryInterface');
|
||||||
|
@ -30,7 +30,7 @@ interface ReportHelperInterface
|
|||||||
*
|
*
|
||||||
* @return AccountCollection
|
* @return AccountCollection
|
||||||
*/
|
*/
|
||||||
public function getAccountReportForList(Carbon $start, Carbon $end, Collection $accounts);
|
public function getAccountReport(Carbon $start, Carbon $end, Collection $accounts);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This method generates a full report for the given period on all
|
* This method generates a full report for the given period on all
|
||||||
@ -44,7 +44,7 @@ interface ReportHelperInterface
|
|||||||
*
|
*
|
||||||
* @return BillCollection
|
* @return BillCollection
|
||||||
*/
|
*/
|
||||||
public function getBillReportForList(Carbon $start, Carbon $end, Collection $accounts);
|
public function getBillReport(Carbon $start, Carbon $end, Collection $accounts);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param Carbon $start
|
* @param Carbon $start
|
||||||
@ -53,7 +53,7 @@ interface ReportHelperInterface
|
|||||||
*
|
*
|
||||||
* @return Balance
|
* @return Balance
|
||||||
*/
|
*/
|
||||||
public function getBalanceReportForList(Carbon $start, Carbon $end, Collection $accounts);
|
public function getBalanceReport(Carbon $start, Carbon $end, Collection $accounts);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param Carbon $start
|
* @param Carbon $start
|
||||||
@ -62,7 +62,7 @@ interface ReportHelperInterface
|
|||||||
*
|
*
|
||||||
* @return BudgetCollection
|
* @return BudgetCollection
|
||||||
*/
|
*/
|
||||||
public function getBudgetReportForList(Carbon $start, Carbon $end, Collection $accounts);
|
public function getBudgetReport(Carbon $start, Carbon $end, Collection $accounts);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param Carbon $start
|
* @param Carbon $start
|
||||||
@ -71,7 +71,7 @@ interface ReportHelperInterface
|
|||||||
*
|
*
|
||||||
* @return CategoryCollection
|
* @return CategoryCollection
|
||||||
*/
|
*/
|
||||||
public function getCategoryReportForList(Carbon $start, Carbon $end, Collection $accounts);
|
public function getCategoryReport(Carbon $start, Carbon $end, Collection $accounts);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get a full report on the users expenses during the period for a list of accounts.
|
* Get a full report on the users expenses during the period for a list of accounts.
|
||||||
@ -82,7 +82,7 @@ interface ReportHelperInterface
|
|||||||
*
|
*
|
||||||
* @return Expense
|
* @return Expense
|
||||||
*/
|
*/
|
||||||
public function getExpenseReportForList($start, $end, Collection $accounts);
|
public function getExpenseReport($start, $end, Collection $accounts);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get a full report on the users incomes during the period for the given accounts.
|
* Get a full report on the users incomes during the period for the given accounts.
|
||||||
@ -93,7 +93,7 @@ interface ReportHelperInterface
|
|||||||
*
|
*
|
||||||
* @return Income
|
* @return Income
|
||||||
*/
|
*/
|
||||||
public function getIncomeReportForList($start, $end, Collection $accounts);
|
public function getIncomeReport($start, $end, Collection $accounts);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param Carbon $date
|
* @param Carbon $date
|
||||||
|
@ -30,7 +30,7 @@ class ReportQuery implements ReportQueryInterface
|
|||||||
*
|
*
|
||||||
* @return float
|
* @return float
|
||||||
*/
|
*/
|
||||||
public function spentInBudgetCorrected(Account $account, Budget $budget, Carbon $start, Carbon $end)
|
public function spentInBudget(Account $account, Budget $budget, Carbon $start, Carbon $end)
|
||||||
{
|
{
|
||||||
|
|
||||||
return Auth::user()->transactionjournals()
|
return Auth::user()->transactionjournals()
|
||||||
@ -112,7 +112,7 @@ class ReportQuery implements ReportQueryInterface
|
|||||||
*
|
*
|
||||||
* @return Collection
|
* @return Collection
|
||||||
*/
|
*/
|
||||||
public function incomeInPeriodCorrectedForList(Carbon $start, Carbon $end, Collection $accounts)
|
public function incomeInPeriod(Carbon $start, Carbon $end, Collection $accounts)
|
||||||
{
|
{
|
||||||
$query = $this->queryJournalsWithTransactions($start, $end);
|
$query = $this->queryJournalsWithTransactions($start, $end);
|
||||||
|
|
||||||
@ -198,7 +198,7 @@ class ReportQuery implements ReportQueryInterface
|
|||||||
* @return Collection
|
* @return Collection
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public function expenseInPeriodCorrectedForList(Carbon $start, Carbon $end, Collection $accounts)
|
public function expenseInPeriod(Carbon $start, Carbon $end, Collection $accounts)
|
||||||
{
|
{
|
||||||
$ids = [];
|
$ids = [];
|
||||||
|
|
||||||
|
@ -29,7 +29,7 @@ interface ReportQueryInterface
|
|||||||
* @return Collection
|
* @return Collection
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public function expenseInPeriodCorrectedForList(Carbon $start, Carbon $end, Collection $accounts);
|
public function expenseInPeriod(Carbon $start, Carbon $end, Collection $accounts);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This method works the same way as ReportQueryInterface::incomeInPeriod does, but instead of returning results
|
* This method works the same way as ReportQueryInterface::incomeInPeriod does, but instead of returning results
|
||||||
@ -42,7 +42,7 @@ interface ReportQueryInterface
|
|||||||
*
|
*
|
||||||
* @return Collection
|
* @return Collection
|
||||||
*/
|
*/
|
||||||
public function incomeInPeriodCorrectedForList(Carbon $start, Carbon $end, Collection $accounts);
|
public function incomeInPeriod(Carbon $start, Carbon $end, Collection $accounts);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Covers tags as well.
|
* Covers tags as well.
|
||||||
@ -54,7 +54,7 @@ interface ReportQueryInterface
|
|||||||
*
|
*
|
||||||
* @return float
|
* @return float
|
||||||
*/
|
*/
|
||||||
public function spentInBudgetCorrected(Account $account, Budget $budget, Carbon $start, Carbon $end);
|
public function spentInBudget(Account $account, Budget $budget, Carbon $start, Carbon $end);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param Account $account
|
* @param Account $account
|
||||||
|
@ -60,8 +60,8 @@ class ReportController extends Controller
|
|||||||
$month = clone $start;
|
$month = clone $start;
|
||||||
$month->endOfMonth();
|
$month->endOfMonth();
|
||||||
// total income and total expenses:
|
// total income and total expenses:
|
||||||
$incomeSum = $query->incomeInPeriodCorrectedForList($start, $month, $accounts)->sum('amount_positive');
|
$incomeSum = $query->incomeInPeriod($start, $month, $accounts)->sum('amount_positive');
|
||||||
$expenseSum = $query->expenseInPeriodCorrectedForList($start, $month, $accounts)->sum('amount_positive');
|
$expenseSum = $query->expenseInPeriod($start, $month, $accounts)->sum('amount_positive');
|
||||||
|
|
||||||
|
|
||||||
$entries->push([clone $start, $incomeSum, $expenseSum]);
|
$entries->push([clone $start, $incomeSum, $expenseSum]);
|
||||||
@ -109,8 +109,8 @@ class ReportController extends Controller
|
|||||||
$month = clone $start;
|
$month = clone $start;
|
||||||
$month->endOfMonth();
|
$month->endOfMonth();
|
||||||
// total income and total expenses:
|
// total income and total expenses:
|
||||||
$currentIncome = $query->incomeInPeriodCorrectedForList($start, $month, $accounts)->sum('amount_positive');
|
$currentIncome = $query->incomeInPeriod($start, $month, $accounts)->sum('amount_positive');
|
||||||
$currentExpense = $query->expenseInPeriodCorrectedForList($start, $month, $accounts)->sum('amount_positive');
|
$currentExpense = $query->expenseInPeriod($start, $month, $accounts)->sum('amount_positive');
|
||||||
$income = bcadd($income, $currentIncome);
|
$income = bcadd($income, $currentIncome);
|
||||||
$expense = bcadd($expense, $currentExpense);
|
$expense = bcadd($expense, $currentExpense);
|
||||||
|
|
||||||
|
@ -192,7 +192,7 @@ class JsonController extends Controller
|
|||||||
return Response::json($cache->get()); // @codeCoverageIgnore
|
return Response::json($cache->get()); // @codeCoverageIgnore
|
||||||
}
|
}
|
||||||
$accounts = $accountRepository->getAccounts(['Default account', 'Asset account', 'Cash account']);
|
$accounts = $accountRepository->getAccounts(['Default account', 'Asset account', 'Cash account']);
|
||||||
$amount = $reportQuery->incomeInPeriodCorrectedForList($start, $end, $accounts)->sum('amount');
|
$amount = $reportQuery->incomeInPeriod($start, $end, $accounts)->sum('amount');
|
||||||
|
|
||||||
$data = ['box' => 'in', 'amount' => Amount::format($amount, false), 'amount_raw' => $amount];
|
$data = ['box' => 'in', 'amount' => Amount::format($amount, false), 'amount_raw' => $amount];
|
||||||
$cache->store($data);
|
$cache->store($data);
|
||||||
@ -221,7 +221,7 @@ class JsonController extends Controller
|
|||||||
return Response::json($cache->get()); // @codeCoverageIgnore
|
return Response::json($cache->get()); // @codeCoverageIgnore
|
||||||
}
|
}
|
||||||
|
|
||||||
$amount = $reportQuery->expenseInPeriodCorrectedForList($start, $end, $accounts)->sum('amount');
|
$amount = $reportQuery->expenseInPeriod($start, $end, $accounts)->sum('amount');
|
||||||
$amount = $amount * -1;
|
$amount = $amount * -1;
|
||||||
|
|
||||||
$data = ['box' => 'out', 'amount' => Amount::format($amount, false), 'amount_raw' => $amount];
|
$data = ['box' => 'out', 'amount' => Amount::format($amount, false), 'amount_raw' => $amount];
|
||||||
|
@ -75,9 +75,9 @@ class ReportController extends Controller
|
|||||||
$incomeTopLength = 8;
|
$incomeTopLength = 8;
|
||||||
$expenseTopLength = 8;
|
$expenseTopLength = 8;
|
||||||
|
|
||||||
$accountReport = $this->helper->getAccountReportForList($start, $end, $accounts);
|
$accountReport = $this->helper->getAccountReport($start, $end, $accounts);
|
||||||
$incomes = $this->helper->getIncomeReportForList($start, $end, $accounts);
|
$incomes = $this->helper->getIncomeReport($start, $end, $accounts);
|
||||||
$expenses = $this->helper->getExpenseReportForList($start, $end, $accounts);
|
$expenses = $this->helper->getExpenseReport($start, $end, $accounts);
|
||||||
|
|
||||||
Session::flash('gaEventCategory', 'report');
|
Session::flash('gaEventCategory', 'report');
|
||||||
Session::flash('gaEventAction', 'year');
|
Session::flash('gaEventAction', 'year');
|
||||||
@ -118,13 +118,13 @@ class ReportController extends Controller
|
|||||||
$expenseTopLength = 8;
|
$expenseTopLength = 8;
|
||||||
|
|
||||||
// get report stuff!
|
// get report stuff!
|
||||||
$accountReport = $this->helper->getAccountReportForList($start, $end, $accounts);
|
$accountReport = $this->helper->getAccountReport($start, $end, $accounts);
|
||||||
$incomes = $this->helper->getIncomeReportForList($start, $end, $accounts);
|
$incomes = $this->helper->getIncomeReport($start, $end, $accounts);
|
||||||
$expenses = $this->helper->getExpenseReportForList($start, $end, $accounts);
|
$expenses = $this->helper->getExpenseReport($start, $end, $accounts);
|
||||||
$budgets = $this->helper->getBudgetReportForList($start, $end, $accounts);
|
$budgets = $this->helper->getBudgetReport($start, $end, $accounts);
|
||||||
$categories = $this->helper->getCategoryReportForList($start, $end, $accounts);
|
$categories = $this->helper->getCategoryReport($start, $end, $accounts);
|
||||||
$balance = $this->helper->getBalanceReportForList($start, $end, $accounts);
|
$balance = $this->helper->getBalanceReport($start, $end, $accounts);
|
||||||
$bills = $this->helper->getBillReportForList($start, $end, $accounts);
|
$bills = $this->helper->getBillReport($start, $end, $accounts);
|
||||||
|
|
||||||
// and some id's, joined:
|
// and some id's, joined:
|
||||||
$accountIds = [];
|
$accountIds = [];
|
||||||
|
Loading…
Reference in New Issue
Block a user