Some overhauls.

This commit is contained in:
James Cole
2015-05-16 13:53:08 +02:00
parent bdff275672
commit e7285c6499
11 changed files with 273 additions and 377 deletions

View File

@@ -0,0 +1,14 @@
<?php
/**
* Created by PhpStorm.
* User: sander
* Date: 16/05/15
* Time: 13:09
*/
namespace FireflyIII\Helpers\Collection;
class Budget {
}

View File

@@ -0,0 +1,14 @@
<?php
/**
* Created by PhpStorm.
* User: sander
* Date: 16/05/15
* Time: 13:09
*/
namespace FireflyIII\Helpers\Collection;
class Category {
}

View File

@@ -4,6 +4,8 @@ namespace FireflyIII\Helpers\Report;
use Carbon\Carbon; use Carbon\Carbon;
use FireflyIII\Helpers\Collection\Account as AccountCollection; use FireflyIII\Helpers\Collection\Account as AccountCollection;
use FireflyIII\Helpers\Collection\Budget as BudgetCollection;
use FireflyIII\Helpers\Collection\Category as CategoryCollection;
use FireflyIII\Helpers\Collection\Expense; use FireflyIII\Helpers\Collection\Expense;
use FireflyIII\Helpers\Collection\Income; use FireflyIII\Helpers\Collection\Income;
use FireflyIII\Models\Account; use FireflyIII\Models\Account;
@@ -64,6 +66,30 @@ class ReportHelper implements ReportHelperInterface
return $object; return $object;
} }
/**
* @param Carbon $start
* @param Carbon $end
* @param boolean $shared
*
* @return BudgetCollection
*/
public function getBudgetReport(Carbon $start, Carbon $end, $shared)
{
return null;
}
/**
* @param Carbon $start
* @param Carbon $end
* @param boolean $shared
*
* @return CategoryCollection
*/
public function getCategoryReport(Carbon $start, Carbon $end, $shared)
{
return null;
}
/** /**
* Get a full report on the users expenses during the period. * Get a full report on the users expenses during the period.
* *

View File

@@ -6,6 +6,8 @@ use Carbon\Carbon;
use FireflyIII\Helpers\Collection\Account; use FireflyIII\Helpers\Collection\Account;
use FireflyIII\Helpers\Collection\Expense; use FireflyIII\Helpers\Collection\Expense;
use FireflyIII\Helpers\Collection\Income; use FireflyIII\Helpers\Collection\Income;
use FireflyIII\Helpers\Collection\Budget as BudgetCollection;
use FireflyIII\Helpers\Collection\Category as CategoryCollection;
/** /**
* Interface ReportHelperInterface * Interface ReportHelperInterface
@@ -27,6 +29,24 @@ interface ReportHelperInterface
*/ */
public function getAccountReport(Carbon $date, Carbon $end, $shared); public function getAccountReport(Carbon $date, Carbon $end, $shared);
/**
* @param Carbon $start
* @param Carbon $end
* @param boolean $shared
*
* @return BudgetCollection
*/
public function getBudgetReport(Carbon $start, Carbon $end, $shared);
/**
* @param Carbon $start
* @param Carbon $end
* @param boolean $shared
*
* @return CategoryCollection
*/
public function getCategoryReport(Carbon $start, Carbon $end, $shared);
/** /**
* Get a full report on the users expenses during the period. * Get a full report on the users expenses during the period.
* *

View File

@@ -1,6 +1,5 @@
<?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;
@@ -10,7 +9,6 @@ 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 View; use View;
@@ -148,8 +146,6 @@ class ReportController extends Controller
$subTitle = trans('firefly.reportForMonth', ['date' => $start->formatLocalized($this->monthFormat)]); $subTitle = trans('firefly.reportForMonth', ['date' => $start->formatLocalized($this->monthFormat)]);
$subTitleIcon = 'fa-calendar'; $subTitleIcon = 'fa-calendar';
$end = clone $start; $end = clone $start;
$totalExpense = 0;
$totalIncome = 0;
$incomeTopLength = 8; $incomeTopLength = 8;
$expenseTopLength = 8; $expenseTopLength = 8;
if ($shared == 'shared') { if ($shared == 'shared') {
@@ -159,152 +155,87 @@ class ReportController extends Controller
$end->endOfMonth(); $end->endOfMonth();
// all accounts: $accounts = $this->helper->getAccountReport($start, $end, $shared);
$accounts = $this->helper->getAccountReport($start, $end, $shared); $incomes = $this->helper->getIncomeReport($start, $end, $shared);
$expenses = $this->helper->getExpenseReport($start, $end, $shared);
$budgets = $this->helper->getBudgetReport($start, $end, $shared);
$categories = $this->helper->getCategoryReport($start, $end, $shared);
/** // /**
* ALL INCOMES. // * DO BUDGETS.
* Grouped, sorted and summarized. // */
*/ // /** @var \FireflyIII\Repositories\Budget\BudgetRepositoryInterface $repository */
$set = $this->query->incomeInPeriod($start, $end, $shared); // $repository = App::make('FireflyIII\Repositories\Budget\BudgetRepositoryInterface');
// group, sort and sum: // $set = $repository->getBudgets();
$incomes = []; // $budgets = new Collection;
foreach ($set as $entry) { // $budgetSums = ['budgeted' => 0, 'spent' => 0, 'left' => 0, 'overspent' => 0];
$id = $entry->account_id; // /** @var Budget $budget */
$totalIncome += floatval($entry->queryAmount); // foreach ($set as $budget) {
if (isset($incomes[$id])) { // $repetitions = $repository->getBudgetLimitRepetitions($budget, $start, $end);
$incomes[$id]['amount'] += floatval($entry->queryAmount); // if ($repetitions->count() == 0) {
$incomes[$id]['count']++; // $exp = $repository->spentInPeriod($budget, $start, $end, $shared);
} else { // $budgets->push([$budget, null, 0, 0, $exp]);
$incomes[$id] = [ // $budgetSums['overspent'] += $exp;
'amount' => floatval($entry->queryAmount), // continue;
'name' => $entry->name, // }
'count' => 1, // /** @var LimitRepetition $repetition */
'id' => $id, // 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;
// sort with callback: // $overspent = $exp > floatval($repetition->amount) ? $exp - floatval($repetition->amount) : 0;
uasort( //
$incomes, function ($a, $b) { // $budgetSums['budgeted'] += floatval($repetition->amount);
if ($a['amount'] == $b['amount']) { // $budgetSums['spent'] += $spent;
return 0; // $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);
return ($a['amount'] < $b['amount']) ? 1 : -1; // /**
} // * GET CATEGORIES:
); // */
unset($set, $id); // /** @var \FireflyIII\Repositories\Category\CategoryRepositoryInterface $repository */
// $repository = App::make('FireflyIII\Repositories\Category\CategoryRepositoryInterface');
/** // $set = $repository->getCategories();
* GET ALL EXPENSES // $categories = [];
* Summarized. // $categorySum = 0;
*/ // foreach ($set as $category) {
$set = $this->query->expenseInPeriod($start, $end, $shared); // $spent = $repository->spentInPeriod($category, $start, $end, $shared);
// group, sort and sum: // $categories[] = [$category, $spent];
$expenses = []; // $categorySum += $spent;
foreach ($set as $entry) { // }
$id = $entry->account_id; // // no category:
$totalExpense += floatval($entry->queryAmount); //
if (isset($expenses[$id])) { // // sort with callback:
$expenses[$id]['amount'] += floatval($entry->queryAmount); // uasort(
$expenses[$id]['count']++; // $categories, function ($a, $b) {
} else { // if ($a[1] == $b[1]) {
$expenses[$id] = [ // return 0;
'amount' => floatval($entry->queryAmount), // }
'name' => $entry->name, //
'count' => 1, // return ($a[1] < $b[1]) ? 1 : -1;
'id' => $id, // }
]; // );
} // unset($set, $repository, $spent);
}
// sort with callback:
uasort(
$expenses, function ($a, $b) {
if ($a['amount'] == $b['amount']) {
return 0;
}
return ($a['amount'] < $b['amount']) ? -1 : 1;
}
);
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( return view(
'reports.month', 'reports.month',
compact( compact(
'start', 'shared', 'start', 'shared',
'subTitle', 'subTitleIcon', 'subTitle', 'subTitleIcon',
'accounts', 'accountsSums', 'accounts',
'incomes', 'totalIncome', 'incomeTopLength', 'incomes', 'incomeTopLength',
'expenses', 'totalExpense', 'expenseTopLength', 'expenses', 'expenseTopLength',
'budgets', 'budgetSums', 'budgets',
'categories', 'categorySum' 'categories'
) )
); );

View File

@@ -0,0 +1,30 @@
<div class="panel panel-default">
<div class="panel-heading">
<i class="fa fa-credit-card fa-fw"></i>
{{ 'accountBalances'|_ }}
</div>
<table class="table table-bordered table-striped">
<tr>
<th>{{ 'name'|_ }}</th>
<th>{{ 'balanceStartOfYear'|_ }}</th>
<th>{{ 'balanceStartOfYear'|_ }}</th>
<th>{{ 'difference'|_ }}</th>
</tr>
{% for account in accounts.getAccounts %}
<tr>
<td>
<a href="{{ route('accounts.show',account.id) }}" title="{{ account.name }}">{{ account.name }}</a>
</td>
<td>{{ account.startBalance|formatAmount }}</td>
<td>{{ account.endBalance|formatAmount }}</td>
<td>{{ (account.endBalance - account.startBalance)|formatAmount }}</td>
</tr>
{% endfor %}
<tr>
<td><em>Sum of sums</em></td>
<td>{{ accounts.getStart|formatAmount }}</td>
<td>{{ accounts.getEnd|formatAmount }}</td>
<td>{{ accounts.getDifference|formatAmount }}</td>
</tr>
</table>
</div>

View File

@@ -0,0 +1,34 @@
<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">
{% for expense in expenses.getExpenses %}
{% if loop.index > expenseTopLength %}
<tr class="collapse out expenseCollapsed">
{% else %}
<tr>
{% endif %}
<td>
<a href="{{ route('accounts.show',expense.id) }}">{{ expense.name }}</a>
{% if expense.count > 1 %}
<br /><small>{{ expense.count }} {{ 'transactions'|_|lower }}</small>
{% endif %}
</td>
<td><span class="text-danger">{{ (expense.amount*-1)|formatAmountPlain }}</span></td>
</tr>
{% endfor %}
{% if expenses.getExpenses|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">{{ (expenses.getTotal * -1)|formatAmountPlain }}</span></td>
</tr>
</table>
</div>

View File

@@ -0,0 +1,20 @@
<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>{{ incomes.getTotal|formatAmount }}</td>
</tr>
<tr>
<td>{{ 'out'|_ }}</td>
<td><span class="text-danger">{{ expenses.getTotal|formatAmountPlain }}</span></td>
</tr>
<tr>
<td>{{ 'difference'|_ }}</td>
<td>{{ (incomes.getTotal - expenses.getTotal)|formatAmount }}</td>
</tr>
</table>
</div>

View File

@@ -0,0 +1,34 @@
<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 income in incomes.getIncomes %}
{% if loop.index > incomeTopLength %}
<tr class="collapse out incomesCollapsed">
{% else %}
<tr>
{% endif %}
<td>
<a href="{{ route('accounts.show',income.id) }}" title="{{ income.name }}">{{ income.name }}</a>
{% if income.count > 1 %}
<br /><small>{{ income.count }} {{ 'transactions'|_|lower }}</small>
{% endif %}
</td>
<td>{{ income.amount|formatAmount }}</td>
</tr>
{% endfor %}
{% if incomes.getIncomes|length > incomeTopLength %}
<tr>
<td colspan="2" class="active">
<a href="#" id="showIncomes">{{ trans('firefly.showTheRest',{number:incomeTopLength}) }}</a>
</td>
</tr>
{% endif %}
<tr>
<td><em>{{ 'sum'|_ }}</em></td>
<td>{{ incomes.getTotal|formatAmount }}</td>
</tr>
</table>
</div>

View File

@@ -18,129 +18,16 @@
<div class="row"> <div class="row">
<div class="col-lg-6 col-md-6 col-sm-6"> <div class="col-lg-6 col-md-6 col-sm-6">
<div class="panel panel-default"> {% include 'partials/reports/accounts.twig' %}
<div class="panel-heading"> {% include 'partials/reports/income-vs-expenses.twig' %}
<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>
<td><a href="{{route('accounts.show',account.id)}}">{{ account.name }}</a></td>
<td>{{ account.startBalance|formatAmount }}</td>
<td>{{ account.endBalance|formatAmount }}</td>
<td>
{{ (account.startBalance - account.endBalance)|formatAmount }}
</td>
</tr>
{% endfor %}
</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>
<div class="col-lg-3 col-md-3 col-sm-3"> <div class="col-lg-3 col-md-3 col-sm-3">
<!-- income --> <!-- income -->
<div class="panel panel-default"> {% include 'partials/reports/income.twig' %}
<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>
<td colspan="2" class="active">
<a href="#" id="showIncomes">{{ trans('firefly.showTheRest',{number:incomeTopLength}) }}</a>
</td>
</tr>
{% endif %}
<tr>
<td><em>{{ 'sum'|_ }}</em></td>
<td>{{ totalIncome|formatAmount }}</td>
</tr>
</table>
</div>
</div> </div>
<div class="col-lg-3 col-md-3 col-sm-3"> <div class="col-lg-3 col-md-3 col-sm-3">
<!-- expenses --> <!-- expenses -->
<div class="panel panel-default"> {% include 'partials/reports/expenses.twig' %}
<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> </div>
<div class="row"> <div class="row">

View File

@@ -29,129 +29,15 @@
<div class="row"> <div class="row">
<div class="col-lg-6 col-md-6 col-sm-6"> <div class="col-lg-6 col-md-6 col-sm-6">
<div class="panel panel-default"> {% include 'partials/reports/accounts.twig' %}
<div class="panel-heading"> {% include 'partials/reports/income-vs-expenses.twig' %}
<i class="fa fa-credit-card fa-fw"></i>
{{ 'accountBalances'|_ }}
</div>
<table class="table table-bordered table-striped">
<tr>
<th>{{ 'name'|_ }}</th>
<th>{{ 'balanceStartOfYear'|_ }}</th>
<th>{{ 'balanceStartOfYear'|_ }}</th>
<th>{{ 'difference'|_ }}</th>
</tr>
{% for account in accounts.getAccounts %}
<tr>
<td>
<a href="{{ route('accounts.show',account.id) }}" title="{{ account.name }}">{{ account.name }}</a>
</td>
<td>{{ account.startBalance|formatAmount }}</td>
<td>{{ account.endBalance|formatAmount }}</td>
<td>{{ (account.endBalance - account.startBalance)|formatAmount }}</td>
</tr>
{% endfor %}
<tr>
<td><em>Sum of sums</em></td>
<td>{{ accounts.getStart|formatAmount }}</td>
<td>{{ accounts.getEnd|formatAmount }}</td>
<td>{{ accounts.getDifference|formatAmount }}</td>
</tr>
</table>
</div>
<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|formatAmountPlain }}</span></td>
</tr>
<tr>
<td>{{ 'difference'|_ }}</td>
<td>{{ (totalIncome - totalExpense)|formatAmount }}</td>
</tr>
</table>
</div>
</div> </div>
<div class="col-lg-3 col-md-3 col-sm-3"> <div class="col-lg-3 col-md-3 col-sm-3">
<div class="panel panel-default"> {% include 'partials/reports/income.twig' %}
<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 income in incomes.getIncomes %}
{% if loop.index > incomeTopLength %}
<tr class="collapse out incomesCollapsed">
{% else %}
<tr>
{% endif %}
<td>
<a href="{{ route('accounts.show',income.id) }}" title="{{ income.name }}">{{ income.name }}</a>
{% if income.count > 1 %}
<br /><small>{{ income.count }} {{ 'transactions'|_|lower }}</small>
{% endif %}
</td>
<td>{{ income.amount|formatAmount }}</td>
</tr>
{% endfor %}
{% if incomes.getIncomes|length > incomeTopLength %}
<tr>
<td colspan="2" class="active">
<a href="#" id="showIncomes">{{ trans('firefly.showTheRest',{number:incomeTopLength}) }}</a>
</td>
</tr>
{% endif %}
<tr>
<td><em>{{ 'sum'|_ }}</em></td>
<td>{{ incomes.getTotal|formatAmount }}</td>
</tr>
</table>
</div>
</div> </div>
<div class="col-lg-3 col-md-3 col-sm-3"> <div class="col-lg-3 col-md-3 col-sm-3">
<div class="panel panel-default"> {% include 'partials/reports/expenses.twig' %}
<div class="panel-heading">
<i class="fa fa-long-arrow-left fa-fw"></i>
{{ 'expenses'|_ }} ({{ trans('firefly.topX',{number: expenseTopLength}) }})
</div>
<table class="table">
{% for expense in expenses.getExpenses %}
{% if loop.index > expenseTopLength %}
<tr class="collapse out expenseCollapsed">
{% else %}
<tr>
{% endif %}
<td>
<a href="{{ route('accounts.show',expense.id) }}">{{ expense.name }}</a>
{% if expense.count > 1 %}
<br /><small>{{ expense.count }} {{ 'transactions'|_|lower }}</small>
{% endif %}
</td>
<td><span class="text-danger">{{ (expense.amount*-1)|formatAmountPlain }}</span></td>
</tr>
{% endfor %}
{% if expenses.getExpenses|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">{{ (expenses.getTotal * -1)|formatAmountPlain }}</span></td>
</tr>
</table>
</div>
</div> </div>
</div> </div>
<div class="row"> <div class="row">