mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-10-12 23:45:10 +00:00
First attempts at building a multi-year report.
This commit is contained in:
@@ -151,6 +151,24 @@ class ReportController extends Controller
|
||||
);
|
||||
}
|
||||
|
||||
public function defaultMultiYear($report_type, $start, $end, $accounts)
|
||||
{
|
||||
|
||||
// list of users stuff:
|
||||
$budgets = app('FireflyIII\Repositories\Budget\BudgetRepositoryInterface')->getActiveBudgets();
|
||||
$categories = app('FireflyIII\Repositories\Category\CategoryRepositoryInterface')->getCategories();
|
||||
|
||||
// and some id's, joined:
|
||||
$accountIds = [];
|
||||
/** @var Account $account */
|
||||
foreach ($accounts as $account) {
|
||||
$accountIds[] = $account->id;
|
||||
}
|
||||
$accountIds = join(';', $accountIds);
|
||||
|
||||
return view('reports.default.multi-year', compact('budgets', 'accounts', 'categories','start','end','accountIds','report_type'));
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $report_type
|
||||
* @param Carbon $start
|
||||
@@ -172,7 +190,7 @@ class ReportController extends Controller
|
||||
// more than one year date difference means year report.
|
||||
if ($start->diffInMonths($end) > 12) {
|
||||
return view('error')->with('message', 'No report yet for this time period.');
|
||||
// return $this->defaultMultiYear($report_type, $start, $end, $accounts);
|
||||
return $this->defaultMultiYear($report_type, $start, $end, $accounts);
|
||||
}
|
||||
// more than two months date difference means year report.
|
||||
if ($start->diffInMonths($end) > 1) {
|
||||
|
98
resources/twig/reports/default/multi-year.twig
Normal file
98
resources/twig/reports/default/multi-year.twig
Normal file
@@ -0,0 +1,98 @@
|
||||
{% extends "./layout/default.twig" %}
|
||||
|
||||
{% block breadcrumbs %}
|
||||
{{ Breadcrumbs.renderIfExists(Route.getCurrentRoute.getName, start, end) }}
|
||||
{% endblock %}
|
||||
|
||||
{% block content %}
|
||||
|
||||
<div class="row">
|
||||
<div class="col-lg-12 col-md-12 col-sm-12">
|
||||
<div class="box">
|
||||
<div class="box-header with-border">
|
||||
<h3 class="box-title">{{ 'incomeVsExpenses'|_ }}</h3>
|
||||
</div>
|
||||
<div class="box-body">
|
||||
{% if Config.get('firefly.chart') == 'google' %}
|
||||
<div id="income-expenses-chart-multi-year"></div>
|
||||
{% endif %}
|
||||
{% if Config.get('firefly.chart') == 'chartjs' %}
|
||||
<canvas id="income-expenses-chart-multi-year" style="width:100%;height:400px;"></canvas>
|
||||
{% endif %}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{% for account in accounts %}
|
||||
<div class="row">
|
||||
<div class="col-lg-12 col-md-12 col-sm-12">
|
||||
<div class="box">
|
||||
<div class="box-header with-border">
|
||||
<h3 class="box-title">{{ account.name }}</h3>
|
||||
</div>
|
||||
<div class="box-body">
|
||||
Box box
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{% endfor %}
|
||||
|
||||
<div class="row">
|
||||
<div class="col-lg-12 col-md-12 col-sm-12">
|
||||
<div class="box">
|
||||
<div class="box-header with-border">
|
||||
<h3 class="box-title">Budgets</h3>
|
||||
</div>
|
||||
<div class="box-body">
|
||||
Select budget, chart.
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row">
|
||||
<div class="col-lg-12 col-md-12 col-sm-12">
|
||||
<div class="box">
|
||||
<div class="box-header with-border">
|
||||
<h3 class="box-title">Categories</h3>
|
||||
</div>
|
||||
<div class="box-body">
|
||||
Select budget, chart.
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
{% endblock %}
|
||||
{% block styles %}
|
||||
<link rel="stylesheet" href="css/bootstrap-sortable.css" type="text/css" media="all"/>
|
||||
{% endblock %}
|
||||
{% block scripts %}
|
||||
|
||||
<script type="text/javascript" src="js/bootstrap-sortable.js"></script>
|
||||
|
||||
<!-- load the libraries and scripts necessary for Google Charts: -->
|
||||
{% if Config.get('firefly.chart') == 'google' %}
|
||||
<script type="text/javascript" src="https://www.google.com/jsapi"></script>
|
||||
<script type="text/javascript" src="js/gcharts.js"></script>
|
||||
{% endif %}
|
||||
{% if Config.get('firefly.chart') == 'chartjs' %}
|
||||
<script type="text/javascript" src="js/Chart.min.js"></script>
|
||||
<script type="text/javascript" src="js/charts.js"></script>
|
||||
{% endif %}
|
||||
|
||||
<script type="text/javascript">
|
||||
var year = {{ start.year }};
|
||||
var month = {{ start.month }};
|
||||
|
||||
// to report another URL:
|
||||
var startDate = '{{ start.format('Ymd') }}';
|
||||
var endDate = '{{ end.format('Ymd') }}';
|
||||
var reportType = '{{ report_type }}';
|
||||
var accountIds = '{{ accountIds }}';
|
||||
</script>
|
||||
<script type="text/javascript" src="js/reports.js"></script>
|
||||
{% endblock %}
|
Reference in New Issue
Block a user