Some more cleaning up and fixing

This commit is contained in:
James Cole 2015-05-15 21:01:24 +02:00
parent aede03d8b2
commit aae003be33
11 changed files with 164 additions and 171 deletions

View File

@ -43,7 +43,7 @@ class GoogleChartController extends Controller
public function accountBalanceChart(GChart $chart, Account $account)
{
$chart->addColumn(trans('firefly.dayOfMonth'), 'date');
$chart->addColumn(trans('firefly.balanceFor',['name' => $account->name]), 'number');
$chart->addColumn(trans('firefly.balanceFor', ['name' => $account->name]), 'number');
$chart->addCertainty(1);
$start = Session::get('start', Carbon::now()->startOfMonth());
@ -81,7 +81,7 @@ class GoogleChartController extends Controller
$index = 1;
/** @var Account $account */
foreach ($accounts as $account) {
$chart->addColumn(trans('firefly.balanceFor',['name' => $account->name]), 'number');
$chart->addColumn(trans('firefly.balanceFor', ['name' => $account->name]), 'number');
$chart->addCertainty($index);
$index++;
}
@ -111,7 +111,7 @@ class GoogleChartController extends Controller
*
* @return \Symfony\Component\HttpFoundation\Response
*/
public function allBudgetsAndSpending(GChart $chart, BudgetRepositoryInterface $repository, $year)
public function allBudgetsAndSpending(GChart $chart, BudgetRepositoryInterface $repository, $year, $shared = false)
{
$budgets = $repository->getBudgets();
$chart->addColumn(trans('firefly.month'), 'date');
@ -506,14 +506,16 @@ class GoogleChartController extends Controller
*
* @return \Symfony\Component\HttpFoundation\Response
*/
public function yearInExp(GChart $chart, ReportQueryInterface $query, $year)
public function yearInExp(GChart $chart, ReportQueryInterface $query, $year, $shared = false)
{
$start = new Carbon('01-01-' . $year);
$chart->addColumn(trans('firefly.month'), 'date');
$chart->addColumn(trans('firefly.income'), 'number');
$chart->addColumn(trans('firefly.expenses'), 'number');
$includeShared = Preferences::get('includeShared', false)->data;
if ($shared == 'shared') {
$shared = true;
}
// get report query interface.
@ -523,8 +525,8 @@ class GoogleChartController extends Controller
$currentEnd = clone $start;
$currentEnd->endOfMonth();
// total income && total expenses:
$incomeSum = floatval($query->incomeInPeriod($start, $currentEnd, $includeShared)->sum('queryAmount'));
$expenseSum = floatval($query->journalsByExpenseAccount($start, $currentEnd, $includeShared)->sum('queryAmount'));
$incomeSum = floatval($query->incomeInPeriod($start, $currentEnd, $shared)->sum('queryAmount'));
$expenseSum = floatval($query->journalsByExpenseAccount($start, $currentEnd, $shared)->sum('queryAmount'));
$chart->addRow(clone $start, $incomeSum, $expenseSum);
$start->addMonth();
@ -544,14 +546,16 @@ class GoogleChartController extends Controller
*
* @return \Symfony\Component\HttpFoundation\Response
*/
public function yearInExpSum(GChart $chart, ReportQueryInterface $query, $year)
public function yearInExpSum(GChart $chart, ReportQueryInterface $query, $year, $shared = false)
{
$start = new Carbon('01-01-' . $year);
$chart->addColumn(trans('firefly.summary'), 'string');
$chart->addColumn(trans('firefly.income'), 'number');
$chart->addColumn(trans('firefly.expenses'), 'number');
$includeShared = Preferences::get('includeShared', false)->data;
if ($shared == 'shared') {
$shared = true;
}
$income = 0;
$expense = 0;
@ -563,9 +567,9 @@ class GoogleChartController extends Controller
$currentEnd = clone $start;
$currentEnd->endOfMonth();
// total income:
$incomeSum = floatval($query->incomeInPeriod($start, $currentEnd, $includeShared)->sum('queryAmount'));
$incomeSum = floatval($query->incomeInPeriod($start, $currentEnd, $shared)->sum('queryAmount'));
// total expenses:
$expenseSum = floatval($query->journalsByExpenseAccount($start, $currentEnd, $includeShared)->sum('queryAmount'));
$expenseSum = floatval($query->journalsByExpenseAccount($start, $currentEnd, $shared)->sum('queryAmount'));
$income += $incomeSum;
$expense += $expenseSum;

View File

@ -33,7 +33,7 @@ class ReportController extends Controller
$this->query = $query;
$this->helper = $helper;
View::share('title', 'Reports');
View::share('title', trans('firefly.reports'));
View::share('mainTitleIcon', 'fa-line-chart');
}
@ -246,7 +246,7 @@ class ReportController extends Controller
return view(
'reports.month',
compact(
'income', 'expenses', 'budgets', 'accounts', 'categories',
'income', 'expenses', 'budgets', 'accounts', 'categories','shared',
'date', 'subTitle', 'displaySum', 'subTitleIcon'
)
);
@ -259,14 +259,17 @@ class ReportController extends Controller
*/
public function year($year, $shared = false)
{
$subTitle = trans('firefly.reportForYear',['year' => $year]);
if ($shared == 'shared') {
$shared = true;
$subTitle = trans('firefly.reportForYearShared',['year' => $year]);
}
$date = new Carbon('01-01-' . $year);
$end = clone $date;
$end->endOfYear();
$title = 'Reports';
$subTitle = $year;
$subTitleIcon = 'fa-bar-chart';
$mainTitleIcon = 'fa-line-chart';
$balances = $this->helper->yearBalanceReport($date, $shared);
@ -274,7 +277,7 @@ class ReportController extends Controller
$groupedExpenses = $this->query->journalsByExpenseAccount($date, $end, $shared);
return view(
'reports.year', compact('date', 'groupedIncomes', 'groupedExpenses', 'year', 'balances', 'title', 'subTitle', 'subTitleIcon', 'mainTitleIcon')
'reports.year', compact('date','shared', 'groupedIncomes', 'groupedExpenses', 'year', 'balances', 'subTitle', 'subTitleIcon', 'mainTitleIcon')
);
}

View File

@ -321,23 +321,28 @@ Breadcrumbs::register(
);
Breadcrumbs::register(
'reports.year', function (Generator $breadcrumbs, Carbon $date) {
'reports.year', function (Generator $breadcrumbs, Carbon $date, $shared) {
$breadcrumbs->parent('reports.index');
$breadcrumbs->push(trans('breadcrumbs.yearly_report', ['date' => $date->year]), route('reports.year', $date->year));
if ($shared) {
$title = trans('breadcrumbs.yearly_report_shared', ['date' => $date->year]);
} else {
$title = trans('breadcrumbs.yearly_report', ['date' => $date->year]);
}
$breadcrumbs->push($title, route('reports.year', $date->year));
}
);
Breadcrumbs::register(
'reports.month', function (Generator $breadcrumbs, Carbon $date) {
$breadcrumbs->parent('reports.year', $date);
$breadcrumbs->push(trans('breadcrumbs.monthly_report', ['date' => $date->format('F Y')]), route('reports.month', [$date->year, $date->month]));
}
);
'reports.month', function (Generator $breadcrumbs, Carbon $date, $shared) {
$breadcrumbs->parent('reports.year', $date, $shared);
Breadcrumbs::register(
'reports.budget', function (Generator $breadcrumbs, Carbon $date) {
$breadcrumbs->parent('reports.index');
$breadcrumbs->push(trans('breadcrumbs.budget_report', ['date' => $date->format('F Y')]), route('reports.budget', [$date->year, $date->month]));
if ($shared) {
$title = trans('breadcrumbs.monthly_report_shared', ['date' => $date->year]);
} else {
$title = trans('breadcrumbs.monthly_report', ['date' => $date->year]);
}
$breadcrumbs->push($title, route('reports.month', [$date->year, $date->month]));
}
);
@ -345,7 +350,7 @@ Breadcrumbs::register(
Breadcrumbs::register(
'search', function (Generator $breadcrumbs, $query) {
$breadcrumbs->parent('home');
$breadcrumbs->push(trans('breadcrumbs.searchResult',['query' => e($query)]), route('search'));
$breadcrumbs->push(trans('breadcrumbs.searchResult', ['query' => e($query)]), route('search'));
}
);
@ -353,13 +358,13 @@ Breadcrumbs::register(
Breadcrumbs::register(
'transactions.index', function (Generator $breadcrumbs, $what) {
$breadcrumbs->parent('home');
$breadcrumbs->push(trans('breadcrumbs.'.$what.'_list'), route('transactions.index', $what));
$breadcrumbs->push(trans('breadcrumbs.' . $what . '_list'), route('transactions.index', $what));
}
);
Breadcrumbs::register(
'transactions.create', function (Generator $breadcrumbs, $what) {
$breadcrumbs->parent('transactions.index', $what);
$breadcrumbs->push(trans('breadcrumbs.create_'.e($what)), route('transactions.create', $what));
$breadcrumbs->push(trans('breadcrumbs.create_' . e($what)), route('transactions.create', $what));
}
);

View File

@ -281,10 +281,10 @@ Route::group(
Route::get('/chart/home/bills', ['uses' => 'GoogleChartController@billsOverview']);
Route::get('/chart/account/{account}/{view?}', ['uses' => 'GoogleChartController@accountBalanceChart']);
Route::get('/chart/budget/{budget}/spending/{year?}', ['uses' => 'GoogleChartController@budgetsAndSpending']);
Route::get('/chart/budgets/spending/{year?}', ['uses' => 'GoogleChartController@allBudgetsAndSpending'])->where(['year' => '[0-9]+']);
Route::get('/chart/budgets/spending/{year}/{shared?}', ['uses' => 'GoogleChartController@allBudgetsAndSpending'])->where(['year' => '[0-9]{4}','shared' => 'shared']);
Route::get('/chart/budget/{budget}/{limitrepetition}', ['uses' => 'GoogleChartController@budgetLimitSpending']);
Route::get('/chart/reports/income-expenses/{year}', ['uses' => 'GoogleChartController@yearInExp']);
Route::get('/chart/reports/income-expenses-sum/{year}', ['uses' => 'GoogleChartController@yearInExpSum']);
Route::get('/chart/reports/income-expenses/{year}/{shared?}', ['uses' => 'GoogleChartController@yearInExp'])->where(['year' => '[0-9]{4}','shared'=> 'shared']);
Route::get('/chart/reports/income-expenses-sum/{year}/{shared?}', ['uses' => 'GoogleChartController@yearInExpSum'])->where(['year' => '[0-9]{4}','shared'=> 'shared']);
Route::get('/chart/bills/{bill}', ['uses' => 'GoogleChartController@billOverview']);
Route::get('/chart/piggy-history/{piggyBank}', ['uses' => 'GoogleChartController@piggyBankHistory']);
Route::get('/chart/category/{category}/period', ['uses' => 'GoogleChartController@categoryPeriodChart']);

View File

@ -5,16 +5,14 @@ if (typeof(google) != 'undefined') {
function drawChart() {
googleColumnChart('chart/reports/income-expenses/' + year, 'income-expenses-chart');
googleColumnChart('chart/reports/income-expenses-sum/' + year, 'income-expenses-sum-chart')
googleColumnChart('chart/reports/income-expenses/' + year + shared, 'income-expenses-chart');
googleColumnChart('chart/reports/income-expenses-sum/' + year + shared, 'income-expenses-sum-chart')
googleStackedColumnChart('chart/budgets/spending/' + year, 'budgets');
googleStackedColumnChart('chart/budgets/spending/' + year + shared, 'budgets');
}
$(function () {
$('.openModal').on('click', openModal);
includeSharedToggle();
$('#includeShared').click(includeSharedSet);
});
function openModal(e) {
@ -31,32 +29,3 @@ function openModal(e) {
return false;
}
function includeSharedToggle() {
// get setting from JSON.
$.getJSON('json/show-shared-reports').success(function (data) {
console.log('GO');
if (data.value == true) {
// show shared data, update button:
//<i class="state-icon glyphicon glyphicon-check"></i>
$('#includeShared').empty().addClass('btn-info').append($('<i>').addClass('state-icon glyphicon glyphicon-check')).append(' Include shared asset accounts').show();
console.log('true');
} else {
$('#includeShared').empty().removeClass('btn-info').append($('<i>').addClass('state-icon glyphicon glyphicon-unchecked')).append(' Include shared asset accounts').show();
console.log('false');
}
}).fail(function () {
console.log('fail');
});
}
function includeSharedSet() {
// get setting from JSON.
$.getJSON('json/show-shared-reports/set').success(function (data) {
console.log('Value is now: ' + data.value);
includeSharedToggle();
}).fail(function () {
console.log('fail');
});
return false;
}

View File

@ -1,71 +1,74 @@
<?php
return [
'home' => 'Home',
'home' => 'Home',
'asset_accounts' => 'Asset accounts',
'expense_accounts' => 'Expense accounts',
'revenue_accounts' => 'Revenue accounts',
'asset_accounts' => 'Asset accounts',
'expense_accounts' => 'Expense accounts',
'revenue_accounts' => 'Revenue accounts',
'new_asset_account' => 'New asset accounts',
'new_expense_account' => 'New expense account',
'new_revenue_account' => 'New revenue account',
'new_asset_account' => 'New asset accounts',
'new_expense_account' => 'New expense account',
'new_revenue_account' => 'New revenue account',
'delete_account' => 'Delete account ":name"',
'edit_account' => 'Edit account ":name"',
'delete_account' => 'Delete account ":name"',
'edit_account' => 'Edit account ":name"',
'budgets' => 'Budgets',
'newBudget' => 'Create a new budget',
'delete_budget' => 'Delete budget ":name"',
'edit_budget' => 'Edit budget ":name"',
'budgets' => 'Budgets',
'newBudget' => 'Create a new budget',
'delete_budget' => 'Delete budget ":name"',
'edit_budget' => 'Edit budget ":name"',
'categories' => 'Categories',
'newCategory' => 'Create a new categori',
'delete_category' => 'Delete category ":name"',
'edit_category' => 'Edit category ":name"',
'categories' => 'Categories',
'newCategory' => 'Create a new categori',
'delete_category' => 'Delete category ":name"',
'edit_category' => 'Edit category ":name"',
'currencies' => 'Currencies',
'edit_currency' => 'Edit currencies ":name"',
'delete_currency' => 'Delete currencies ":name"',
'currencies' => 'Currencies',
'edit_currency' => 'Edit currencies ":name"',
'delete_currency' => 'Delete currencies ":name"',
'piggyBanks' => 'Piggy banks',
'newPiggyBank' => 'Create a new piggy bank',
'edit_piggyBank' => 'Edit piggy bank ":name"',
'delete_piggyBank' => 'Delete piggy bank ":name"',
'piggyBanks' => 'Piggy banks',
'newPiggyBank' => 'Create a new piggy bank',
'edit_piggyBank' => 'Edit piggy bank ":name"',
'delete_piggyBank' => 'Delete piggy bank ":name"',
'preferences' => 'Preferences',
'profile' => 'Profile',
'changePassword' => 'Change your password',
'preferences' => 'Preferences',
'profile' => 'Profile',
'changePassword' => 'Change your password',
'bills' => 'Bills',
'newBill' => 'New bill',
'edit_bill' => 'Edit bill ":name"',
'delete_bill' => 'Delete bill ":name"',
'bills' => 'Bills',
'newBill' => 'New bill',
'edit_bill' => 'Edit bill ":name"',
'delete_bill' => 'Delete bill ":name"',
'reminders' => 'Reminders',
'reminder' => 'Reminder #:id',
'reminders' => 'Reminders',
'reminder' => 'Reminder #:id',
'reports' => 'Reports',
'monthly_report' => 'Montly report for :date',
'yearly_report' => 'Yearly report for :date',
'budget_report' => 'Budget report for :date',
'reports' => 'Reports',
'monthly_report' => 'Montly report for :date',
'monthly_report_shared' => 'Montly report for :date (including shared accounts)',
'yearly_report' => 'Yearly report for :date',
'yearly_report_shared' => 'Yearly report for :date (including shared accounts)',
'searchResult' => 'Search for ":query"',
'budget_report' => 'Budget report for :date',
'withdrawal_list' => 'Expenses',
'deposit_list' => 'Revenue, income and deposits',
'transfer_list' => 'Transfers',
'transfers_list' => 'Transfers',
'searchResult' => 'Search for ":query"',
'create_withdrawal' => 'Create new withdrawal',
'create_deposit' => 'Create new deposit',
'create_transfer' => 'Create new transfer',
'withdrawal_list' => 'Expenses',
'deposit_list' => 'Revenue, income and deposits',
'transfer_list' => 'Transfers',
'transfers_list' => 'Transfers',
'edit_journal' => 'Edit transaction ":description"',
'delete_journal' => 'Delete transaction ":description"',
'create_withdrawal' => 'Create new withdrawal',
'create_deposit' => 'Create new deposit',
'create_transfer' => 'Create new transfer',
'tags' => 'Tags',
'createTag' => 'Create new tag',
'edit_tag' => 'Edit tag ":tag"',
'delete_tag' => 'Delete tag ":tag"',
'edit_journal' => 'Edit transaction ":description"',
'delete_journal' => 'Delete transaction ":description"',
'tags' => 'Tags',
'createTag' => 'Create new tag',
'edit_tag' => 'Edit tag ":tag"',
'delete_tag' => 'Delete tag ":tag"',
];

View File

@ -86,6 +86,9 @@ return [
'half-year' => 'Every six months',
'yearly' => 'Yearly',
'reportForYear' => 'Yearly report for :year',
'reportForYearShared' => 'Yearly report for :year (including shared accounts)',
// charts:
'dayOfMonth' => 'Day of the month',
'month' => 'Month',

View File

@ -1,71 +1,73 @@
<?php
return [
'home' => 'Home',
'home' => 'Home',
'asset_accounts' => 'Betaalrekeningen',
'expense_accounts' => 'Crediteuren',
'revenue_accounts' => 'Debiteuren',
'asset_accounts' => 'Betaalrekeningen',
'expense_accounts' => 'Crediteuren',
'revenue_accounts' => 'Debiteuren',
'new_asset_account' => 'Nieuwe betaalrekening',
'new_expense_account' => 'Nieuwe crediteur',
'new_revenue_account' => 'Nieuwe debiteur',
'new_asset_account' => 'Nieuwe betaalrekening',
'new_expense_account' => 'Nieuwe crediteur',
'new_revenue_account' => 'Nieuwe debiteur',
'delete_account' => 'Verwijder rekening ":name"',
'edit_account' => 'Wijzig rekening ":name"',
'delete_account' => 'Verwijder rekening ":name"',
'edit_account' => 'Wijzig rekening ":name"',
'budgets' => 'Budgetten',
'newBudget' => 'Maak een nieuw budget',
'delete_budget' => 'Verwijder budget ":name"',
'edit_budget' => 'Wijzig budget ":name"',
'budgets' => 'Budgetten',
'newBudget' => 'Maak een nieuw budget',
'delete_budget' => 'Verwijder budget ":name"',
'edit_budget' => 'Wijzig budget ":name"',
'categories' => 'Categorieën',
'newCategory' => 'Maak een nieuw categorie',
'delete_category' => 'Verwijder categorie ":name"',
'edit_category' => 'Wijzig categorie ":name"',
'categories' => 'Categorieën',
'newCategory' => 'Maak een nieuw categorie',
'delete_category' => 'Verwijder categorie ":name"',
'edit_category' => 'Wijzig categorie ":name"',
'currencies' => 'Munteenheden',
'edit_currency' => 'Wijzig munteenheid ":name"',
'delete_currency' => 'Verwijder munteenheid ":name"',
'currencies' => 'Munteenheden',
'edit_currency' => 'Wijzig munteenheid ":name"',
'delete_currency' => 'Verwijder munteenheid ":name"',
'piggyBanks' => 'Spaarpotjes',
'newPiggyBank' => 'Nieuw spaarpotje',
'edit_piggyBank' => 'Wijzig spaarpotje ":name"',
'delete_piggyBank' => 'Verwijder spaarportje ":name"',
'piggyBanks' => 'Spaarpotjes',
'newPiggyBank' => 'Nieuw spaarpotje',
'edit_piggyBank' => 'Wijzig spaarpotje ":name"',
'delete_piggyBank' => 'Verwijder spaarportje ":name"',
'preferences' => 'Voorkeuren',
'profile' => 'Profiel',
'changePassword' => 'Verander je wachtwoord',
'preferences' => 'Voorkeuren',
'profile' => 'Profiel',
'changePassword' => 'Verander je wachtwoord',
'bills' => 'Rekeningen',
'newBill' => 'Nieuwe rekening',
'edit_bill' => 'Wijzig rekening ":name"',
'delete_bill' => 'Verwijder rekening ":name"',
'bills' => 'Rekeningen',
'newBill' => 'Nieuwe rekening',
'edit_bill' => 'Wijzig rekening ":name"',
'delete_bill' => 'Verwijder rekening ":name"',
'reminders' => 'Herinneringen',
'reminder' => 'Herinnering #:id',
'reminders' => 'Herinneringen',
'reminder' => 'Herinnering #:id',
'reports' => 'Overzichten',
'monthly_report' => 'Maandoverzicht :date',
'yearly_report' => 'Jaaroverzicht :date',
'budget_report' => 'Budgetoverzicht :date',
'reports' => 'Overzichten',
'monthly_report' => 'Maandoverzicht :date',
'monthly_report_shared' => 'Maandoverzicht :date (inclusief gedeelde rekeningen)',
'yearly_report' => 'Jaaroverzicht :date',
'yearly_report_shared' => 'Jaaroverzicht :date (inclusief gedeelde rekeningen)',
'budget_report' => 'Budgetoverzicht :date',
'searchResult' => 'Zoeken naar ":query"',
'searchResult' => 'Zoeken naar ":query"',
'withdrawal_list' => 'Uitgaven',
'deposit_list' => 'Inkomsten',
'transfer_list' => 'Overschrijvingen',
'transfers_list' => 'Overschrijvingen',
'withdrawal_list' => 'Uitgaven',
'deposit_list' => 'Inkomsten',
'transfer_list' => 'Overschrijvingen',
'transfers_list' => 'Overschrijvingen',
'create_withdrawal' => 'Sla nieuwe uitgave op',
'create_deposit' => 'Sla nieuwe inkomsten op',
'create_transfer' => 'Sla nieuwe overschrijving op',
'create_withdrawal' => 'Sla nieuwe uitgave op',
'create_deposit' => 'Sla nieuwe inkomsten op',
'create_transfer' => 'Sla nieuwe overschrijving op',
'edit_journal' => 'Wijzig transactie ":description"',
'delete_journal' => 'Verwijder transactie ":description"',
'edit_journal' => 'Wijzig transactie ":description"',
'delete_journal' => 'Verwijder transactie ":description"',
'tags' => 'Tags',
'createTag' => 'Maak nieuwe tag',
'edit_tag' => 'Wijzig tag ":tag"',
'delete_tag' => 'Verwijder tag ":tag"',
'tags' => 'Tags',
'createTag' => 'Maak nieuwe tag',
'edit_tag' => 'Wijzig tag ":tag"',
'delete_tag' => 'Verwijder tag ":tag"',
];

View File

@ -86,6 +86,9 @@ return [
'half-year' => 'Elk half jaar',
'yearly' => 'Jaarlijks',
'reportForYear' => 'Jaaroverzicht :year',
'reportForYearShared' => 'Jaaroverzicht :year (inclusief gedeelde rekeningen)',
// charts:
'dayOfMonth' => 'Dag vd maand',
'month' => 'Maand',

View File

@ -1,6 +1,6 @@
{% extends "./layout/default.twig" %}
{% block content %}
{{ Breadcrumbs.renderIfExists(Route.getCurrentRoute.getName, date) }}
{{ Breadcrumbs.renderIfExists(Route.getCurrentRoute.getName, date, shared) }}
<div class="row">
<div class="col-lg-5 col-md-5 col-sm-12">

View File

@ -1,6 +1,6 @@
{% extends "./layout/default.twig" %}
{% block content %}
{{ Breadcrumbs.renderIfExists(Route.getCurrentRoute.getName, date) }}
{{ Breadcrumbs.renderIfExists(Route.getCurrentRoute.getName, date, shared) }}
<div class="row">
<div class="col-lg-10 col-md-8 col-sm-12">
@ -170,6 +170,7 @@
<script type="text/javascript">
var year = '{{year}}';
var shared = {% if shared %}'/shared'{% else %}''{% endif %};
</script>
<script type="text/javascript" src="js/reports.js"></script>