mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-02-25 18:45:27 -06:00
Ajax some report parts.
This commit is contained in:
parent
73f87e30c2
commit
7821c52842
91
app/Http/Controllers/Report/BudgetController.php
Normal file
91
app/Http/Controllers/Report/BudgetController.php
Normal file
@ -0,0 +1,91 @@
|
|||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* BudgetController.php
|
||||||
|
* Copyright (C) 2016 thegrumpydictator@gmail.com
|
||||||
|
*
|
||||||
|
* This software may be modified and distributed under the terms of the
|
||||||
|
* Creative Commons Attribution-ShareAlike 4.0 International License.
|
||||||
|
*
|
||||||
|
* See the LICENSE file for details.
|
||||||
|
*/
|
||||||
|
|
||||||
|
declare(strict_types = 1);
|
||||||
|
|
||||||
|
namespace FireflyIII\Http\Controllers\Report;
|
||||||
|
|
||||||
|
|
||||||
|
use Carbon\Carbon;
|
||||||
|
use FireflyIII\Helpers\Report\BudgetReportHelperInterface;
|
||||||
|
use FireflyIII\Http\Controllers\Controller;
|
||||||
|
use FireflyIII\Support\CacheProperties;
|
||||||
|
use Illuminate\Support\Collection;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Class BudgetController
|
||||||
|
*
|
||||||
|
* @package FireflyIII\Http\Controllers\Report
|
||||||
|
*/
|
||||||
|
class BudgetController extends Controller
|
||||||
|
{
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param BudgetReportHelperInterface $helper
|
||||||
|
* @param Carbon $start
|
||||||
|
* @param Carbon $end
|
||||||
|
* @param Collection $accounts
|
||||||
|
*
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
|
public function budgetReport(BudgetReportHelperInterface $helper, Carbon $start, Carbon $end, Collection $accounts)
|
||||||
|
{
|
||||||
|
|
||||||
|
// chart properties for cache:
|
||||||
|
$cache = new CacheProperties;
|
||||||
|
$cache->addProperty($start);
|
||||||
|
$cache->addProperty($end);
|
||||||
|
$cache->addProperty('budget-report');
|
||||||
|
$cache->addProperty($accounts->pluck('id')->toArray());
|
||||||
|
if ($cache->has()) {
|
||||||
|
return $cache->get();
|
||||||
|
}
|
||||||
|
|
||||||
|
$budgets = $helper->getBudgetReport($start, $end, $accounts);
|
||||||
|
|
||||||
|
$result = view('reports.partials.budgets', compact('budgets'))->render();
|
||||||
|
$cache->store($result);
|
||||||
|
|
||||||
|
return $result;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param BudgetReportHelperInterface $helper
|
||||||
|
* @param Carbon $start
|
||||||
|
* @param Carbon $end
|
||||||
|
* @param Collection $accounts
|
||||||
|
*
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
|
public function budgetYearOverview(BudgetReportHelperInterface $helper, Carbon $start, Carbon $end, Collection $accounts)
|
||||||
|
{
|
||||||
|
|
||||||
|
// chart properties for cache:
|
||||||
|
$cache = new CacheProperties;
|
||||||
|
$cache->addProperty($start);
|
||||||
|
$cache->addProperty($end);
|
||||||
|
$cache->addProperty('budget-year-overview');
|
||||||
|
$cache->addProperty($accounts->pluck('id')->toArray());
|
||||||
|
if ($cache->has()) {
|
||||||
|
return $cache->get();
|
||||||
|
}
|
||||||
|
|
||||||
|
$budgets = $helper->budgetYearOverview($start, $end, $accounts);
|
||||||
|
|
||||||
|
$result = view('reports.partials.budget-year-overview', compact('budgets'))->render();
|
||||||
|
$cache->store($result);
|
||||||
|
|
||||||
|
return $result;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -15,7 +15,6 @@ namespace FireflyIII\Http\Controllers;
|
|||||||
|
|
||||||
use Carbon\Carbon;
|
use Carbon\Carbon;
|
||||||
use FireflyIII\Exceptions\FireflyException;
|
use FireflyIII\Exceptions\FireflyException;
|
||||||
use FireflyIII\Helpers\Report\BudgetReportHelperInterface;
|
|
||||||
use FireflyIII\Helpers\Report\ReportHelperInterface;
|
use FireflyIII\Helpers\Report\ReportHelperInterface;
|
||||||
use FireflyIII\Models\Account;
|
use FireflyIII\Models\Account;
|
||||||
use FireflyIII\Models\AccountType;
|
use FireflyIII\Models\AccountType;
|
||||||
@ -37,8 +36,6 @@ use View;
|
|||||||
*/
|
*/
|
||||||
class ReportController extends Controller
|
class ReportController extends Controller
|
||||||
{
|
{
|
||||||
/** @var BudgetReportHelperInterface */
|
|
||||||
protected $budgetHelper;
|
|
||||||
/** @var ReportHelperInterface */
|
/** @var ReportHelperInterface */
|
||||||
protected $helper;
|
protected $helper;
|
||||||
|
|
||||||
@ -55,8 +52,7 @@ class ReportController extends Controller
|
|||||||
View::share('title', trans('firefly.reports'));
|
View::share('title', trans('firefly.reports'));
|
||||||
View::share('mainTitleIcon', 'fa-line-chart');
|
View::share('mainTitleIcon', 'fa-line-chart');
|
||||||
|
|
||||||
$this->helper = app(ReportHelperInterface::class);
|
$this->helper = app(ReportHelperInterface::class);
|
||||||
$this->budgetHelper = app(BudgetReportHelperInterface::class);
|
|
||||||
|
|
||||||
return $next($request);
|
return $next($request);
|
||||||
}
|
}
|
||||||
@ -219,10 +215,8 @@ class ReportController extends Controller
|
|||||||
*/
|
*/
|
||||||
private function defaultMonth(string $reportType, Carbon $start, Carbon $end, Collection $accounts)
|
private function defaultMonth(string $reportType, Carbon $start, Carbon $end, Collection $accounts)
|
||||||
{
|
{
|
||||||
// get report stuff!
|
$bills = $this->helper->getBillReport($start, $end, $accounts);
|
||||||
$budgets = $this->budgetHelper->getBudgetReport($start, $end, $accounts);
|
$tags = $this->helper->tagReport($start, $end, $accounts);
|
||||||
$bills = $this->helper->getBillReport($start, $end, $accounts);
|
|
||||||
$tags = $this->helper->tagReport($start, $end, $accounts);
|
|
||||||
|
|
||||||
// and some id's, joined:
|
// and some id's, joined:
|
||||||
$accountIds = join(',', $accounts->pluck('id')->toArray());
|
$accountIds = join(',', $accounts->pluck('id')->toArray());
|
||||||
@ -233,9 +227,9 @@ class ReportController extends Controller
|
|||||||
compact(
|
compact(
|
||||||
'start', 'end',
|
'start', 'end',
|
||||||
'tags',
|
'tags',
|
||||||
'budgets',
|
|
||||||
'bills',
|
'bills',
|
||||||
'accountIds', 'reportType'
|
'accountIds',
|
||||||
|
'reportType'
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@ -281,8 +275,7 @@ class ReportController extends Controller
|
|||||||
*/
|
*/
|
||||||
private function defaultYear(string $reportType, Carbon $start, Carbon $end, Collection $accounts)
|
private function defaultYear(string $reportType, Carbon $start, Carbon $end, Collection $accounts)
|
||||||
{
|
{
|
||||||
$tags = $this->helper->tagReport($start, $end, $accounts);
|
$tags = $this->helper->tagReport($start, $end, $accounts);
|
||||||
$budgets = $this->budgetHelper->budgetYearOverview($start, $end, $accounts);
|
|
||||||
|
|
||||||
Session::flash('gaEventCategory', 'report');
|
Session::flash('gaEventCategory', 'report');
|
||||||
Session::flash('gaEventAction', 'year');
|
Session::flash('gaEventAction', 'year');
|
||||||
@ -299,7 +292,8 @@ class ReportController extends Controller
|
|||||||
return view(
|
return view(
|
||||||
'reports.default.year',
|
'reports.default.year',
|
||||||
compact(
|
compact(
|
||||||
'start', 'reportType', 'accountIds', 'end', 'tags', 'budgets'
|
'start', 'reportType',
|
||||||
|
'accountIds', 'end', 'tags'
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
@ -323,6 +323,7 @@ class CsvSetup implements SetupInterface
|
|||||||
|
|
||||||
foreach ($config['column-do-mapping'] as $index => $mustBeMapped) {
|
foreach ($config['column-do-mapping'] as $index => $mustBeMapped) {
|
||||||
if ($mustBeMapped) {
|
if ($mustBeMapped) {
|
||||||
|
|
||||||
$column = $config['column-roles'][$index] ?? '_ignore';
|
$column = $config['column-roles'][$index] ?? '_ignore';
|
||||||
|
|
||||||
// is valid column?
|
// is valid column?
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
/* globals google, startDate ,reportURL, endDate , reportType ,accountIds, lineChart, categoryReportUrl, balanceReportUrl */
|
/* globals google, budgetReportUrl, startDate ,reportURL, endDate , reportType ,accountIds, lineChart, categoryReportUrl, balanceReportUrl */
|
||||||
|
|
||||||
|
|
||||||
$(function () {
|
$(function () {
|
||||||
@ -7,6 +7,7 @@ $(function () {
|
|||||||
|
|
||||||
loadCategoryReport();
|
loadCategoryReport();
|
||||||
loadBalanceReport();
|
loadBalanceReport();
|
||||||
|
loadBudgetReport();
|
||||||
});
|
});
|
||||||
|
|
||||||
function loadCategoryReport() {
|
function loadCategoryReport() {
|
||||||
@ -15,12 +16,26 @@ function loadCategoryReport() {
|
|||||||
$.get(categoryReportUrl).done(placeCategoryReport).fail(failCategoryReport);
|
$.get(categoryReportUrl).done(placeCategoryReport).fail(failCategoryReport);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function loadBudgetReport() {
|
||||||
|
"use strict";
|
||||||
|
console.log('Going to grab ' + budgetReportUrl);
|
||||||
|
$.get(budgetReportUrl).done(placeBudgetReport).fail(failBudgetReport);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
function loadBalanceReport() {
|
function loadBalanceReport() {
|
||||||
"use strict";
|
"use strict";
|
||||||
console.log('Going to grab ' + categoryReportUrl);
|
console.log('Going to grab ' + categoryReportUrl);
|
||||||
$.get(balanceReportUrl).done(placeBalanceReport).fail(failBalanceReport);
|
$.get(balanceReportUrl).done(placeBalanceReport).fail(failBalanceReport);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function placeBudgetReport(data) {
|
||||||
|
"use strict";
|
||||||
|
$('#budgetReport').removeClass('loading').html(data);
|
||||||
|
listLengthInitial();
|
||||||
|
triggerInfoClick();
|
||||||
|
}
|
||||||
|
|
||||||
function placeBalanceReport(data) {
|
function placeBalanceReport(data) {
|
||||||
"use strict";
|
"use strict";
|
||||||
$('#balanceReport').removeClass('loading').html(data);
|
$('#balanceReport').removeClass('loading').html(data);
|
||||||
@ -35,6 +50,12 @@ function placeCategoryReport(data) {
|
|||||||
triggerInfoClick();
|
triggerInfoClick();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function failBudgetReport() {
|
||||||
|
"use strict";
|
||||||
|
console.log('Fail budget report data!');
|
||||||
|
$('#budgetReport').removeClass('loading').addClass('general-chart-error');
|
||||||
|
}
|
||||||
|
|
||||||
function failBalanceReport() {
|
function failBalanceReport() {
|
||||||
"use strict";
|
"use strict";
|
||||||
console.log('Fail balance report data!');
|
console.log('Fail balance report data!');
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
/* globals google, startDate ,reportURL, endDate , reportType ,accountIds , picker:true, minDate, year, month, columnChart, lineChart, stackedColumnChart */
|
/* globals google, accountIds, budgetYearOverviewUrl */
|
||||||
|
|
||||||
var chartDrawn;
|
var chartDrawn;
|
||||||
var budgetChart;
|
var budgetChart;
|
||||||
@ -7,8 +7,29 @@ $(function () {
|
|||||||
chartDrawn = false;
|
chartDrawn = false;
|
||||||
drawChart();
|
drawChart();
|
||||||
|
|
||||||
|
//
|
||||||
|
loadBudgetOverview();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
function loadBudgetOverview() {
|
||||||
|
"use strict";
|
||||||
|
console.log('Going to grab ' + budgetYearOverviewUrl);
|
||||||
|
$.get(budgetYearOverviewUrl).done(placeBudgetOverview).fail(failBudgetOverview);
|
||||||
|
}
|
||||||
|
|
||||||
|
function placeBudgetOverview(data) {
|
||||||
|
"use strict";
|
||||||
|
$('#budgetOverview').removeClass('loading').html(data);
|
||||||
|
$('.budget-chart-activate').on('click', clickBudgetChart);
|
||||||
|
}
|
||||||
|
|
||||||
|
function failBudgetOverview() {
|
||||||
|
"use strict";
|
||||||
|
console.log('Fail budget overview data!');
|
||||||
|
$('#budgetOverview').removeClass('loading').addClass('general-chart-error');
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
function drawChart() {
|
function drawChart() {
|
||||||
"use strict";
|
"use strict";
|
||||||
@ -17,7 +38,7 @@ function drawChart() {
|
|||||||
columnChart('chart/report/in-out/' + reportType + '/' + startDate + '/' + endDate + '/' + accountIds, 'income-expenses-chart');
|
columnChart('chart/report/in-out/' + reportType + '/' + startDate + '/' + endDate + '/' + accountIds, 'income-expenses-chart');
|
||||||
columnChart('chart/report/in-out-sum/' + reportType + '/' + startDate + '/' + endDate + '/' + accountIds, 'income-expenses-sum-chart');
|
columnChart('chart/report/in-out-sum/' + reportType + '/' + startDate + '/' + endDate + '/' + accountIds, 'income-expenses-sum-chart');
|
||||||
|
|
||||||
$('.budget-chart-activate').on('click', clickBudgetChart);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function clickBudgetChart(e) {
|
function clickBudgetChart(e) {
|
||||||
|
@ -67,8 +67,17 @@
|
|||||||
</div>
|
</div>
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col-lg-8 col-md-8 col-sm-12">
|
<div class="col-lg-8 col-md-8 col-sm-12">
|
||||||
<!-- budgets -->
|
<div class="box">
|
||||||
{% include 'reports/partials/budgets.twig' %}
|
|
||||||
|
<div class="box-header with-border">
|
||||||
|
<h3 class="box-title">{{ 'budgets'|_ }}</h3>
|
||||||
|
</div>
|
||||||
|
<div class="box-body table-responsive no-padding loading" id="budgetReport">
|
||||||
|
</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="box">
|
<div class="box">
|
||||||
@ -127,6 +136,7 @@
|
|||||||
var inOutReportUrl = '{{ route('reports.data.inOutReport', [start.format('Ymd'), end.format('Ymd'), accountIds]) }}';
|
var inOutReportUrl = '{{ route('reports.data.inOutReport', [start.format('Ymd'), end.format('Ymd'), accountIds]) }}';
|
||||||
var categoryReportUrl = '{{ route('reports.data.categoryReport', [start.format('Ymd'), end.format('Ymd'), accountIds]) }}';
|
var categoryReportUrl = '{{ route('reports.data.categoryReport', [start.format('Ymd'), end.format('Ymd'), accountIds]) }}';
|
||||||
var balanceReportUrl = '{{ route('reports.data.balanceReport', [start.format('Ymd'), end.format('Ymd'), accountIds]) }}';
|
var balanceReportUrl = '{{ route('reports.data.balanceReport', [start.format('Ymd'), end.format('Ymd'), accountIds]) }}';
|
||||||
|
var budgetReportUrl = '{{ route('reports.data.budgetReport', [start.format('Ymd'), end.format('Ymd'), accountIds]) }}';
|
||||||
</script>
|
</script>
|
||||||
<script type="text/javascript" src="js/ff/reports/default/all.js"></script>
|
<script type="text/javascript" src="js/ff/reports/default/all.js"></script>
|
||||||
<script type="text/javascript" src="js/ff/reports/default/month.js"></script>
|
<script type="text/javascript" src="js/ff/reports/default/month.js"></script>
|
||||||
|
@ -90,32 +90,7 @@
|
|||||||
<div class="box-header with-border">
|
<div class="box-header with-border">
|
||||||
<h3 class="box-title">{{ 'budgets'|_ }}</h3>
|
<h3 class="box-title">{{ 'budgets'|_ }}</h3>
|
||||||
</div>
|
</div>
|
||||||
<div class="box-body">
|
<div class="box-body no-padding table-responsive loading" id="budgetOverview">
|
||||||
<table class="table table-condensed table-hover">
|
|
||||||
<thead>
|
|
||||||
<tr>
|
|
||||||
<th> </th>
|
|
||||||
{% for date, header in budgets.get('headers') %}
|
|
||||||
<th>{{ header }}</th>
|
|
||||||
{% endfor %}
|
|
||||||
</tr>
|
|
||||||
</thead>
|
|
||||||
<tbody>
|
|
||||||
{% set spentData = budgets.get('spent') %}
|
|
||||||
{% for budgetId, budgetName in budgets.get('budgets') %}
|
|
||||||
<tr>
|
|
||||||
<th>
|
|
||||||
<a title="{{ budgetName }}" href="#" data-budget="{{ budgetId }}" class="budget-chart-activate">{{ budgetName }}</a>
|
|
||||||
</th>
|
|
||||||
{% for date, header in budgets.get('headers') %}
|
|
||||||
<td>{{ spentData[budgetId][date]|formatAmount }}</td>
|
|
||||||
{% endfor %}
|
|
||||||
|
|
||||||
</tr>
|
|
||||||
{% endfor %}
|
|
||||||
</tbody>
|
|
||||||
|
|
||||||
</table>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@ -150,6 +125,7 @@
|
|||||||
<!-- some URL's -->
|
<!-- some URL's -->
|
||||||
var accountReportUrl = '{{ route('reports.data.accountReport', [start.format('Ymd'), end.format('Ymd'), accountIds]) }}';
|
var accountReportUrl = '{{ route('reports.data.accountReport', [start.format('Ymd'), end.format('Ymd'), accountIds]) }}';
|
||||||
var inOutReportUrl = '{{ route('reports.data.inOutReport', [start.format('Ymd'), end.format('Ymd'), accountIds]) }}';
|
var inOutReportUrl = '{{ route('reports.data.inOutReport', [start.format('Ymd'), end.format('Ymd'), accountIds]) }}';
|
||||||
|
var budgetYearOverviewUrl = '{{ route('reports.data.budgetYearOverview', [start.format('Ymd'), end.format('Ymd'), accountIds]) }}';
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<script type="text/javascript" src="js/ff/reports/default/all.js"></script>
|
<script type="text/javascript" src="js/ff/reports/default/all.js"></script>
|
||||||
|
25
resources/views/reports/partials/budget-year-overview.twig
Normal file
25
resources/views/reports/partials/budget-year-overview.twig
Normal file
@ -0,0 +1,25 @@
|
|||||||
|
<table class="table table-condensed table-hover">
|
||||||
|
<thead>
|
||||||
|
<tr>
|
||||||
|
<th> </th>
|
||||||
|
{% for date, header in budgets.get('headers') %}
|
||||||
|
<th>{{ header }}</th>
|
||||||
|
{% endfor %}
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody>
|
||||||
|
{% set spentData = budgets.get('spent') %}
|
||||||
|
{% for budgetId, budgetName in budgets.get('budgets') %}
|
||||||
|
<tr>
|
||||||
|
<th>
|
||||||
|
<a title="{{ budgetName }}" href="#" data-budget="{{ budgetId }}" class="budget-chart-activate">{{ budgetName }}</a>
|
||||||
|
</th>
|
||||||
|
{% for date, header in budgets.get('headers') %}
|
||||||
|
<td>{{ spentData[budgetId][date]|formatAmount }}</td>
|
||||||
|
{% endfor %}
|
||||||
|
|
||||||
|
</tr>
|
||||||
|
{% endfor %}
|
||||||
|
</tbody>
|
||||||
|
|
||||||
|
</table>
|
@ -1,87 +1,79 @@
|
|||||||
<div class="box">
|
<table class="table table-hover">
|
||||||
|
<thead>
|
||||||
|
<tr>
|
||||||
|
<th>{{ 'budget'|_ }}</th>
|
||||||
|
<th>{{ 'date'|_ }}</th>
|
||||||
|
<th>{{ 'budgeted'|_ }}</th>
|
||||||
|
<th>{{ 'spent'|_ }}</th>
|
||||||
|
<th>{{ 'left'|_ }}</th>
|
||||||
|
<th>{{ 'overspent'|_ }}</th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody>
|
||||||
|
{% for budgetLine in budgets.getBudgetLines %}
|
||||||
|
<tr>
|
||||||
|
<td>
|
||||||
|
{% if budgetLine.getBudget.id %}
|
||||||
|
<a href="{{ route('budgets.show',budgetLine.getBudget.id) }}">{{ budgetLine.getBudget.name }}</a>
|
||||||
|
{% else %}
|
||||||
|
<em>{{ 'no_budget'|_ }}</em>
|
||||||
|
{% endif %}
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
{% if budgetLine.getRepetition.id %}
|
||||||
|
<a href="{{ route('budgets.showWithRepetition', [budgetLine.getBudget.id, budgetLine.getRepetition.id]) }}">
|
||||||
|
{{ budgetLine.getRepetition.startdate.formatLocalized(monthAndDayFormat) }}
|
||||||
|
—
|
||||||
|
{{ budgetLine.getRepetition.enddate.formatLocalized(monthAndDayFormat) }}
|
||||||
|
</a>
|
||||||
|
{% endif %}
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
{% if budgetLine.getRepetition.id %}
|
||||||
|
{{ budgetLine.getRepetition.amount|formatAmount }}
|
||||||
|
{% else %}
|
||||||
|
{{ 0|formatAmount }}
|
||||||
|
{% endif %}
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
{% if budgetLine.getSpent != 0 %}
|
||||||
|
{{ budgetLine.getSpent|formatAmount }} <i class="fa fa-fw text-muted fa-info-circle firefly-info-button"
|
||||||
|
data-location="budget-spent-amount" data-budget-id="{{ budgetLine.getBudget.id }}"
|
||||||
|
></i>
|
||||||
|
{% endif %}
|
||||||
|
|
||||||
<div class="box-header with-border">
|
{% if budgetLine.getSpent == 0 %}
|
||||||
<h3 class="box-title">{{ 'budgets'|_ }}</h3>
|
{{ budgetLine.getSpent|formatAmount }}
|
||||||
</div>
|
{% endif %}
|
||||||
<div class="box-body table-responsive no-padding">
|
|
||||||
<table class="table table-hover">
|
|
||||||
<thead>
|
|
||||||
<tr>
|
|
||||||
<th>{{ 'budget'|_ }}</th>
|
|
||||||
<th>{{ 'date'|_ }}</th>
|
|
||||||
<th>{{ 'budgeted'|_ }}</th>
|
|
||||||
<th>{{ 'spent'|_ }}</th>
|
|
||||||
<th>{{ 'left'|_ }}</th>
|
|
||||||
<th>{{ 'overspent'|_ }}</th>
|
|
||||||
</tr>
|
|
||||||
</thead>
|
|
||||||
<tbody>
|
|
||||||
{% for budgetLine in budgets.getBudgetLines %}
|
|
||||||
<tr>
|
|
||||||
<td>
|
|
||||||
{% if budgetLine.getBudget.id %}
|
|
||||||
<a href="{{ route('budgets.show',budgetLine.getBudget.id) }}">{{ budgetLine.getBudget.name }}</a>
|
|
||||||
{% else %}
|
|
||||||
<em>{{ 'no_budget'|_ }}</em>
|
|
||||||
{% endif %}
|
|
||||||
</td>
|
|
||||||
<td>
|
|
||||||
{% if budgetLine.getRepetition.id %}
|
|
||||||
<a href="{{ route('budgets.showWithRepetition', [budgetLine.getBudget.id, budgetLine.getRepetition.id]) }}">
|
|
||||||
{{ budgetLine.getRepetition.startdate.formatLocalized(monthAndDayFormat) }}
|
|
||||||
—
|
|
||||||
{{ budgetLine.getRepetition.enddate.formatLocalized(monthAndDayFormat) }}
|
|
||||||
</a>
|
|
||||||
{% endif %}
|
|
||||||
</td>
|
|
||||||
<td>
|
|
||||||
{% if budgetLine.getRepetition.id %}
|
|
||||||
{{ budgetLine.getRepetition.amount|formatAmount }}
|
|
||||||
{% else %}
|
|
||||||
{{ 0|formatAmount }}
|
|
||||||
{% endif %}
|
|
||||||
</td>
|
|
||||||
<td>
|
|
||||||
{% if budgetLine.getSpent != 0 %}
|
|
||||||
{{ budgetLine.getSpent|formatAmount }} <i class="fa fa-fw text-muted fa-info-circle firefly-info-button"
|
|
||||||
data-location="budget-spent-amount" data-budget-id="{{ budgetLine.getBudget.id }}"
|
|
||||||
></i>
|
|
||||||
{% endif %}
|
|
||||||
|
|
||||||
{% if budgetLine.getSpent == 0 %}
|
</td>
|
||||||
{{ budgetLine.getSpent|formatAmount }}
|
<td>
|
||||||
{% endif %}
|
{% if(budgetLine.getOverspent == 0) %}
|
||||||
|
{{ budgetLine.getLeft|formatAmount }}
|
||||||
</td>
|
{% endif %}
|
||||||
<td>
|
</td>
|
||||||
{% if(budgetLine.getOverspent == 0) %}
|
<td>
|
||||||
{{ budgetLine.getLeft|formatAmount }}
|
{% if budgetLine.getOverspent != 0 %}
|
||||||
{% endif %}
|
{{ budgetLine.getOverspent|formatAmount }}
|
||||||
</td>
|
{% endif %}
|
||||||
<td>
|
</td>
|
||||||
{% if budgetLine.getOverspent != 0 %}
|
</tr>
|
||||||
{{ budgetLine.getOverspent|formatAmount }}
|
{% endfor %}
|
||||||
{% endif %}
|
</tbody>
|
||||||
</td>
|
<tfoot>
|
||||||
</tr>
|
<tr>
|
||||||
{% endfor %}
|
<td colspan="2"><em>{{ 'sum'|_ }}</em></td>
|
||||||
</tbody>
|
<td>{{ budgets.getBudgeted|formatAmount }}</td>
|
||||||
<tfoot>
|
<td>
|
||||||
<tr>
|
{% if budgets.getSpent != 0 %}
|
||||||
<td colspan="2"><em>{{ 'sum'|_ }}</em></td>
|
<span class="text-danger">{{ budgets.getSpent|formatAmountPlain }}</span>
|
||||||
<td>{{ budgets.getBudgeted|formatAmount }}</td>
|
{% endif %}
|
||||||
<td>
|
{% if budgets.getSpent == 0 %}
|
||||||
{% if budgets.getSpent != 0 %}
|
{{ budgets.getSpent|formatAmount }}
|
||||||
<span class="text-danger">{{ budgets.getSpent|formatAmountPlain }}</span>
|
{% endif %}
|
||||||
{% endif %}
|
</td>
|
||||||
{% if budgets.getSpent == 0 %}
|
<td>{{ budgets.getLeft|formatAmount }}</td>
|
||||||
{{ budgets.getSpent|formatAmount }}
|
<td><span class="text-danger">{{ budgets.getOverspent|formatAmountPlain }}</span></td>
|
||||||
{% endif %}
|
</tr>
|
||||||
</td>
|
</tfoot>
|
||||||
<td>{{ budgets.getLeft|formatAmount }}</td>
|
</table>
|
||||||
<td><span class="text-danger">{{ budgets.getOverspent|formatAmountPlain }}</span></td>
|
|
||||||
</tr>
|
|
||||||
</tfoot>
|
|
||||||
</table>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
@ -339,6 +339,18 @@ Route::group(
|
|||||||
['uses' => 'Report\BalanceController@balanceReport', 'as' => 'reports.data.balanceReport']
|
['uses' => 'Report\BalanceController@balanceReport', 'as' => 'reports.data.balanceReport']
|
||||||
);
|
);
|
||||||
|
|
||||||
|
// budget report:
|
||||||
|
Route::get(
|
||||||
|
'/reports/data/budget-report/{start_date}/{end_date}/{accountList}',
|
||||||
|
['uses' => 'Report\BudgetController@budgetReport', 'as' => 'reports.data.budgetReport']
|
||||||
|
);
|
||||||
|
// budget year overview
|
||||||
|
Route::get(
|
||||||
|
'/reports/data/budget-year-overview/{start_date}/{end_date}/{accountList}',
|
||||||
|
['uses' => 'Report\BudgetController@budgetYearOverview', 'as' => 'reports.data.budgetYearOverview']
|
||||||
|
);
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Rules Controller
|
* Rules Controller
|
||||||
*/
|
*/
|
||||||
@ -401,15 +413,21 @@ Route::group(
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
// normal controller
|
// normal controller
|
||||||
Route::get('/transactions/{what}', ['uses' => 'TransactionController@index', 'as' => 'transactions.index'])->where(['what' => 'expenses|revenue|withdrawal|deposit|transfer|transfers']);
|
Route::get('/transactions/{what}', ['uses' => 'TransactionController@index', 'as' => 'transactions.index'])->where(
|
||||||
|
['what' => 'expenses|revenue|withdrawal|deposit|transfer|transfers']
|
||||||
|
);
|
||||||
Route::get('/transaction/show/{tj}', ['uses' => 'TransactionController@show', 'as' => 'transactions.show']);
|
Route::get('/transaction/show/{tj}', ['uses' => 'TransactionController@show', 'as' => 'transactions.show']);
|
||||||
Route::post('/transaction/reorder', ['uses' => 'TransactionController@reorder', 'as' => 'transactions.reorder']);
|
Route::post('/transaction/reorder', ['uses' => 'TransactionController@reorder', 'as' => 'transactions.reorder']);
|
||||||
|
|
||||||
// single controller
|
// single controller
|
||||||
Route::get('/transactions/create/{what}', ['uses' => 'Transaction\SingleController@create', 'as' => 'transactions.create'])->where(['what' => 'expenses|revenue|withdrawal|deposit|transfer|transfers']);
|
Route::get('/transactions/create/{what}', ['uses' => 'Transaction\SingleController@create', 'as' => 'transactions.create'])->where(
|
||||||
|
['what' => 'expenses|revenue|withdrawal|deposit|transfer|transfers']
|
||||||
|
);
|
||||||
Route::get('/transaction/edit/{tj}', ['uses' => 'Transaction\SingleController@edit', 'as' => 'transactions.edit']);
|
Route::get('/transaction/edit/{tj}', ['uses' => 'Transaction\SingleController@edit', 'as' => 'transactions.edit']);
|
||||||
Route::get('/transaction/delete/{tj}', ['uses' => 'Transaction\SingleController@delete', 'as' => 'transactions.delete']);
|
Route::get('/transaction/delete/{tj}', ['uses' => 'Transaction\SingleController@delete', 'as' => 'transactions.delete']);
|
||||||
Route::post('/transactions/store/{what}', ['uses' => 'Transaction\SingleController@store', 'as' => 'transactions.store'])->where(['what' => 'expenses|revenue|withdrawal|deposit|transfer|transfers']);
|
Route::post('/transactions/store/{what}', ['uses' => 'Transaction\SingleController@store', 'as' => 'transactions.store'])->where(
|
||||||
|
['what' => 'expenses|revenue|withdrawal|deposit|transfer|transfers']
|
||||||
|
);
|
||||||
Route::post('/transaction/update/{tj}', ['uses' => 'Transaction\SingleController@update', 'as' => 'transactions.update']);
|
Route::post('/transaction/update/{tj}', ['uses' => 'Transaction\SingleController@update', 'as' => 'transactions.update']);
|
||||||
Route::post('/transaction/destroy/{tj}', ['uses' => 'Transaction\SingleController@destroy', 'as' => 'transactions.destroy']);
|
Route::post('/transaction/destroy/{tj}', ['uses' => 'Transaction\SingleController@destroy', 'as' => 'transactions.destroy']);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user