Simplified report code.

This commit is contained in:
James Cole
2015-05-16 13:06:38 +02:00
parent bec58a1ee6
commit bdff275672
11 changed files with 1183 additions and 723 deletions

View File

@@ -0,0 +1,89 @@
<?php
namespace FireflyIII\Helpers\Collection;
use Illuminate\Support\Collection;
/**
* Class Account
*
* @package FireflyIII\Helpers\Collection
*/
class Account
{
/** @var Collection */
protected $accounts;
/** @var float */
protected $difference;
/** @var float */
protected $end;
/** @var float */
protected $start;
/**
* @return \Illuminate\Support\Collection
*/
public function getAccounts()
{
return $this->accounts;
}
/**
* @param \Illuminate\Support\Collection $accounts
*/
public function setAccounts($accounts)
{
$this->accounts = $accounts;
}
/**
* @return float
*/
public function getDifference()
{
return $this->difference;
}
/**
* @param float $difference
*/
public function setDifference($difference)
{
$this->difference = $difference;
}
/**
* @return float
*/
public function getEnd()
{
return $this->end;
}
/**
* @param float $end
*/
public function setEnd($end)
{
$this->end = $end;
}
/**
* @return float
*/
public function getStart()
{
return $this->start;
}
/**
* @param float $start
*/
public function setStart($start)
{
$this->start = $start;
}
}

View File

@@ -0,0 +1,80 @@
<?php
namespace FireflyIII\Helpers\Collection;
use FireflyIII\Models\TransactionJournal;
use Illuminate\Support\Collection;
use stdClass;
/**
* Class Expense
*
* @package FireflyIII\Helpers\Collection
*/
class Expense
{
/** @var Collection */
protected $expenses;
/** @var float */
protected $total;
/**
*
*/
public function __construct()
{
$this->expenses = new Collection;
}
/**
* @param TransactionJournal $entry
*/
public function addOrCreateExpense(TransactionJournal $entry)
{
$id = $entry->account_id;
if (!$this->expenses->has($id)) {
$newObject = new stdClass;
$newObject->amount = floatval($entry->queryAmount);
$newObject->name = $entry->name;
$newObject->count = 1;
$newObject->id = $id;
$this->expenses->put($id, $newObject);
} else {
$existing = $this->expenses->get($id);
$existing->amount += floatval($entry->queryAmount);
$existing->count++;
$this->expenses->put($id, $existing);
}
}
/**
* @param $add
*/
public function addToTotal($add)
{
$this->total += floatval($add);
}
/**
* @return Collection
*/
public function getExpenses()
{
$this->expenses->sortBy(
function (stdClass $object) {
return $object->amount;
}
);
return $this->expenses;
}
/**
* @return float
*/
public function getTotal()
{
return $this->total;
}
}

View File

@@ -0,0 +1,83 @@
<?php
namespace FireflyIII\Helpers\Collection;
use FireflyIII\Models\TransactionJournal;
use Illuminate\Support\Collection;
use stdClass;
/**
* Class Income
*
* @package FireflyIII\Helpers\Collection
*/
class Income
{
/** @var Collection */
protected $incomes;
/** @var float */
protected $total;
/**
*
*/
public function __construct()
{
$this->incomes = new Collection;
}
/**
* @param TransactionJournal $entry
*/
public function addOrCreateIncome(TransactionJournal $entry)
{
$id = $entry->account_id;
if (!$this->incomes->has($id)) {
$newObject = new stdClass;
$newObject->amount = floatval($entry->queryAmount);
$newObject->name = $entry->name;
$newObject->count = 1;
$newObject->id = $id;
$this->incomes->put($id, $newObject);
} else {
$existing = $this->incomes->get($id);
$existing->amount += floatval($entry->queryAmount);
$existing->count++;
$this->incomes->put($id, $existing);
}
}
/**
* @param $add
*/
public function addToTotal($add)
{
$this->total += floatval($add);
}
/**
* @return Collection
*/
public function getIncomes()
{
$this->incomes->sortByDesc(
function (stdClass $object) {
return $object->amount;
}
);
return $this->incomes;
}
/**
* @return float
*/
public function getTotal()
{
return $this->total;
}
}

View File

@@ -2,13 +2,11 @@
namespace FireflyIII\Helpers\Report; namespace FireflyIII\Helpers\Report;
use App;
use Auth;
use Carbon\Carbon; use Carbon\Carbon;
use FireflyIII\Helpers\Collection\Account as AccountCollection;
use FireflyIII\Helpers\Collection\Expense;
use FireflyIII\Helpers\Collection\Income;
use FireflyIII\Models\Account; use FireflyIII\Models\Account;
use Illuminate\Database\Query\JoinClause;
use Illuminate\Support\Collection;
use Steam;
/** /**
* Class ReportHelper * Class ReportHelper
@@ -18,47 +16,94 @@ use Steam;
class ReportHelper implements ReportHelperInterface class ReportHelper implements ReportHelperInterface
{ {
/** @var ReportQueryInterface */
protected $query;
/** /**
* This method gets some kind of list for a monthly overview. * @param ReportHelperInterface $helper
*/
public function __construct(ReportQueryInterface $query)
{
$this->query = $query;
}
/**
* This method generates a full report for the given period on all
* the users asset and cash accounts.
* *
* @param Carbon $date * @param Carbon $date
* @param bool $includeShared * @param Carbon $end
* @param $shared
* *
* @return Collection * @return Account
*/ */
public function getBudgetsForMonth(Carbon $date, $includeShared = false) public function getAccountReport(Carbon $date, Carbon $end, $shared)
{ {
/** @var \FireflyIII\Helpers\Report\ReportQueryInterface $query */
$query = App::make('FireflyIII\Helpers\Report\ReportQueryInterface');
$start = clone $date;
$start->startOfMonth();
$end = clone $date;
$end->endOfMonth();
$set = Auth::user()->budgets()->orderBy('budgets.name', 'ASC')
->leftJoin(
'budget_limits', function (JoinClause $join) use ($date) {
$join->on('budget_limits.budget_id', '=', 'budgets.id')->where('budget_limits.startdate', '=', $date->format('Y-m-d'));
}
)
->get(['budgets.*', 'budget_limits.amount as queryAmount']);
$budgets = Steam::makeArray($set); $accounts = $this->query->getAllAccounts($date, $end, $shared);
$amountSet = $query->journalsByBudget($start, $end, $includeShared); $start = 0;
$amounts = Steam::makeArray($amountSet); $end = 0;
$budgets = Steam::mergeArrays($budgets, $amounts); $diff = 0;
$budgets[0]['spent'] = isset($budgets[0]['spent']) ? $budgets[0]['spent'] : 0.0;
$budgets[0]['queryAmount'] = isset($budgets[0]['queryAmount']) ? $budgets[0]['queryAmount'] : 0.0;
$budgets[0]['name'] = 'No budget';
// find transactions to shared asset accounts, which are without a budget by default: // summarize:
// which is only relevant when shared asset accounts are hidden. foreach ($accounts as $account) {
if ($includeShared === false) { $start += $account->startBalance;
$transfers = $query->sharedExpenses($start, $end)->sum('queryAmount'); $end += $account->endBalance;
$budgets[0]['spent'] += floatval($transfers) * -1; $diff += ($account->endBalance - $account->startBalance);
} }
return $budgets; $object = new AccountCollection;
$object->setStart($start);
$object->setEnd($end);
$object->setDifference($diff);
$object->setAccounts($accounts);
return $object;
}
/**
* Get a full report on the users expenses during the period.
*
* @param Carbon $start
* @param Carbon $end
* @param boolean $shared
*
* @return Expense
*/
public function getExpenseReport($start, $end, $shared)
{
$object = new Expense;
$set = $this->query->expenseInPeriod($start, $end, $shared);
foreach ($set as $entry) {
$object->addToTotal($entry->queryAmount);
$object->addOrCreateExpense($entry);
}
return $object;
}
/**
* Get a full report on the users incomes during the period.
*
* @param Carbon $start
* @param Carbon $end
* @param boolean $shared
*
* @return Income
*/
public function getIncomeReport($start, $end, $shared)
{
$object = new Income;
$set = $this->query->incomeInPeriod($start, $end, $shared);
foreach ($set as $entry) {
$object->addToTotal($entry->queryAmount);
$object->addOrCreateIncome($entry);
}
return $object;
} }
/** /**
@@ -84,5 +129,4 @@ class ReportHelper implements ReportHelperInterface
return $months; return $months;
} }
} }

View File

@@ -3,7 +3,9 @@
namespace FireflyIII\Helpers\Report; namespace FireflyIII\Helpers\Report;
use Carbon\Carbon; use Carbon\Carbon;
use Illuminate\Support\Collection; use FireflyIII\Helpers\Collection\Account;
use FireflyIII\Helpers\Collection\Expense;
use FireflyIII\Helpers\Collection\Income;
/** /**
* Interface ReportHelperInterface * Interface ReportHelperInterface
@@ -14,14 +16,38 @@ interface ReportHelperInterface
{ {
/** /**
* This method gets some kind of list for a monthly overview. * This method generates a full report for the given period on all
* the users asset and cash accounts.
* *
* @param Carbon $date * @param Carbon $date
* @param bool $includeShared * @param Carbon $end
* @param boolean $shared
* *
* @return Collection * @return Account
*/ */
public function getBudgetsForMonth(Carbon $date, $includeShared = false); public function getAccountReport(Carbon $date, Carbon $end, $shared);
/**
* Get a full report on the users expenses during the period.
*
* @param Carbon $start
* @param Carbon $end
* @param boolean $shared
*
* @return Expense
*/
public function getExpenseReport($start, $end, $shared);
/**
* Get a full report on the users incomes during the period.
*
* @param Carbon $start
* @param Carbon $end
* @param boolean $shared
*
* @return Income
*/
public function getIncomeReport($start, $end, $shared);
/** /**
* @param Carbon $date * @param Carbon $date

View File

@@ -19,65 +19,6 @@ use Session;
*/ */
class BudgetController extends Controller class BudgetController extends Controller
{ {
/**
* Shows a budget list with spent/left/overspent.
*
* @param GChart $chart
* @param BudgetRepositoryInterface $repository
*
* @return \Symfony\Component\HttpFoundation\Response
*/
public function frontpage(GChart $chart, BudgetRepositoryInterface $repository)
{
$chart->addColumn(trans('firefly.budget'), 'string');
$chart->addColumn(trans('firefly.left'), 'number');
$chart->addColumn(trans('firefly.spent'), 'number');
$chart->addColumn(trans('firefly.overspent'), 'number');
$budgets = $repository->getBudgets();
$start = Session::get('start', Carbon::now()->startOfMonth());
$end = Session::get('end', Carbon::now()->endOfMonth());
$allEntries = new Collection;
foreach ($budgets as $budget) {
$repetitions = $repository->getBudgetLimitRepetitions($budget, $start, $end);
if ($repetitions->count() == 0) {
$expenses = $repository->sumBudgetExpensesInPeriod($budget, $start, $end);
$allEntries->push([$budget->name, 0, 0, $expenses]);
continue;
}
/** @var LimitRepetition $repetition */
foreach ($repetitions as $repetition) {
$expenses = $repository->sumBudgetExpensesInPeriod($budget, $repetition->startdate, $repetition->enddate);
$left = $expenses < floatval($repetition->amount) ? floatval($repetition->amount) - $expenses : 0;
$spent = $expenses > floatval($repetition->amount) ? 0 : $expenses;
$overspent = $expenses > floatval($repetition->amount) ? $expenses - floatval($repetition->amount) : 0;
$allEntries->push(
[$budget->name . ' (' . $repetition->startdate->formatLocalized($this->monthAndDayFormat) . ')',
$left,
$spent,
$overspent
]
);
}
}
$noBudgetExpenses = $repository->getWithoutBudgetSum($start, $end);
$allEntries->push([trans('firefly.noBudget'), 0, 0, $noBudgetExpenses]);
foreach ($allEntries as $entry) {
if ($entry[1] != 0 || $entry[2] != 0 || $entry[3] != 0) {
$chart->addRow($entry[0], $entry[1], $entry[2], $entry[3]);
}
}
$chart->generate();
return Response::json($chart->getData());
}
/** /**
* Shows the amount left in a specific budget limit. * Shows the amount left in a specific budget limit.
* *
@@ -114,6 +55,64 @@ class BudgetController extends Controller
} }
/**
* Shows a budget list with spent/left/overspent.
*
* @param GChart $chart
* @param BudgetRepositoryInterface $repository
*
* @return \Symfony\Component\HttpFoundation\Response
*/
public function frontpage(GChart $chart, BudgetRepositoryInterface $repository)
{
$chart->addColumn(trans('firefly.budget'), 'string');
$chart->addColumn(trans('firefly.left'), 'number');
$chart->addColumn(trans('firefly.spent'), 'number');
$chart->addColumn(trans('firefly.overspent'), 'number');
$budgets = $repository->getBudgets();
$start = Session::get('start', Carbon::now()->startOfMonth());
$end = Session::get('end', Carbon::now()->endOfMonth());
$allEntries = new Collection;
foreach ($budgets as $budget) {
$repetitions = $repository->getBudgetLimitRepetitions($budget, $start, $end);
if ($repetitions->count() == 0) {
$expenses = $repository->spentInPeriod($budget, $start, $end, true);
$allEntries->push([$budget->name, 0, 0, $expenses]);
continue;
}
/** @var LimitRepetition $repetition */
foreach ($repetitions as $repetition) {
$expenses = $repository->spentInPeriod($budget, $repetition->startdate, $repetition->enddate, true);
$left = $expenses < floatval($repetition->amount) ? floatval($repetition->amount) - $expenses : 0;
$spent = $expenses > floatval($repetition->amount) ? 0 : $expenses;
$overspent = $expenses > floatval($repetition->amount) ? $expenses - floatval($repetition->amount) : 0;
$allEntries->push(
[$budget->name . ' (' . $repetition->startdate->formatLocalized($this->monthAndDayFormat) . ')',
$left,
$spent,
$overspent
]
);
}
}
$noBudgetExpenses = $repository->getWithoutBudgetSum($start, $end);
$allEntries->push([trans('firefly.noBudget'), 0, 0, $noBudgetExpenses]);
foreach ($allEntries as $entry) {
if ($entry[1] != 0 || $entry[2] != 0 || $entry[3] != 0) {
$chart->addRow($entry[0], $entry[1], $entry[2], $entry[3]);
}
}
$chart->generate();
return Response::json($chart->getData());
}
/** /**
* Show a yearly overview for a budget. * Show a yearly overview for a budget.
* *

View File

@@ -1,14 +1,17 @@
<?php namespace FireflyIII\Http\Controllers; <?php namespace FireflyIII\Http\Controllers;
use App;
use Carbon\Carbon; use Carbon\Carbon;
use FireflyIII\Helpers\Report\ReportHelperInterface; use FireflyIII\Helpers\Report\ReportHelperInterface;
use FireflyIII\Helpers\Report\ReportQueryInterface; use FireflyIII\Helpers\Report\ReportQueryInterface;
use FireflyIII\Models\Account; use FireflyIII\Models\Account;
use FireflyIII\Models\Budget;
use FireflyIII\Models\LimitRepetition;
use FireflyIII\Models\Preference; use FireflyIII\Models\Preference;
use FireflyIII\Models\TransactionJournal; use FireflyIII\Models\TransactionJournal;
use FireflyIII\Repositories\Account\AccountRepositoryInterface; use FireflyIII\Repositories\Account\AccountRepositoryInterface;
use Illuminate\Support\Collection;
use Session; use Session;
use Steam;
use View; use View;
/** /**
@@ -46,10 +49,8 @@ class ReportController extends Controller
*/ */
public function index(AccountRepositoryInterface $repository) public function index(AccountRepositoryInterface $repository)
{ {
$start = Session::get('first'); $start = Session::get('first');
$months = $this->helper->listOfMonths($start); $months = $this->helper->listOfMonths($start);
$title = 'Reports';
$mainTitleIcon = 'fa-line-chart';
// does the user have shared accounts? // does the user have shared accounts?
$accounts = $repository->getAccounts(['Default account', 'Asset account']); $accounts = $repository->getAccounts(['Default account', 'Asset account']);
@@ -63,7 +64,7 @@ class ReportController extends Controller
} }
return view('reports.index', compact('months', 'title', 'mainTitleIcon', 'hasShared')); return view('reports.index', compact('months', 'hasShared'));
} }
/** /**
@@ -143,157 +144,29 @@ class ReportController extends Controller
*/ */
public function month($year = '2014', $month = '1', $shared = false) public function month($year = '2014', $month = '1', $shared = false)
{ {
$date = new Carbon($year . '-' . $month . '-01'); $start = new Carbon($year . '-' . $month . '-01');
$subTitle = 'Report for ' . $date->format('F Y'); $subTitle = trans('firefly.reportForMonth', ['date' => $start->formatLocalized($this->monthFormat)]);
$subTitleIcon = 'fa-calendar'; $subTitleIcon = 'fa-calendar';
$displaySum = true; // to show sums in report. $end = clone $start;
$end = clone $date;
$start = clone $date;
if ($shared == 'shared') {
$shared = true;
}
// set start and end.
$start->startOfMonth();
$end->endOfMonth();
// 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'
)
);
}
/**
* @param $year
*
* @return $this
*/
public function year($year, $shared = false)
{
$date = new Carbon('01-01-' . $year);
$end = clone $date;
$subTitle = trans('firefly.reportForYear', ['year' => $year]);
$subTitleIcon = 'fa-bar-chart';
$totalExpense = 0; $totalExpense = 0;
$totalIncome = 0; $totalIncome = 0;
$incomeTopLength = 8; $incomeTopLength = 8;
$expenseTopLength = 8; $expenseTopLength = 8;
if ($shared == 'shared') { if ($shared == 'shared') {
$shared = true; $shared = true;
$subTitle = trans('firefly.reportForYearShared', ['year' => $year]); $subTitle = trans('firefly.reportForMonthShared', ['date' => $start->formatLocalized($this->monthFormat)]);
}
$end->endOfYear();
/**
* ALL ACCOUNTS
* Summarized as well.
*/
$accounts = $this->query->getAllAccounts($date, $end, $shared);
$accountsSums = ['start' => 0, 'end' => 0, 'diff' => 0];
// summarize:
foreach ($accounts as $account) {
$accountsSums['start'] += $account->startBalance;
$accountsSums['end'] += $account->endBalance;
$accountsSums['diff'] += ($account->endBalance - $account->startBalance);
} }
$end->endOfMonth();
// all accounts:
$accounts = $this->helper->getAccountReport($start, $end, $shared);
/** /**
* ALL INCOMES. * ALL INCOMES.
* Grouped, sorted and summarized. * Grouped, sorted and summarized.
*/ */
$set = $this->query->incomeInPeriod($date, $end, $shared); $set = $this->query->incomeInPeriod($start, $end, $shared);
// group, sort and sum: // group, sort and sum:
$incomes = []; $incomes = [];
foreach ($set as $entry) { foreach ($set as $entry) {
@@ -327,7 +200,7 @@ class ReportController extends Controller
* GET ALL EXPENSES * GET ALL EXPENSES
* Summarized. * Summarized.
*/ */
$set = $this->query->expenseInPeriod($date, $end, $shared); $set = $this->query->expenseInPeriod($start, $end, $shared);
// group, sort and sum: // group, sort and sum:
$expenses = []; $expenses = [];
foreach ($set as $entry) { foreach ($set as $entry) {
@@ -357,14 +230,214 @@ class ReportController extends Controller
); );
unset($set, $id); unset($set, $id);
/**
* 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',
compact(
'start', 'shared',
'subTitle', 'subTitleIcon',
'accounts', 'accountsSums',
'incomes', 'totalIncome', 'incomeTopLength',
'expenses', 'totalExpense', 'expenseTopLength',
'budgets', 'budgetSums',
'categories', 'categorySum'
)
);
// 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'
// )
// );
}
/**
* @param $year
*
* @return $this
*/
public function year($year, $shared = false)
{
$start = new Carbon('01-01-' . $year);
$end = clone $start;
$subTitle = trans('firefly.reportForYear', ['year' => $year]);
$subTitleIcon = 'fa-bar-chart';
$incomeTopLength = 8;
$expenseTopLength = 8;
if ($shared == 'shared') {
$shared = true;
$subTitle = trans('firefly.reportForYearShared', ['year' => $year]);
}
$end->endOfYear();
$accounts = $this->helper->getAccountReport($start, $end, $shared);
$incomes = $this->helper->getIncomeReport($start, $end, $shared);
$expenses = $this->helper->getExpenseReport($start, $end, $shared);
return view( return view(
'reports.year', 'reports.year',
compact( compact(
'date', // the date for this report. 'start', // the date for this report.
'shared', // is a shared report? 'shared', // is a shared report?
'totalExpense', 'totalIncome', // total income and expense.
'accounts', // all accounts 'accounts', // all accounts
'accountsSums', // sums for all accounts
'incomes', 'expenses', // expenses and incomes. 'incomes', 'expenses', // expenses and incomes.
'subTitle', 'subTitleIcon', // subtitle and subtitle icon. 'subTitle', 'subTitleIcon', // subtitle and subtitle icon.
'incomeTopLength', // length of income top X 'incomeTopLength', // length of income top X

View File

@@ -2,135 +2,147 @@
// general fields and things. // general fields and things.
return [ return [
'test' => 'You have selected English.', 'test' => 'You have selected English.',
'close' => 'Close', 'close' => 'Close',
'pleaseHold' => 'Please hold...', 'pleaseHold' => 'Please hold...',
'mandatoryFields' => 'Mandatory fields', 'mandatoryFields' => 'Mandatory fields',
'optionalFields' => 'Optional fields', 'optionalFields' => 'Optional fields',
'options' => 'Options', 'options' => 'Options',
'something' => 'Something!', 'something' => 'Something!',
'actions' => 'Actions', 'actions' => 'Actions',
'edit' => 'Edit', 'edit' => 'Edit',
'delete' => 'Delete', 'delete' => 'Delete',
'welcomeBack' => 'What\'s playing?', 'welcomeBack' => 'What\'s playing?',
// new user: // new user:
'welcome' => 'Welcome to Firefly!', 'welcome' => 'Welcome to Firefly!',
'createNewAsset' => 'Create a new asset account to get started. This will allow you to create transactions and start your financial management', 'createNewAsset' => 'Create a new asset account to get started. This will allow you to create transactions and start your financial management',
'createNewAssetButton' => 'Create new asset account', 'createNewAssetButton' => 'Create new asset account',
// home page: // home page:
'yourAccounts' => 'Your accounts', 'yourAccounts' => 'Your accounts',
'budgetsAndSpending' => 'Budgets and spending', 'budgetsAndSpending' => 'Budgets and spending',
'savings' => 'Savings', 'savings' => 'Savings',
'markAsSavingsToContinue' => 'Mark your asset accounts as "Savings account" to fill this panel', 'markAsSavingsToContinue' => 'Mark your asset accounts as "Savings account" to fill this panel',
'createPiggyToContinue' => 'Create piggy banks to fill this panel.', 'createPiggyToContinue' => 'Create piggy banks to fill this panel.',
'newWithdrawal' => 'New expense', 'newWithdrawal' => 'New expense',
'newDeposit' => 'New deposit', 'newDeposit' => 'New deposit',
'newTransfer' => 'New transfer', 'newTransfer' => 'New transfer',
'moneyIn' => 'Money in', 'moneyIn' => 'Money in',
'moneyOut' => 'Money out', 'moneyOut' => 'Money out',
'billsToPay' => 'Bills to pay', 'billsToPay' => 'Bills to pay',
'billsPaid' => 'Bills paid', 'billsPaid' => 'Bills paid',
'viewDetails' => 'View details', 'viewDetails' => 'View details',
'divided' => 'divided', 'divided' => 'divided',
'toDivide' => 'left to divide', 'toDivide' => 'left to divide',
// menu and titles, should be recycled as often as possible: // menu and titles, should be recycled as often as possible:
'toggleNavigation' => 'Toggle navigation', 'toggleNavigation' => 'Toggle navigation',
'seeAllReminders' => 'See all reminders', 'seeAllReminders' => 'See all reminders',
'reminders' => 'Reminders', 'reminders' => 'Reminders',
'currency' => 'Currency', 'currency' => 'Currency',
'preferences' => 'Preferences', 'preferences' => 'Preferences',
'logout' => 'Logout', 'logout' => 'Logout',
'searchPlaceholder' => 'Search...', 'searchPlaceholder' => 'Search...',
'dashboard' => 'Dashboard', 'dashboard' => 'Dashboard',
'currencies' => 'Currencies', 'currencies' => 'Currencies',
'accounts' => 'Accounts', 'accounts' => 'Accounts',
'assetAccounts' => 'Asset accounts', 'assetAccounts' => 'Asset accounts',
'expenseAccounts' => 'Expense accounts', 'expenseAccounts' => 'Expense accounts',
'revenueAccounts' => 'Revenue accounts', 'revenueAccounts' => 'Revenue accounts',
'Asset account' => 'Asset account', 'Asset account' => 'Asset account',
'Expense account' => 'Expense account', 'Expense account' => 'Expense account',
'Revenue Account' => 'Revenue account', 'Revenue Account' => 'Revenue account',
'budgets' => 'Budgets', 'budgets' => 'Budgets',
'categories' => 'Categories', 'categories' => 'Categories',
'tags' => 'Tags', 'tags' => 'Tags',
'reports' => 'Reports', 'reports' => 'Reports',
'transactions' => 'Transactions', 'transactions' => 'Transactions',
'expenses' => 'Expenses', 'expenses' => 'Expenses',
'income' => 'Revenue / income', 'income' => 'Revenue / income',
'transfers' => 'Transfer', 'transfers' => 'Transfer',
'moneyManagement' => 'Money management', 'moneyManagement' => 'Money management',
'piggyBanks' => 'Piggy banks', 'piggyBanks' => 'Piggy banks',
'bills' => 'Bills', 'bills' => 'Bills',
'createNew' => 'Create new', 'createNew' => 'Create new',
'withdrawal' => 'Withdrawal', 'withdrawal' => 'Withdrawal',
'deposit' => 'Deposit', 'deposit' => 'Deposit',
'transfer' => 'Transfer', 'transfer' => 'Transfer',
'Withdrawal' => 'Withdrawal', 'Withdrawal' => 'Withdrawal',
'Deposit' => 'Deposit', 'Deposit' => 'Deposit',
'Transfer' => 'Transfer', 'Transfer' => 'Transfer',
'bill' => 'Rekening', 'bill' => 'Rekening',
'yes' => 'Yes', 'yes' => 'Yes',
'no' => 'No', 'no' => 'No',
'amount' => 'Amount', 'amount' => 'Amount',
'newBalance' => 'New balance', 'newBalance' => 'New balance',
'overview' => 'Overview', 'overview' => 'Overview',
'saveOnAccount' => 'Save on account', 'saveOnAccount' => 'Save on account',
'unknown' => 'Unknown', 'unknown' => 'Unknown',
'daily' => 'Daily', 'daily' => 'Daily',
'weekly' => 'Weekly', 'weekly' => 'Weekly',
'monthly' => 'Monthly', 'monthly' => 'Monthly',
'quarterly' => 'Quarterly', 'quarterly' => 'Quarterly',
'half-year' => 'Every six months', 'half-year' => 'Every six months',
'yearly' => 'Yearly', 'yearly' => 'Yearly',
'reportForYear' => 'Yearly report for :year', 'reportForYear' => 'Yearly report for :year',
'reportForYearShared' => 'Yearly report for :year (including shared accounts)', 'reportForYearShared' => 'Yearly report for :year (including shared accounts)',
'incomeVsExpenses' => 'Income vs. expenses', 'reportForMonth' => 'Montly report for :year',
'accountBalances' => 'Account balances', 'reportForMonthShared' => 'Montly report for :year (including shared accounts)',
'balanceStartOfYear' => 'Balance at start of year', 'incomeVsExpenses' => 'Income vs. expenses',
'balanceEndOfYear' => 'Balance at end of year', 'accountBalances' => 'Account balances',
'difference' => 'Difference', 'balanceStartOfYear' => 'Balance at start of year',
'in' => 'In', 'balanceEndOfYear' => 'Balance at end of year',
'out' => 'Out', 'balanceStartOfMonth' => 'Balance at end of month',
'topX' => 'top :number', 'balanceEndOfMonth' => 'Balance at end of month',
'showTheRest' => 'Show everything', 'account' => 'Account',
'hideTheRest' => 'Show only the top :number',
'splitByAccount' => 'Split by account',
'balancedByTransfersAndTags' => 'Balanced by transfers and tags',
'leftUnbalanced' => 'Left unbalanced',
'expectedBalance' => 'Expected balance',
'outsideOfBudgets' => 'Outside of budgets',
'difference' => 'Difference',
'in' => 'In',
'out' => 'Out',
'topX' => 'top :number',
'showTheRest' => 'Show everything',
'hideTheRest' => 'Show only the top :number',
// charts: // charts:
'dayOfMonth' => 'Day of the month', 'dayOfMonth' => 'Day of the month',
'month' => 'Month', 'month' => 'Month',
'budget' => 'Budget', 'budget' => 'Budget',
'spent' => 'Spent', 'spent' => 'Spent',
'overspent' => 'Overspent', 'overspent' => 'Overspent',
'left' => 'Left', 'left' => 'Left',
'noCategory' => '(no category)', 'noCategory' => '(no category)',
'noBudget' => '(no budget)', 'noBudget' => '(no budget)',
'category' => 'Category', 'category' => 'Category',
'maxAmount' => 'Maximum amount', 'maxAmount' => 'Maximum amount',
'minAmount' => 'Minumum amount', 'minAmount' => 'Minumum amount',
'billEntry' => 'Current bill entry', 'billEntry' => 'Current bill entry',
'name' => 'Name', 'name' => 'Name',
'date' => 'Date', 'date' => 'Date',
'paid' => 'Paid', 'paid' => 'Paid',
'unpaid' => 'Unpaid', 'unpaid' => 'Unpaid',
'day' => 'Day', 'day' => 'Day',
'budgeted' => 'Budgeted', 'budgeted' => 'Budgeted',
'period' => 'Period', 'period' => 'Period',
'balance' => 'Balance', 'balance' => 'Balance',
'summary' => 'Summary', 'summary' => 'Summary',
'sum' => 'Sum', 'sum' => 'Sum',
'average' => 'Average', 'average' => 'Average',
'balanceFor' => 'Balance for :name', 'balanceFor' => 'Balance for :name',
'asset_accounts' => 'Asset accounts', 'asset_accounts' => 'Asset accounts',
'expense_accounts' => 'Expense accounts', 'expense_accounts' => 'Expense accounts',
'revenue_accounts' => 'Revenue accounts', 'revenue_accounts' => 'Revenue accounts',
// some extra help: // some extra help:
'accountExtraHelp_asset' => '', 'accountExtraHelp_asset' => '',
'accountExtraHelp_expense' => '', 'accountExtraHelp_expense' => '',
'accountExtraHelp_revenue' => '', 'accountExtraHelp_revenue' => '',
]; ];

View File

@@ -2,142 +2,154 @@
// general fields and things. // general fields and things.
return [ return [
'test' => 'Nederlands geselecteerd!', 'test' => 'Nederlands geselecteerd!',
'close' => 'Sluiten', 'close' => 'Sluiten',
'pleaseHold' => 'Momentje...', 'pleaseHold' => 'Momentje...',
'mandatoryFields' => 'Verplichte velden', 'mandatoryFields' => 'Verplichte velden',
'optionalFields' => 'Optionele velden', 'optionalFields' => 'Optionele velden',
'options' => 'Opties', 'options' => 'Opties',
'something' => 'Iets!', 'something' => 'Iets!',
'actions' => 'Acties', 'actions' => 'Acties',
'edit' => 'Wijzig', 'edit' => 'Wijzig',
'delete' => 'Verwijder', 'delete' => 'Verwijder',
'welcomeBack' => 'Hoe staat het er voor?', 'welcomeBack' => 'Hoe staat het er voor?',
// new user: // new user:
'welcome' => 'Welkom bij Firefly!', 'welcome' => 'Welkom bij Firefly!',
'createNewAsset' => 'Maak om te beginnen een nieuwe betaalrekening. Dit is je start van je financiële beheer.', 'createNewAsset' => 'Maak om te beginnen een nieuwe betaalrekening. Dit is je start van je financiële beheer.',
'createNewAssetButton' => 'Maak een nieuwe betaalrekening', 'createNewAssetButton' => 'Maak een nieuwe betaalrekening',
// home page: // home page:
'yourAccounts' => 'Je betaalrekeningen', 'yourAccounts' => 'Je betaalrekeningen',
'budgetsAndSpending' => 'Budgetten en uitgaven', 'budgetsAndSpending' => 'Budgetten en uitgaven',
'savings' => 'Sparen', 'savings' => 'Sparen',
'markAsSavingsToContinue' => 'Om hier wat te zien stel je je betaalrekeningen in als "spaarrekening".', 'markAsSavingsToContinue' => 'Om hier wat te zien stel je je betaalrekeningen in als "spaarrekening".',
'createPiggyToContinue' => 'Maak spaarpotjes om hier iets te zien.', 'createPiggyToContinue' => 'Maak spaarpotjes om hier iets te zien.',
'newWithdrawal' => 'Nieuwe uitgave', 'newWithdrawal' => 'Nieuwe uitgave',
'newDeposit' => 'Nieuwe inkomsten', 'newDeposit' => 'Nieuwe inkomsten',
'newTransfer' => 'Nieuwe overschrijving', 'newTransfer' => 'Nieuwe overschrijving',
'moneyIn' => 'Inkomsten', 'moneyIn' => 'Inkomsten',
'moneyOut' => 'Uitgaven', 'moneyOut' => 'Uitgaven',
'billsToPay' => 'Openstaande rekeningen', 'billsToPay' => 'Openstaande rekeningen',
'billsPaid' => 'Betaalde rekeningen', 'billsPaid' => 'Betaalde rekeningen',
'viewDetails' => 'Meer info', 'viewDetails' => 'Meer info',
'divided' => 'verdeeld', 'divided' => 'verdeeld',
'toDivide' => 'te verdelen', 'toDivide' => 'te verdelen',
// menu and titles, should be recycled as often as possible: // menu and titles, should be recycled as often as possible:
'toggleNavigation' => 'Navigatie aan of uit', 'toggleNavigation' => 'Navigatie aan of uit',
'seeAllReminders' => 'Bekijk alle herinneringen', 'seeAllReminders' => 'Bekijk alle herinneringen',
'reminders' => 'Herinneringen', 'reminders' => 'Herinneringen',
'currency' => 'Munteenheden', 'currency' => 'Munteenheden',
'preferences' => 'Voorkeuren', 'preferences' => 'Voorkeuren',
'logout' => 'Uitloggen', 'logout' => 'Uitloggen',
'searchPlaceholder' => 'Zoeken...', 'searchPlaceholder' => 'Zoeken...',
'dashboard' => 'Dashboard', 'dashboard' => 'Dashboard',
'currencies' => 'Munteenheden', 'currencies' => 'Munteenheden',
'accounts' => 'Rekeningen', 'accounts' => 'Rekeningen',
'assetAccounts' => 'Betaalrekeningen', 'assetAccounts' => 'Betaalrekeningen',
'expenseAccounts' => 'Crediteuren', 'expenseAccounts' => 'Crediteuren',
'revenueAccounts' => 'Debiteuren', 'revenueAccounts' => 'Debiteuren',
'Asset account' => 'Betaalrekening', 'Asset account' => 'Betaalrekening',
'Expense account' => 'Crediteur', 'Expense account' => 'Crediteur',
'Revenue Account' => 'Debiteur', 'Revenue Account' => 'Debiteur',
'budgets' => 'Budgetten', 'budgets' => 'Budgetten',
'categories' => 'Categorieën', 'categories' => 'Categorieën',
'tags' => 'Tags', 'tags' => 'Tags',
'reports' => 'Overzichten', 'reports' => 'Overzichten',
'transactions' => 'Transacties', 'transactions' => 'Transacties',
'expenses' => 'Uitgaven', 'expenses' => 'Uitgaven',
'income' => 'Inkomsten', 'income' => 'Inkomsten',
'transfers' => 'Overschrijvingen', 'transfers' => 'Overschrijvingen',
'moneyManagement' => 'Geldbeheer', 'moneyManagement' => 'Geldbeheer',
'piggyBanks' => 'Spaarpotjes', 'piggyBanks' => 'Spaarpotjes',
'bills' => 'Rekeningen', 'bills' => 'Rekeningen',
'createNew' => 'Nieuw', 'createNew' => 'Nieuw',
'withdrawal' => 'Uitgave', 'withdrawal' => 'Uitgave',
'deposit' => 'Inkomsten', 'deposit' => 'Inkomsten',
'transfer' => 'Overschrijving', 'transfer' => 'Overschrijving',
'Withdrawal' => 'Uitgave', 'Withdrawal' => 'Uitgave',
'Deposit' => 'Inkomsten', 'Deposit' => 'Inkomsten',
'Transfer' => 'Overschrijving', 'Transfer' => 'Overschrijving',
'bill' => 'Rekening', 'bill' => 'Rekening',
'yes' => 'Ja', 'yes' => 'Ja',
'no' => 'Nee', 'no' => 'Nee',
'amount' => 'Bedrag', 'amount' => 'Bedrag',
'newBalance' => 'Nieuw saldo', 'newBalance' => 'Nieuw saldo',
'overview' => 'Overzicht', 'overview' => 'Overzicht',
'saveOnAccount' => 'Sparen op rekening', 'saveOnAccount' => 'Sparen op rekening',
'unknown' => 'Onbekend', 'unknown' => 'Onbekend',
'daily' => 'Dagelijks', 'daily' => 'Dagelijks',
'weekly' => 'Wekelijks', 'weekly' => 'Wekelijks',
'monthly' => 'Maandelijks', 'monthly' => 'Maandelijks',
'quarterly' => 'Elk kwartaal', 'quarterly' => 'Elk kwartaal',
'half-year' => 'Elk half jaar', 'half-year' => 'Elk half jaar',
'yearly' => 'Jaarlijks', 'yearly' => 'Jaarlijks',
'reportForYear' => 'Jaaroverzicht :year', 'reportForYear' => 'Jaaroverzicht :year',
'reportForYearShared' => 'Jaaroverzicht :year (inclusief gedeelde rekeningen)', 'reportForYearShared' => 'Jaaroverzicht :year (inclusief gedeelde rekeningen)',
'incomeVsExpenses' => 'Inkomsten tegenover uitgaven', 'reportForMonth' => 'Maandoverzicht van :date',
'accountBalances' => 'Rekeningsaldi', 'reportForMonthShared' => 'Maandoverzicht van :date (inclusief gedeelde rekeningen)',
'balanceStartOfYear' => 'Saldo aan het begin van het jaar', 'incomeVsExpenses' => 'Inkomsten tegenover uitgaven',
'balanceEndOfYear' => 'Saldo aan het einde van het jaar', 'accountBalances' => 'Rekeningsaldi',
'difference' => 'Verschil', 'balanceStartOfYear' => 'Saldo aan het begin van het jaar',
'in' => 'In', 'balanceEndOfYear' => 'Saldo aan het einde van het jaar',
'out' => 'Uit', 'balanceStartOfMonth' => 'Saldo aan het einde van de maand',
'topX' => 'top :number', 'balanceEndOfMonth' => 'Saldo aan het einde van de maand',
'showTheRest' => 'Laat alles zien', 'account' => 'Rekening',
'hideTheRest' => 'Laat alleen de top :number zien',
'splitByAccount' => 'Per betaalrekening',
'balancedByTransfersAndTags' => 'Gecorrigeerd met overschrijvingen en tags',
'leftUnbalanced' => 'Ongecorrigeerd',
'expectedBalance' => 'Verwacht saldo',
'outsideOfBudgets' => 'Buiten budgetten',
'difference' => 'Verschil',
'in' => 'In',
'out' => 'Uit',
'topX' => 'top :number',
'showTheRest' => 'Laat alles zien',
'hideTheRest' => 'Laat alleen de top :number zien',
// charts: // charts:
'dayOfMonth' => 'Dag vd maand', 'dayOfMonth' => 'Dag vd maand',
'month' => 'Maand', 'month' => 'Maand',
'budget' => 'Budget', 'budget' => 'Budget',
'spent' => 'Uitgegeven', 'spent' => 'Uitgegeven',
'overspent' => 'Teveel uitgegeven', 'overspent' => 'Teveel uitgegeven',
'left' => 'Over', 'left' => 'Over',
'noCategory' => '(geen categorie)', 'noCategory' => '(geen categorie)',
'noBudget' => '(geen budget)', 'noBudget' => '(geen budget)',
'category' => 'Categorie', 'category' => 'Categorie',
'maxAmount' => 'Maximaal bedrag', 'maxAmount' => 'Maximaal bedrag',
'minAmount' => 'Minimaal bedrag', 'minAmount' => 'Minimaal bedrag',
'billEntry' => 'Bedrag voor deze rekening', 'billEntry' => 'Bedrag voor deze rekening',
'name' => 'Naam', 'name' => 'Naam',
'date' => 'Datum', 'date' => 'Datum',
'paid' => 'Betaald', 'paid' => 'Betaald',
'unpaid' => 'Niet betaald', 'unpaid' => 'Niet betaald',
'day' => 'Dag', 'day' => 'Dag',
'budgeted' => 'Gebudgetteerd', 'budgeted' => 'Gebudgetteerd',
'period' => 'Periode', 'period' => 'Periode',
'balance' => 'Saldo', 'balance' => 'Saldo',
'summary' => 'Samenvatting', 'summary' => 'Samenvatting',
'sum' => 'Som', 'sum' => 'Som',
'average' => 'Gemiddeld', 'average' => 'Gemiddeld',
'balanceFor' => 'Saldo op :name', 'balanceFor' => 'Saldo op :name',
'asset_accounts' => 'Betaalrekeningen', 'asset_accounts' => 'Betaalrekeningen',
'expense_accounts' => 'Crediteuren', 'expense_accounts' => 'Crediteuren',
'revenue_accounts' => 'Debiteuren', 'revenue_accounts' => 'Debiteuren',
// some extra help: // some extra help:
'accountExtraHelp_asset' => '', 'accountExtraHelp_asset' => '',
'accountExtraHelp_expense' => 'Een crediteur is een persoon of een bedrijf waar je geld aan moet betalen. Je staat bij ze in het krijt. Een verwarrende' . 'accountExtraHelp_expense' => 'Een crediteur is een persoon of een bedrijf waar je geld aan moet betalen. Je staat bij ze in het krijt. Een verwarrende' .
' term misschien, maar zo werkt het nou eenmaal. De supermarkt, je huurbaas of de bank zijn crediteuren. Jouw ' . ' term misschien, maar zo werkt het nou eenmaal. De supermarkt, je huurbaas of de bank zijn crediteuren. Jouw ' .
'geld (krediet) gaat naar hen toe. De term komt uit de wereld van de boekhouding. De uitgaves die je hier ziet zijn ' . 'geld (krediet) gaat naar hen toe. De term komt uit de wereld van de boekhouding. De uitgaves die je hier ziet zijn ' .
'positief, want je kijkt uit hun perspectief. Zodra jij afrekent in een winkel, komt het geld er bij hen bij (positief).', 'positief, want je kijkt uit hun perspectief. Zodra jij afrekent in een winkel, komt het geld er bij hen bij (positief).',
'accountExtraHelp_revenue' => 'Als je geld krijgt van een bedrijf of een persoon is dat een debiteur. ' . 'accountExtraHelp_revenue' => 'Als je geld krijgt van een bedrijf of een persoon is dat een debiteur. ' .
'Dat kan salaris zijn, of een andere betaling. ' . 'Dat kan salaris zijn, of een andere betaling. ' .
' Ze hebben een schuld (debet) aan jou. De term komt uit de wereld van de boekhouding.' . ' Ze hebben een schuld (debet) aan jou. De term komt uit de wereld van de boekhouding.' .
' De inkomsten die je hier ziet zijn negatief, want je kijkt uit hun perspectief. Zodra een debiteur geld naar jou ' . ' De inkomsten die je hier ziet zijn negatief, want je kijkt uit hun perspectief. Zodra een debiteur geld naar jou ' .
'overmaakt gaat het er bij hen af (negatief).', 'overmaakt gaat het er bij hen af (negatief).',
]; ];

View File

@@ -1,218 +1,241 @@
{% extends "./layout/default.twig" %} {% extends "./layout/default.twig" %}
{% block content %} {% block content %}
{{ Breadcrumbs.renderIfExists(Route.getCurrentRoute.getName, date, shared) }} {{ Breadcrumbs.renderIfExists(Route.getCurrentRoute.getName, start, shared) }}
<div class="row"> <div class="row">
<div class="col-lg-5 col-md-5 col-sm-12"> <div class="col-lg-12 col-md-12 col-sm-12">
<div class="panel panel-default"> <div class="panel panel-default">
<div class="panel-heading"> <div class="panel-heading">
<i class="fa fa-long-arrow-right fa-fw"></i> <i class="fa fa-line-chart"></i>
Income {{ 'accountBalances'|_ }}
</div>
<div class="panel-body">
<div id="account-balances-chart"></div>
</div>
</div> </div>
<table class="table table-bordered"> </div>
{% set sum = 0 %} </div>
{% for entry in income %}
{% set sum = sum + entry.queryAmount %} <div class="row">
<div class="col-lg-6 col-md-6 col-sm-6">
<div class="panel panel-default">
<div class="panel-heading">
<i class="fa fa-fw fa-credit-card"></i>
{{ 'accountBalances'|_ }}
</div>
<table class="table table-bordered table-striped">
<tr>
<th>{{ 'account'|_ }}</th>
<th>{{ 'balanceStartOfMonth'|_ }}</th>
<th>{{ 'balanceEndOfMonth'|_ }}</th>
<th>{{ 'difference'|_ }}</th>
</tr>
{% for account in accounts %}
<tr> <tr>
<td><a href="{{route('accounts.show',account.id)}}">{{ account.name }}</a></td>
<td>{{ account.startBalance|formatAmount }}</td>
<td>{{ account.endBalance|formatAmount }}</td>
<td> <td>
<a href="{{ route('transactions.show',entry.id) }}" title="{{ entry.description }}">{{ entry.description }}</a> {{ (account.startBalance - account.endBalance)|formatAmount }}
</td>
<td>
{% if entry.type == 'Withdrawal' %}
<span class="text-danger">{{entry.queryAmount|formatAmountPlain}}</span>
{% endif %}
{% if entry.type == 'Deposit' %}
<span class="text-success">{{entry.queryAmount|formatAmountPlain}}</span>
{% endif %}
{% if entry.type == 'Transfer' %}
<span class="text-info">{{entry.queryAmount|formatAmountPlain}}</span>
{% endif %}
</td>
<td>
{{entry.date.format('j F Y')}}
</td>
<td>
<a href="{{route('accounts.show',entry.account_id)}}">{{ entry.name }}</a>
</td> </td>
</tr> </tr>
{% endfor %} {% endfor %}
{% if displaySum %} </table>
</div>
<!-- income vs expenses -->
<div class="panel panel-default">
<div class="panel-heading">
<i class="fa fa-fw fa-exchange"></i>
{{ 'incomeVsExpenses'|_ }}
</div>
<table class="table table-bordered table-striped">
<tr>
<td>{{ 'in'|_ }}</td>
<td>{{ totalIncome|formatAmount }}</td>
</tr>
<tr>
<td>{{ 'out'|_ }}</td>
<td><span class="text-danger">{{ (totalExpense * -1)|formatAmountPlain }}</span></td>
</tr>
<tr>
<td>{{ 'difference'|_ }}</td>
<td>{{ (totalIncome + totalExpense)|formatAmount }}</td>
</tr>
</table>
</div>
</div>
<div class="col-lg-3 col-md-3 col-sm-3">
<!-- income -->
<div class="panel panel-default">
<div class="panel-heading">
<i class="fa fa-long-arrow-right fa-fw"></i>
{{ 'income'|_ }} ({{ trans('firefly.topX',{number: incomeTopLength}) }})
</div>
<table class="table">
{% for id,row in incomes %}
{% if loop.index > incomeTopLength %}
<tr class="collapse out incomesCollapsed">
{% else %}
<tr>
{% endif %}
<td>
<a href="{{ route('accounts.show',id) }}" title="{{ row.name }}">{{ row.name }}</a>
{% if row.count > 1 %}
<br /><small>{{ row.count }} {{ 'transactions'|_|lower }}</small>
{% endif %}
</td>
<td>{{ row.amount|formatAmount }}</td>
</tr>
{% endfor %}
{% if incomes|length > incomeTopLength %}
<tr> <tr>
<td><em>Sum</em></td> <td colspan="2" class="active">
<td colspan="3">{{ sum|formatAmount }}</td> <a href="#" id="showIncomes">{{ trans('firefly.showTheRest',{number:incomeTopLength}) }}</a>
</td>
</tr> </tr>
{% endif %} {% endif %}
<tr>
<td><em>{{ 'sum'|_ }}</em></td>
<td>{{ totalIncome|formatAmount }}</td>
</tr>
</table>
</div>
</div>
<div class="col-lg-3 col-md-3 col-sm-3">
<!-- expenses -->
<div class="panel panel-default">
<div class="panel-heading">
<i class="fa fa-long-arrow-left fa-fw"></i>
{{ 'expenses'|_ }} ({{ trans('firefly.topX',{number: expenseTopLength}) }})
</div>
<table class="table">
{% set sum =0 %}
{% for row in expenses %}
{% if loop.index > expenseTopLength %}
<tr class="collapse out expenseCollapsed">
{% else %}
<tr>
{% endif %}
<td>
<a href="{{ route('accounts.show',row.id) }}">{{ row.name }}</a>
{% if row.count > 1 %}
<br /><small>{{ row.count }} {{ 'transactions'|_|lower }}</small>
{% endif %}
</td>
<td><span class="text-danger">{{ (row.amount*-1)|formatAmountPlain }}</span></td>
</tr>
{% set sum = sum + row.amount %}
{% endfor %}
{% if expenses|length > expenseTopLength %}
<tr>
<td colspan="2" class="active">
<a href="#" id="showExpenses">{{ trans('firefly.showTheRest',{number:incomeTopLength}) }}</a>
</td>
</tr>
{% endif %}
<tr>
<td><em>{{ 'sum'|_ }}</em></td>
<td><span class="text-danger">{{ (sum * -1)|formatAmountPlain }}</span></td>
</tr>
</table>
</div>
</div>
</div>
<div class="row">
<div class="col-lg-8 col-md-8 col-sm-12">
<div class="panel panel-default">
<div class="panel-heading">
<i class="fa fa-tasks fa-fw"></i>
{{ 'budgets'|_ }}
</div>
<table class="table table-bordered">
<tr>
<th>{{ 'budget'|_ }}</th>
<th>{{ 'date'|_ }}</th>
<th>{{ 'budgeted'|_ }}</th>
<th>{{ 'spent'|_ }}</th>
<th>{{ 'left'|_ }}</th>
<th>{{ 'overspent'|_ }}</th>
</tr>
{% for data in budgets %}
<tr>
<td>
{% if data[0] %}
<a href="{{route('budgets.show',data[0].id)}}">{{ data[0].name }}</a>
{% else %}
<em>{{ 'noBudget'|_ }}</em>
{% endif %}
</td>
<td>
{% if data[1] %}
{{ data[1].startdate.formatLocalized(monthAndDayFormat) }}
{% endif %}
</td>
<td>
{% if data[1] %}
{{ data[1].amount|formatAmount }}
{% else %}
{{ 0|formatAmount }}
{% endif %}
</td>
<td>
{% if data[3] != 0 %}
{{ data[3]|formatAmount }}
{% endif %}
</td>
<td>
{% if data[2] != 0 %}
{{ data[2]|formatAmount }}
{% endif %}
</td>
<td>
{% if data[4] != 0 %}
<span class="text-danger">{{ data[4]|formatAmountPlain }}</span>
{% endif %}
</td>
</tr>
{% endfor %}
<tr>
<td colspan="2"><em>{{ 'sum'|_ }}</em></td>
<td>{{ budgetSums.budgeted|formatAmount }}</td>
<td>{{ budgetSums.spent|formatAmount }}</td>
<td>{{ budgetSums.left|formatAmount }}</td>
<td><span class="text-danger">{{ budgetSums.overspent|formatAmountPlain }}</span></td>
</tr>
</table> </table>
</div> </div>
</div> </div>
<div class="col-lg-4 col-md-4 col-sm-12"> <div class="col-lg-4 col-md-4 col-sm-12">
<div class="panel panel-default">
<div class="panel-heading">
<i class="fa fa-long-arrow-left fa-fw"></i>
Expenses (top 10)
</div>
<table class="table table-bordered">
{% set sum = 0 %}
{% for id,expense in expenses %}
{% set sum = sum + expense.queryAmount %}
<tr>
{% if id > 0 %}
<td><a href="{{route('accounts.show',id)}}">{{ expense.name }}</a></td>
{% else %}
<td><em>{{ expense.name }}</em></td>
{% endif %}
<td><span class="text-danger">{{ expense.queryAmount|formatAmountPlain }}</span></td>
</tr>
{% endfor %}
<tr>
<td><em>Sum</em></td>
<td><span class="text-danger">{{ sum|formatAmountPlain }}</span></td>
</tr>
</table>
</div>
</div>
<div class="col-lg-3 col-md-4 col-sm-12">
<div class="panel panel-default">
<div class="panel-heading">
<i class="fa fa-exchange fa-fw"></i>
Sums
</div>
{% set totalIn = 0 %}
{% for entry in income %}
{% set totalIn = totalIn + entry.queryAmount %}
{% endfor %}
<table class="table table-bordered">
<tr>
<td>In</td>
<td>{{ totalIn|formatAmount }}</td>
</tr>
<tr>
<td>Out</td>
<td><span class="text-danger">{{ sum|formatAmountPlain }}</span></td>
</tr>
<tr>
<td>Difference</td>
<td>{{ (totalIn - sum)|formatAmount }}</td>
</tr>
</table>
</div>
</div>
</div>
<div class="row">
<div class="col-lg-6 col-md-6 col-sm-12">
<div class="panel panel-default">
<div class="panel-heading">
<i class="fa fa-tasks fa-fw"></i>
Budgets
</div>
<table class="table table-bordered">
<tr>
<th>Budget</th>
<th>Envelope</th>
<th>Spent</th>
<th>Left</th>
</tr>
{% set sumSpent = 0 %}
{% set sumEnvelope = 0 %}
{% set sumLeft = 0 %}
{% for id,budget in budgets %}
{% set sumSpent = sumSpent + budget.spent %}
{% set sumEnvelope = sumEnvelope + budget.queryAmount %}
{% set sumLeft = sumLeft + budget.queryAmount + budget.spent %}
<!-- only display when relevant: -->
{% if budget.queryAmount != 0 or budget.spent != 0 %}
<tr>
<td>
{% if id > 0 %}
<a href="{{route('budgets.show',id)}}">{{ budget.name }}</a>
{% else %}
<em>{{ budget.name }}</em>
{% endif %}
</td>
<td>{{ budget.queryAmount|formatAmount }}</td>
<td><span class="text-danger">{{ (budget.spent*-1)|formatAmountPlain }}</span></td>
<td>{{ (budget.queryAmount + budget.spent)|formatAmount }}</td>
</tr>
{% endif %}
{% endfor %}
<tr>
<td><em>Sum</em></td>
<td>{{ sumEnvelope|formatAmount }}</td>
<td>{{ sumSpent|formatAmount }}</td>
<td>{{ sumLeft|formatAmount }}</td>
</tr>
</table>
</div>
</div>
<div class="col-lg-6 col-md-6 col-sm-12">
<div class="panel panel-default"> <div class="panel panel-default">
<div class="panel-heading"> <div class="panel-heading">
<i class="fa fa-bar-chart fa-fw"></i> <i class="fa fa-bar-chart fa-fw"></i>
Categories {{ 'categories'|_ }}
</div> </div>
<table class="table table-bordered"> <table class="table table-bordered">
<tr> <tr>
<th>Category</th> <th>{{ 'categories'|_ }}</th>
<th>Spent</th> <th>{{ 'spent'|_ }}</th>
</tr> </tr>
{% set sum = 0 %} {% set sum = 0 %}
{% for id,category in categories %} {% for data in categories %}
{% set sum = sum + category.queryAmount %} {% if data[1] > 0 %}
<tr> <tr>
<td> <td>
{% if id > 0 %} <a href="{{route('categories.show',data[0].id)}}">{{ data[0].name }}</a>
<a href="{{route('categories.show',id)}}">{{ category.name }}</a> </td>
{% else %} <td><span class="text-danger">{{ (data[1])|formatAmountPlain }}</span></td>
<em>{{ category.name }}</em> </tr>
{% endif %} {% endif %}
</td>
<td><span class="text-danger">{{ (category.queryAmount * -1)|formatAmountPlain }}</span></td>
</tr>
{% endfor %} {% endfor %}
<tr>
<td><em>Sum</em></td>
<td><span class="text-danger">{{ (sum * -1)|formatAmountPlain }}</span></td>
</tr>
</table> </table>
</div> </div>
</div> </div>
</div> </div>
<div class="row"> <div class="row">
<div class="col-lg-12 col-md-12 col-sm-12"> <div class="col-lg-12 col-md-12 col-sm-12">
<div class="panel panel-default">
<div class="panel-heading">
<i class="fa fa-fw fa-credit-card"></i>
Accounts
</div>
<table class="table table-bordered table-striped">
<tr>
<th>Account</th>
<th>Start of month</th>
<th>Current balance</th>
<th>Spent</th>
<th>Earned</th>
</tr>
{% for account in accounts %}
<tr>
<td><a href="{{route('accounts.show',account.id)}}">{{ account.name }}</a></td>
<td>{{ account.startBalance|formatAmount }}</td>
<td>{{ account.endBalance|formatAmount }}</td>
<td>
{% if account.startBalance - account.endBalance > 0 %}
<span class="text-danger">{{ (account.startBalance - account.endBalance)|formatAmountPlain }}</span>
{% endif %}
</td>
<td>
{% if account.startBalance - account.endBalance < 0 %}
<span class="text-success">{{ ((account.startBalance - account.endBalance)*-1)|formatAmountPlain }}</span>
{% endif %}
</td>
</tr>
{% endfor %}
</table>
</div>
</div> </div>
</div> </div>
<div class="row"> <div class="row">
@@ -220,27 +243,31 @@
<div class="panel panel-default"> <div class="panel panel-default">
<div class="panel-heading"> <div class="panel-heading">
<i class="fa fa-sort-amount-asc fa-fw"></i> <i class="fa fa-sort-amount-asc fa-fw"></i>
Budgets {{ 'budgets'|_ }} ({{ 'splitByAccount'|_|lower }})
</div> </div>
<table class="table table-bordered table-striped"> <table class="table table-bordered table-striped">
<tr> <tr>
<th colspan="2">Budgets</th> <th colspan="2">{{ 'budgets'|_ }}</th>
{% for account in accounts %} {% for account in accounts %}
{% if not account.hide %} <th><a href="{{route('accounts.show',account.id)}}">{{ account.name }}</a></th>
<th><a href="{{route('accounts.show',account.id)}}">{{ account.name }}</a></th>
{% endif %}
{% endfor %} {% endfor %}
<th colspan="2"> <th colspan="2">
Left in budget {{ 'leftInBudget'|_ }}
</th> </th>
</tr> </tr>
{% for id,budget in budgets %} {% for data in budgets %}
<tr> {% if data[0] %}
<td>{{ budget.name }}</td> <tr>
<td>{{ budget.queryAmount|formatAmount }}</td> <td>{{ data[0].name }}</td>
{% set spent = 0 %} <td>
{% for account in accounts %} {% if data[1] %}
{% if not account.hide %} {{ data[1].amount|formatAmount }}
{% else %}
{{ 0|formatAmount }}
{% endif %}
</td>
{% set spent = 0 %}
{% for account in accounts %}
{% if account.budgetInformation[id] %} {% if account.budgetInformation[id] %}
<td> <td>
{% if id == 0 %} {% if id == 0 %}
@@ -255,14 +282,20 @@
{% else %} {% else %}
<td>{{ 0|formatAmount }}</td> <td>{{ 0|formatAmount }}</td>
{% endif %} {% endif %}
{% endif %} {% endfor %}
{% endfor %} <td>
<td>{{ (budget.queryAmount + budget.spent)|formatAmount }}</td> {% if data[1] %}
<td>{{ (budget.queryAmount + spent)|formatAmount }}</td> {{ (data[1].amount - data[3])|formatAmount }}
</tr> {% else %}
{{ (0 - data[3])|formatAmount }}
{% endif %}
</td>
<td>{{ data[2]|formatAmount }}</td>
</tr>
{% endif %}
{% endfor %} {% endfor %}
<tr> <tr>
<td colspan="2">Balanced by transfers</td> <td colspan="2">{{ 'balancedByTransfersAndTags'|_ }}</td>
{% for account in accounts %} {% for account in accounts %}
{% if not account.hide %} {% if not account.hide %}
<td> <td>
@@ -273,7 +306,7 @@
<td colspan="2">&nbsp;</td> <td colspan="2">&nbsp;</td>
</tr> </tr>
<tr> <tr>
<td colspan="2">Left unbalanced</td> <td colspan="2">{{ 'leftUnbalanced'|_ }}</td>
{% for account in accounts %} {% for account in accounts %}
{% if not account.hide %} {% if not account.hide %}
@@ -293,7 +326,7 @@
<td colspan="2">&nbsp;</td> <td colspan="2">&nbsp;</td>
</tr> </tr>
<tr> <tr>
<td colspan="2"><em>Sum</em></td> <td colspan="2"><em>{{ 'sum'|_ }}</em></td>
{% for account in accounts %} {% for account in accounts %}
{% if not account.hide %} {% if not account.hide %}
<td>{{ accountAmounts[account.id]|formatAmount }}</td> <td>{{ accountAmounts[account.id]|formatAmount }}</td>
@@ -302,7 +335,7 @@
<td colspan="2">&nbsp;</td> <td colspan="2">&nbsp;</td>
</tr> </tr>
<tr> <tr>
<td colspan="2">Expected balance</td> <td colspan="2">{{ 'expectedBalance'|_ }}</td>
{% for account in accounts %} {% for account in accounts %}
{% if not account.hide %} {% if not account.hide %}
<td>{{ (account.startBalance + accountAmounts[account.id])|formatAmount }}</td> <td>{{ (account.startBalance + accountAmounts[account.id])|formatAmount }}</td>
@@ -320,7 +353,7 @@
<div class="panel panel-default"> <div class="panel panel-default">
<div class="panel-heading"> <div class="panel-heading">
<i class="fa fa-calendar-o fa-fw"></i> <i class="fa fa-calendar-o fa-fw"></i>
Bills {{ 'bills'|_ }}
</div> </div>
<div class="panel-body">Body</div> <div class="panel-body">Body</div>
</div> </div>
@@ -331,7 +364,7 @@
<div class="panel panel-default"> <div class="panel panel-default">
<div class="panel-heading"> <div class="panel-heading">
<i class="fa fa-fw fa-folder-o"></i> <i class="fa fa-fw fa-folder-o"></i>
Outside of budgets {{ 'outsideOfBudgets'|_ }}
</div> </div>
<div class="panel-body">Body</div> <div class="panel-body">Body</div>
</div> </div>
@@ -339,5 +372,16 @@
</div> </div>
{% endblock %} {% endblock %}
{% block scripts %} {% block scripts %}
<script type="text/javascript">
var shared = {% if shared %}'/shared'{% else %}''{% endif %};
var incomeTopLength = {{ incomeTopLength }};
var expenseTopLength = {{ expenseTopLength }};
var incomeRestShow = false; // starts hidden.
var expenseRestShow = false; // starts hidden.
var showTheRest = '{{ trans('firefly.showTheRest',{number:incomeTopLength}) }}';
var hideTheRest = '{{ trans('firefly.hideTheRest',{number:incomeTopLength}) }}';
var showTheRestExpense = '{{ trans('firefly.showTheRest',{number:expenseTopLength}) }}';
var hideTheRestExpense = '{{ trans('firefly.hideTheRest',{number:expenseTopLength}) }}';
</script>
<script type="text/javascript" src="js/reports.js"></script> <script type="text/javascript" src="js/reports.js"></script>
{% endblock %} {% endblock %}

View File

@@ -1,6 +1,6 @@
{% extends "./layout/default.twig" %} {% extends "./layout/default.twig" %}
{% block content %} {% block content %}
{{ Breadcrumbs.renderIfExists(Route.getCurrentRoute.getName, date, shared) }} {{ Breadcrumbs.renderIfExists(Route.getCurrentRoute.getName, start, shared) }}
<div class="row"> <div class="row">
<div class="col-lg-10 col-md-8 col-sm-12"> <div class="col-lg-10 col-md-8 col-sm-12">
@@ -41,7 +41,7 @@
<th>{{ 'balanceStartOfYear'|_ }}</th> <th>{{ 'balanceStartOfYear'|_ }}</th>
<th>{{ 'difference'|_ }}</th> <th>{{ 'difference'|_ }}</th>
</tr> </tr>
{% for account in accounts %} {% for account in accounts.getAccounts %}
<tr> <tr>
<td> <td>
<a href="{{ route('accounts.show',account.id) }}" title="{{ account.name }}">{{ account.name }}</a> <a href="{{ route('accounts.show',account.id) }}" title="{{ account.name }}">{{ account.name }}</a>
@@ -53,9 +53,9 @@
{% endfor %} {% endfor %}
<tr> <tr>
<td><em>Sum of sums</em></td> <td><em>Sum of sums</em></td>
<td>{{ accountsSums.start|formatAmount }}</td> <td>{{ accounts.getStart|formatAmount }}</td>
<td>{{ accountsSums.end|formatAmount }}</td> <td>{{ accounts.getEnd|formatAmount }}</td>
<td>{{ accountsSums.diff|formatAmount }}</td> <td>{{ accounts.getDifference|formatAmount }}</td>
</tr> </tr>
</table> </table>
</div> </div>
@@ -88,22 +88,22 @@
{{ 'income'|_ }} ({{ trans('firefly.topX',{number: incomeTopLength}) }}) {{ 'income'|_ }} ({{ trans('firefly.topX',{number: incomeTopLength}) }})
</div> </div>
<table class="table"> <table class="table">
{% for id,row in incomes %} {% for income in incomes.getIncomes %}
{% if loop.index > incomeTopLength %} {% if loop.index > incomeTopLength %}
<tr class="collapse out incomesCollapsed"> <tr class="collapse out incomesCollapsed">
{% else %} {% else %}
<tr> <tr>
{% endif %} {% endif %}
<td> <td>
<a href="{{ route('accounts.show',id) }}" title="{{ row.name }}">{{ row.name }}</a> <a href="{{ route('accounts.show',income.id) }}" title="{{ income.name }}">{{ income.name }}</a>
{% if row.count > 1 %} {% if income.count > 1 %}
<br /><small>{{ row.count }} {{ 'transactions'|_|lower }}</small> <br /><small>{{ income.count }} {{ 'transactions'|_|lower }}</small>
{% endif %} {% endif %}
</td> </td>
<td>{{ row.amount|formatAmount }}</td> <td>{{ income.amount|formatAmount }}</td>
</tr> </tr>
{% endfor %} {% endfor %}
{% if incomes|length > incomeTopLength %} {% if incomes.getIncomes|length > incomeTopLength %}
<tr> <tr>
<td colspan="2" class="active"> <td colspan="2" class="active">
<a href="#" id="showIncomes">{{ trans('firefly.showTheRest',{number:incomeTopLength}) }}</a> <a href="#" id="showIncomes">{{ trans('firefly.showTheRest',{number:incomeTopLength}) }}</a>
@@ -112,7 +112,7 @@
{% endif %} {% endif %}
<tr> <tr>
<td><em>{{ 'sum'|_ }}</em></td> <td><em>{{ 'sum'|_ }}</em></td>
<td>{{ totalIncome|formatAmount }}</td> <td>{{ incomes.getTotal|formatAmount }}</td>
</tr> </tr>
</table> </table>
</div> </div>
@@ -124,24 +124,22 @@
{{ 'expenses'|_ }} ({{ trans('firefly.topX',{number: expenseTopLength}) }}) {{ 'expenses'|_ }} ({{ trans('firefly.topX',{number: expenseTopLength}) }})
</div> </div>
<table class="table"> <table class="table">
{% set sum =0 %} {% for expense in expenses.getExpenses %}
{% for row in expenses %}
{% if loop.index > expenseTopLength %} {% if loop.index > expenseTopLength %}
<tr class="collapse out expenseCollapsed"> <tr class="collapse out expenseCollapsed">
{% else %} {% else %}
<tr> <tr>
{% endif %} {% endif %}
<td> <td>
<a href="{{ route('accounts.show',row.id) }}">{{ row.name }}</a> <a href="{{ route('accounts.show',expense.id) }}">{{ expense.name }}</a>
{% if row.count > 1 %} {% if expense.count > 1 %}
<br /><small>{{ row.count }} {{ 'transactions'|_|lower }}</small> <br /><small>{{ expense.count }} {{ 'transactions'|_|lower }}</small>
{% endif %} {% endif %}
</td> </td>
<td><span class="text-danger">{{ (row.amount*-1)|formatAmountPlain }}</span></td> <td><span class="text-danger">{{ (expense.amount*-1)|formatAmountPlain }}</span></td>
</tr> </tr>
{% set sum = sum + row.amount %}
{% endfor %} {% endfor %}
{% if expenses|length > expenseTopLength %} {% if expenses.getExpenses|length > expenseTopLength %}
<tr> <tr>
<td colspan="2" class="active"> <td colspan="2" class="active">
<a href="#" id="showExpenses">{{ trans('firefly.showTheRest',{number:incomeTopLength}) }}</a> <a href="#" id="showExpenses">{{ trans('firefly.showTheRest',{number:incomeTopLength}) }}</a>
@@ -150,7 +148,7 @@
{% endif %} {% endif %}
<tr> <tr>
<td><em>{{ 'sum'|_ }}</em></td> <td><em>{{ 'sum'|_ }}</em></td>
<td><span class="text-danger">{{ (sum * -1)|formatAmountPlain }}</span></td> <td><span class="text-danger">{{ (expenses.getTotal * -1)|formatAmountPlain }}</span></td>
</tr> </tr>
</table> </table>
</div> </div>
@@ -191,7 +189,7 @@
<script type="text/javascript" src="js/gcharts.js"></script> <script type="text/javascript" src="js/gcharts.js"></script>
<script type="text/javascript"> <script type="text/javascript">
var year = '{{date.year}}'; var year = '{{start.year}}';
var shared = {% if shared %}'/shared'{% else %}''{% endif %}; var shared = {% if shared %}'/shared'{% else %}''{% endif %};
var incomeTopLength = {{ incomeTopLength }}; var incomeTopLength = {{ incomeTopLength }};
var expenseTopLength = {{ expenseTopLength }}; var expenseTopLength = {{ expenseTopLength }};