mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-02-25 18:45:27 -06:00
Extra report and cleanup.
This commit is contained in:
parent
220d689f69
commit
3e28c0c00a
@ -1,21 +1,20 @@
|
|||||||
<?php namespace FireflyIII\Events;
|
<?php namespace FireflyIII\Events;
|
||||||
|
|
||||||
use FireflyIII\Events\Event;
|
|
||||||
|
|
||||||
use Illuminate\Queue\SerializesModels;
|
use Illuminate\Queue\SerializesModels;
|
||||||
|
|
||||||
class JournalDeleted extends Event {
|
class JournalDeleted extends Event
|
||||||
|
{
|
||||||
|
|
||||||
use SerializesModels;
|
use SerializesModels;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create a new event instance.
|
* Create a new event instance.
|
||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
public function __construct()
|
public function __construct()
|
||||||
{
|
{
|
||||||
//
|
//
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -1,32 +1,33 @@
|
|||||||
<?php namespace FireflyIII\Handlers\Events;
|
<?php namespace FireflyIII\Handlers\Events;
|
||||||
|
|
||||||
use FireflyIII\Events\JournalDeleted;
|
use FireflyIII\Events\JournalDeleted;
|
||||||
|
|
||||||
use Illuminate\Queue\InteractsWithQueue;
|
|
||||||
use Illuminate\Contracts\Queue\ShouldBeQueued;
|
use Illuminate\Contracts\Queue\ShouldBeQueued;
|
||||||
|
use Illuminate\Queue\InteractsWithQueue;
|
||||||
|
|
||||||
class JournalDeletedHandler {
|
class JournalDeletedHandler
|
||||||
|
{
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create the event handler.
|
* Create the event handler.
|
||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
public function __construct()
|
public function __construct()
|
||||||
{
|
{
|
||||||
//
|
//
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Handle the event.
|
* Handle the event.
|
||||||
*
|
*
|
||||||
* @param JournalDeleted $event
|
* @param JournalDeleted $event
|
||||||
* @return void
|
*
|
||||||
*/
|
* @return void
|
||||||
public function handle(JournalDeleted $event)
|
*/
|
||||||
{
|
public function handle(JournalDeleted $event)
|
||||||
//
|
{
|
||||||
|
//
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -62,14 +62,13 @@ class ReportHelper implements ReportHelperInterface
|
|||||||
$end = clone $date;
|
$end = clone $date;
|
||||||
$end->endOfMonth();
|
$end->endOfMonth();
|
||||||
// all budgets
|
// all budgets
|
||||||
$set = \Auth::user()->budgets()
|
$set = \Auth::user()->budgets()
|
||||||
->leftJoin(
|
->leftJoin(
|
||||||
'budget_limits', function (JoinClause $join) use ($date) {
|
'budget_limits', function (JoinClause $join) use ($date) {
|
||||||
$join->on('budget_limits.budget_id', '=', 'budgets.id')->where('budget_limits.startdate', '=', $date->format('Y-m-d'));
|
$join->on('budget_limits.budget_id', '=', 'budgets.id')->where('budget_limits.startdate', '=', $date->format('Y-m-d'));
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
->get(['budgets.*', 'budget_limits.amount as amount']);
|
->get(['budgets.*', 'budget_limits.amount as amount']);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
$budgets = $this->_helper->makeArray($set);
|
$budgets = $this->_helper->makeArray($set);
|
||||||
|
@ -33,11 +33,11 @@ interface ReportHelperInterface
|
|||||||
*/
|
*/
|
||||||
public function listOfYears(Carbon $date);
|
public function listOfYears(Carbon $date);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param Carbon $date
|
* @param Carbon $date
|
||||||
*
|
*
|
||||||
* @return array
|
* @return array
|
||||||
*/
|
*/
|
||||||
public function yearBalanceReport(Carbon $date);
|
public function yearBalanceReport(Carbon $date);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -11,10 +11,12 @@ namespace FireflyIII\Helpers\Report;
|
|||||||
use Auth;
|
use Auth;
|
||||||
use Carbon\Carbon;
|
use Carbon\Carbon;
|
||||||
use DB;
|
use DB;
|
||||||
|
use FireflyIII\Models\Account;
|
||||||
use FireflyIII\Models\TransactionJournal;
|
use FireflyIII\Models\TransactionJournal;
|
||||||
use Illuminate\Database\Eloquent\Builder;
|
use Illuminate\Database\Eloquent\Builder;
|
||||||
use Illuminate\Database\Query\JoinClause;
|
use Illuminate\Database\Query\JoinClause;
|
||||||
use Illuminate\Support\Collection;
|
use Illuminate\Support\Collection;
|
||||||
|
use Steam;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Class ReportQuery
|
* Class ReportQuery
|
||||||
@ -31,22 +33,141 @@ class ReportQuery implements ReportQueryInterface
|
|||||||
*/
|
*/
|
||||||
public function accountList()
|
public function accountList()
|
||||||
{
|
{
|
||||||
return \Auth::user()->accounts()
|
return Auth::user()->accounts()
|
||||||
->leftJoin('account_types', 'account_types.id', '=', 'accounts.account_type_id')
|
->leftJoin('account_types', 'account_types.id', '=', 'accounts.account_type_id')
|
||||||
->leftJoin(
|
->leftJoin(
|
||||||
'account_meta', function (JoinClause $join) {
|
'account_meta', function (JoinClause $join) {
|
||||||
$join->on('account_meta.account_id', '=', 'accounts.id')->where('account_meta.name', '=', "accountRole");
|
$join->on('account_meta.account_id', '=', 'accounts.id')->where('account_meta.name', '=', "accountRole");
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
->whereIn('account_types.type', ['Default account', 'Cash account', 'Asset account'])
|
->whereIn('account_types.type', ['Default account', 'Cash account', 'Asset account'])
|
||||||
->where('active', 1)
|
->where('active', 1)
|
||||||
->where(
|
->where(
|
||||||
function (Builder $query) {
|
function (Builder $query) {
|
||||||
$query->where('account_meta.data', '!=', '"sharedExpense"');
|
$query->where('account_meta.data', '!=', '"sharedExpense"');
|
||||||
$query->orWhereNull('account_meta.data');
|
$query->orWhereNull('account_meta.data');
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
->get(['accounts.*']);
|
->get(['accounts.*']);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This method will get a list of all expenses in a certain time period that have no budget
|
||||||
|
* and are balanced by a transfer to make up for it.
|
||||||
|
*
|
||||||
|
* @param Account $account
|
||||||
|
* @param Carbon $start
|
||||||
|
* @param Carbon $end
|
||||||
|
*
|
||||||
|
* @return Collection
|
||||||
|
*/
|
||||||
|
public function balancedTransactionsList(Account $account, Carbon $start, Carbon $end)
|
||||||
|
{
|
||||||
|
|
||||||
|
$set = TransactionJournal::
|
||||||
|
leftJoin('transaction_group_transaction_journal', 'transaction_group_transaction_journal.transaction_journal_id', '=', 'transaction_journals.id')
|
||||||
|
->leftJoin(
|
||||||
|
'transaction_group_transaction_journal as otherFromGroup', function (JoinClause $join) {
|
||||||
|
$join->on('otherFromGroup.transaction_group_id', '=', 'transaction_group_transaction_journal.transaction_group_id')
|
||||||
|
->on('otherFromGroup.transaction_journal_id', '!=', 'transaction_journals.id');
|
||||||
|
}
|
||||||
|
)
|
||||||
|
->leftJoin('transaction_journals as otherJournals', 'otherJournals.id', '=', 'otherFromGroup.transaction_journal_id')
|
||||||
|
->leftJoin('transaction_types', 'transaction_types.id', '=', 'otherJournals.transaction_type_id')
|
||||||
|
->leftJoin(
|
||||||
|
'transactions', function (JoinClause $join) {
|
||||||
|
$join->on('transaction_journals.id', '=', 'transactions.transaction_journal_id')->where('amount', '>', 0);
|
||||||
|
}
|
||||||
|
)
|
||||||
|
->leftJoin('budget_transaction_journal', 'budget_transaction_journal.transaction_journal_id', '=', 'otherJournals.id')
|
||||||
|
->before($end)->after($start)
|
||||||
|
->where('transaction_types.type', 'Withdrawal')
|
||||||
|
->where('transaction_journals.user_id', \Auth::user()->id)
|
||||||
|
->whereNull('budget_transaction_journal.budget_id')->whereNull('transaction_journals.deleted_at')
|
||||||
|
->whereNull('otherJournals.deleted_at')
|
||||||
|
->where('transactions.account_id', $account->id)
|
||||||
|
->whereNotNull('transaction_group_transaction_journal.transaction_group_id')->groupBy('transaction_journals.id')
|
||||||
|
->first(
|
||||||
|
[
|
||||||
|
DB::Raw('SUM(`transactions`.`amount`) as `amount`')
|
||||||
|
]
|
||||||
|
);
|
||||||
|
$sum = 0;
|
||||||
|
if (!is_null($set)) {
|
||||||
|
$sum = floatval($set->amount);
|
||||||
|
}
|
||||||
|
|
||||||
|
return $sum;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get a users accounts combined with various meta-data related to the start and end date.
|
||||||
|
*
|
||||||
|
* @param Carbon $start
|
||||||
|
* @param Carbon $end
|
||||||
|
*
|
||||||
|
* @return Collection
|
||||||
|
*/
|
||||||
|
public function getAllAccounts(Carbon $start, Carbon $end)
|
||||||
|
{
|
||||||
|
$set = Auth::user()->accounts()
|
||||||
|
->accountTypeIn(['Default account', 'Asset account', 'Cash account'])
|
||||||
|
->leftJoin(
|
||||||
|
'account_meta', function (JoinClause $join) {
|
||||||
|
$join->on('account_meta.account_id', '=', 'accounts.id')->where('account_meta.name', '=', 'accountRole');
|
||||||
|
}
|
||||||
|
)
|
||||||
|
->where(
|
||||||
|
function (Builder $query) {
|
||||||
|
$query->where('account_meta.data', '!=', '"sharedExpense"');
|
||||||
|
$query->orWhereNull('account_meta.data');
|
||||||
|
}
|
||||||
|
)
|
||||||
|
->get(['accounts.*']);
|
||||||
|
$set->each(
|
||||||
|
function (Account $account) use ($start, $end) {
|
||||||
|
/** @noinspection PhpParamsInspection */
|
||||||
|
$account->startBalance = Steam::balance($account, $start);
|
||||||
|
$account->endBalance = Steam::balance($account, $end);
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
|
return $set;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Grabs a summary of all expenses grouped by budget, related to the account.
|
||||||
|
*
|
||||||
|
* @param Account $account
|
||||||
|
* @param Carbon $start
|
||||||
|
* @param Carbon $end
|
||||||
|
*
|
||||||
|
* @return mixed
|
||||||
|
*/
|
||||||
|
public function getBudgetSummary(Account $account, Carbon $start, Carbon $end)
|
||||||
|
{
|
||||||
|
$set = TransactionJournal::
|
||||||
|
leftJoin('budget_transaction_journal', 'budget_transaction_journal.transaction_journal_id', '=', 'transaction_journals.id')
|
||||||
|
->leftJoin('budgets', 'budgets.id', '=', 'budget_transaction_journal.budget_id')
|
||||||
|
->leftJoin('transaction_types', 'transaction_types.id', '=', 'transaction_journals.transaction_type_id')
|
||||||
|
->leftJoin(
|
||||||
|
'transactions', function (JoinClause $join) {
|
||||||
|
$join->on('transactions.transaction_journal_id', '=', 'transaction_journals.id')->where('transactions.amount', '<', 0);
|
||||||
|
}
|
||||||
|
)
|
||||||
|
->leftJoin('accounts', 'accounts.id', '=', 'transactions.account_id')
|
||||||
|
->before($end)
|
||||||
|
->after($start)
|
||||||
|
->where('accounts.id', $account->id)
|
||||||
|
->where('transaction_journals.user_id', Auth::user()->id)
|
||||||
|
->where('transaction_types.type', 'Withdrawal')
|
||||||
|
->groupBy('budgets.id')
|
||||||
|
->orderBy('budgets.id')
|
||||||
|
->get(['budgets.id', 'budgets.name', DB::Raw('SUM(`transactions`.`amount`) as `amount`')]);
|
||||||
|
|
||||||
|
return $set;
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -124,28 +245,28 @@ class ReportQuery implements ReportQueryInterface
|
|||||||
*/
|
*/
|
||||||
public function journalsByBudget(Carbon $start, Carbon $end)
|
public function journalsByBudget(Carbon $start, Carbon $end)
|
||||||
{
|
{
|
||||||
return \Auth::user()->transactionjournals()
|
return Auth::user()->transactionjournals()
|
||||||
->leftJoin('budget_transaction_journal', 'budget_transaction_journal.transaction_journal_id', '=', 'transaction_journals.id')
|
->leftJoin('budget_transaction_journal', 'budget_transaction_journal.transaction_journal_id', '=', 'transaction_journals.id')
|
||||||
->leftJoin('budgets', 'budget_transaction_journal.budget_id', '=', 'budgets.id')
|
->leftJoin('budgets', 'budget_transaction_journal.budget_id', '=', 'budgets.id')
|
||||||
->leftJoin(
|
->leftJoin(
|
||||||
'transactions', function (JoinClause $join) {
|
'transactions', function (JoinClause $join) {
|
||||||
$join->on('transaction_journals.id', '=', 'transactions.transaction_journal_id')->where('transactions.amount', '<', 0);
|
$join->on('transaction_journals.id', '=', 'transactions.transaction_journal_id')->where('transactions.amount', '<', 0);
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
->leftJoin('accounts', 'accounts.id', '=', 'transactions.account_id')
|
->leftJoin('accounts', 'accounts.id', '=', 'transactions.account_id')
|
||||||
->leftJoin(
|
->leftJoin(
|
||||||
'account_meta', function (JoinClause $join) {
|
'account_meta', function (JoinClause $join) {
|
||||||
$join->on('account_meta.account_id', '=', 'accounts.id')->where('account_meta.name', '=', 'accountRole');
|
$join->on('account_meta.account_id', '=', 'accounts.id')->where('account_meta.name', '=', 'accountRole');
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
->leftJoin('transaction_types', 'transaction_journals.transaction_type_id', '=', 'transaction_types.id')
|
->leftJoin('transaction_types', 'transaction_journals.transaction_type_id', '=', 'transaction_types.id')
|
||||||
->where('transaction_journals.date', '>=', $start->format('Y-m-d'))
|
->where('transaction_journals.date', '>=', $start->format('Y-m-d'))
|
||||||
->where('transaction_journals.date', '<=', $end->format('Y-m-d'))
|
->where('transaction_journals.date', '<=', $end->format('Y-m-d'))
|
||||||
->where('account_meta.data', '!=', '"sharedExpense"')
|
->where('account_meta.data', '!=', '"sharedExpense"')
|
||||||
->where('transaction_types.type', 'Withdrawal')
|
->where('transaction_types.type', 'Withdrawal')
|
||||||
->groupBy('budgets.id')
|
->groupBy('budgets.id')
|
||||||
->orderBy('budgets.name', 'ASC')
|
->orderBy('budgets.name', 'ASC')
|
||||||
->get(['budgets.id', 'budgets.name', \DB::Raw('SUM(`transactions`.`amount`) AS `spent`')]);
|
->get(['budgets.id', 'budgets.name', DB::Raw('SUM(`transactions`.`amount`) AS `spent`')]);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -159,30 +280,30 @@ class ReportQuery implements ReportQueryInterface
|
|||||||
*/
|
*/
|
||||||
public function journalsByCategory(Carbon $start, Carbon $end)
|
public function journalsByCategory(Carbon $start, Carbon $end)
|
||||||
{
|
{
|
||||||
return \Auth::user()->transactionjournals()
|
return Auth::user()->transactionjournals()
|
||||||
->leftJoin(
|
->leftJoin(
|
||||||
'category_transaction_journal', 'category_transaction_journal.transaction_journal_id', '=', 'transaction_journals.id'
|
'category_transaction_journal', 'category_transaction_journal.transaction_journal_id', '=', 'transaction_journals.id'
|
||||||
)
|
)
|
||||||
->leftJoin('categories', 'category_transaction_journal.category_id', '=', 'categories.id')
|
->leftJoin('categories', 'category_transaction_journal.category_id', '=', 'categories.id')
|
||||||
->leftJoin(
|
->leftJoin(
|
||||||
'transactions', function (JoinClause $join) {
|
'transactions', function (JoinClause $join) {
|
||||||
$join->on('transaction_journals.id', '=', 'transactions.transaction_journal_id')->where('transactions.amount', '<', 0);
|
$join->on('transaction_journals.id', '=', 'transactions.transaction_journal_id')->where('transactions.amount', '<', 0);
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
->leftJoin('accounts', 'accounts.id', '=', 'transactions.account_id')
|
->leftJoin('accounts', 'accounts.id', '=', 'transactions.account_id')
|
||||||
->leftJoin(
|
->leftJoin(
|
||||||
'account_meta', function (JoinClause $join) {
|
'account_meta', function (JoinClause $join) {
|
||||||
$join->on('account_meta.account_id', '=', 'accounts.id')->where('account_meta.name', '=', 'accountRole');
|
$join->on('account_meta.account_id', '=', 'accounts.id')->where('account_meta.name', '=', 'accountRole');
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
->leftJoin('transaction_types', 'transaction_journals.transaction_type_id', '=', 'transaction_types.id')
|
->leftJoin('transaction_types', 'transaction_journals.transaction_type_id', '=', 'transaction_types.id')
|
||||||
->where('transaction_journals.date', '>=', $start->format('Y-m-d'))
|
->where('transaction_journals.date', '>=', $start->format('Y-m-d'))
|
||||||
->where('transaction_journals.date', '<=', $end->format('Y-m-d'))
|
->where('transaction_journals.date', '<=', $end->format('Y-m-d'))
|
||||||
->where('account_meta.data', '!=', '"sharedExpense"')
|
->where('account_meta.data', '!=', '"sharedExpense"')
|
||||||
->where('transaction_types.type', 'Withdrawal')
|
->where('transaction_types.type', 'Withdrawal')
|
||||||
->groupBy('categories.id')
|
->groupBy('categories.id')
|
||||||
->orderBy('amount')
|
->orderBy('amount')
|
||||||
->get(['categories.id', 'categories.name', \DB::Raw('SUM(`transactions`.`amount`) AS `amount`')]);
|
->get(['categories.id', 'categories.name', DB::Raw('SUM(`transactions`.`amount`) AS `amount`')]);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -333,7 +454,7 @@ class ReportQuery implements ReportQueryInterface
|
|||||||
->after($start)
|
->after($start)
|
||||||
->before($end)
|
->before($end)
|
||||||
->where('transaction_types.type', 'Transfer')
|
->where('transaction_types.type', 'Transfer')
|
||||||
->where('transaction_journals.user_id', \Auth::user()->id)
|
->where('transaction_journals.user_id', Auth::user()->id)
|
||||||
->get(
|
->get(
|
||||||
['transaction_journals.id', 'transaction_journals.description', 'transactions.account_id', 'accounts.name',
|
['transaction_journals.id', 'transaction_journals.description', 'transactions.account_id', 'accounts.name',
|
||||||
'transactions.amount']
|
'transactions.amount']
|
||||||
@ -375,13 +496,13 @@ class ReportQuery implements ReportQueryInterface
|
|||||||
->after($start)
|
->after($start)
|
||||||
->before($end)
|
->before($end)
|
||||||
->where('transaction_types.type', 'Transfer')
|
->where('transaction_types.type', 'Transfer')
|
||||||
->where('transaction_journals.user_id', \Auth::user()->id)
|
->where('transaction_journals.user_id', Auth::user()->id)
|
||||||
->groupBy('categories.name')
|
->groupBy('categories.name')
|
||||||
->get(
|
->get(
|
||||||
[
|
[
|
||||||
'categories.id',
|
'categories.id',
|
||||||
'categories.name as name',
|
'categories.name as name',
|
||||||
\DB::Raw('SUM(`transactions`.`amount`) * -1 AS `amount`')
|
DB::Raw('SUM(`transactions`.`amount`) * -1 AS `amount`')
|
||||||
]
|
]
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
@ -1,14 +1,9 @@
|
|||||||
<?php
|
<?php
|
||||||
/**
|
|
||||||
* Created by PhpStorm.
|
|
||||||
* User: sander
|
|
||||||
* Date: 22/02/15
|
|
||||||
* Time: 18:30
|
|
||||||
*/
|
|
||||||
|
|
||||||
namespace FireflyIII\Helpers\Report;
|
namespace FireflyIII\Helpers\Report;
|
||||||
|
|
||||||
use Carbon\Carbon;
|
use Carbon\Carbon;
|
||||||
|
use FireflyIII\Models\Account;
|
||||||
use Illuminate\Support\Collection;
|
use Illuminate\Support\Collection;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -26,6 +21,16 @@ interface ReportQueryInterface
|
|||||||
*/
|
*/
|
||||||
public function accountList();
|
public function accountList();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get a users accounts combined with various meta-data related to the start and end date.
|
||||||
|
*
|
||||||
|
* @param Carbon $start
|
||||||
|
* @param Carbon $end
|
||||||
|
*
|
||||||
|
* @return Collection
|
||||||
|
*/
|
||||||
|
public function getAllAccounts(Carbon $start, Carbon $end);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This method returns all "income" journals in a certain period, which are both transfers from a shared account
|
* This method returns all "income" journals in a certain period, which are both transfers from a shared account
|
||||||
* and "ordinary" deposits. The query used is almost equal to ReportQueryInterface::journalsByRevenueAccount but it does
|
* and "ordinary" deposits. The query used is almost equal to ReportQueryInterface::journalsByRevenueAccount but it does
|
||||||
@ -103,4 +108,27 @@ interface ReportQueryInterface
|
|||||||
* @return Collection
|
* @return Collection
|
||||||
*/
|
*/
|
||||||
public function sharedExpensesByCategory(Carbon $start, Carbon $end);
|
public function sharedExpensesByCategory(Carbon $start, Carbon $end);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Grabs a summary of all expenses grouped by budget, related to the account.
|
||||||
|
*
|
||||||
|
* @param Account $account
|
||||||
|
* @param Carbon $start
|
||||||
|
* @param Carbon $end
|
||||||
|
*
|
||||||
|
* @return mixed
|
||||||
|
*/
|
||||||
|
public function getBudgetSummary(Account $account, Carbon $start, Carbon $end);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This method will get a list of all expenses in a certain time period that have no budget
|
||||||
|
* and are balanced by a transfer to make up for it.
|
||||||
|
*
|
||||||
|
* @param Account $account
|
||||||
|
* @param Carbon $start
|
||||||
|
* @param Carbon $end
|
||||||
|
*
|
||||||
|
* @return Collection
|
||||||
|
*/
|
||||||
|
public function balancedTransactionsList(Account $account, Carbon $start, Carbon $end);
|
||||||
}
|
}
|
@ -492,7 +492,7 @@ class GoogleChartController extends Controller
|
|||||||
} catch (Exception $e) {
|
} catch (Exception $e) {
|
||||||
return view('error')->with('message', 'Invalid year.');
|
return view('error')->with('message', 'Invalid year.');
|
||||||
}
|
}
|
||||||
$budgets = Auth::user()->budgets()->get();
|
$budgets = Auth::user()->budgets()->get();
|
||||||
$budgets->sortBy('name');
|
$budgets->sortBy('name');
|
||||||
$chart->addColumn('Month', 'date');
|
$chart->addColumn('Month', 'date');
|
||||||
foreach ($budgets as $budget) {
|
foreach ($budgets as $budget) {
|
||||||
|
@ -29,6 +29,82 @@ class ReportController extends Controller
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param string $year
|
||||||
|
* @param string $month
|
||||||
|
*
|
||||||
|
* @return \Illuminate\View\View
|
||||||
|
*/
|
||||||
|
public function budget($year = '2014', $month = '1', ReportQueryInterface $query)
|
||||||
|
{
|
||||||
|
try {
|
||||||
|
new Carbon($year . '-' . $month . '-01');
|
||||||
|
} catch (Exception $e) {
|
||||||
|
return view('error')->with('message', 'Invalid date');
|
||||||
|
}
|
||||||
|
$date = new Carbon($year . '-' . $month . '-01');
|
||||||
|
$start = clone $date;
|
||||||
|
$start->startOfMonth();
|
||||||
|
$end = clone $date;
|
||||||
|
$end->endOfMonth();
|
||||||
|
$start->subDay();
|
||||||
|
|
||||||
|
$dayEarly = clone $date;
|
||||||
|
$subTitle = 'Budget report for ' . $date->format('F Y');
|
||||||
|
$subTitleIcon = 'fa-calendar';
|
||||||
|
$dayEarly = $dayEarly->subDay();
|
||||||
|
$accounts = $query->getAllAccounts($start, $end);
|
||||||
|
|
||||||
|
$accounts->each(
|
||||||
|
function (Account $account) use ($start, $end, $query) {
|
||||||
|
$budgets = $query->getBudgetSummary($account, $start, $end);
|
||||||
|
$balancedAmount = $query->balancedTransactionsList($account, $start, $end);
|
||||||
|
$array = [];
|
||||||
|
foreach ($budgets as $budget) {
|
||||||
|
$id = intval($budget->id);
|
||||||
|
$data = $budget->toArray();
|
||||||
|
$array[$id] = $data;
|
||||||
|
}
|
||||||
|
$account->budgetInformation = $array;
|
||||||
|
$account->balancedAmount = $balancedAmount;
|
||||||
|
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
|
$start = clone $date;
|
||||||
|
$start->startOfMonth();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Start getBudgetsForMonth DONE
|
||||||
|
*/
|
||||||
|
$set = Auth::user()->budgets()
|
||||||
|
->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 amount']);
|
||||||
|
$budgets = Steam::makeArray($set);
|
||||||
|
$amountSet = $query->journalsByBudget($start, $end);
|
||||||
|
$amounts = Steam::makeArray($amountSet);
|
||||||
|
$budgets = Steam::mergeArrays($budgets, $amounts);
|
||||||
|
$budgets[0]['spent'] = isset($budgets[0]['spent']) ? $budgets[0]['spent'] : 0.0;
|
||||||
|
$budgets[0]['amount'] = isset($budgets[0]['amount']) ? $budgets[0]['amount'] : 0.0;
|
||||||
|
$budgets[0]['name'] = 'No budget';
|
||||||
|
|
||||||
|
// find transactions to shared expense accounts, which are without a budget by default:
|
||||||
|
$transfers = $query->sharedExpenses($start, $end);
|
||||||
|
foreach ($transfers as $transfer) {
|
||||||
|
$budgets[0]['spent'] += floatval($transfer->amount) * -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* End getBudgetsForMonth DONE
|
||||||
|
*/
|
||||||
|
|
||||||
|
return View::make('reports.budget', compact('subTitle', 'subTitleIcon', 'date', 'accounts', 'budgets', 'dayEarly'));
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param ReportHelperInterface $helper
|
* @param ReportHelperInterface $helper
|
||||||
@ -57,7 +133,7 @@ class ReportController extends Controller
|
|||||||
try {
|
try {
|
||||||
new Carbon($year . '-' . $month . '-01');
|
new Carbon($year . '-' . $month . '-01');
|
||||||
} catch (Exception $e) {
|
} catch (Exception $e) {
|
||||||
return View::make('error')->with('message', 'Invalid date.');
|
return view('error')->with('message', 'Invalid date.');
|
||||||
}
|
}
|
||||||
$date = new Carbon($year . '-' . $month . '-01');
|
$date = new Carbon($year . '-' . $month . '-01');
|
||||||
$subTitle = 'Report for ' . $date->format('F Y');
|
$subTitle = 'Report for ' . $date->format('F Y');
|
||||||
|
@ -5,7 +5,6 @@ namespace FireflyIII\Http\Middleware;
|
|||||||
|
|
||||||
use Carbon\Carbon;
|
use Carbon\Carbon;
|
||||||
use Closure;
|
use Closure;
|
||||||
use FireflyIII\Exception\FireflyException;
|
|
||||||
use Illuminate\Contracts\Auth\Guard;
|
use Illuminate\Contracts\Auth\Guard;
|
||||||
use Navigation;
|
use Navigation;
|
||||||
use Preferences;
|
use Preferences;
|
||||||
|
@ -3,9 +3,10 @@ use Carbon\Carbon;
|
|||||||
use DaveJamesMiller\Breadcrumbs\Generator;
|
use DaveJamesMiller\Breadcrumbs\Generator;
|
||||||
use FireflyIII\Exceptions\FireflyException;
|
use FireflyIII\Exceptions\FireflyException;
|
||||||
use FireflyIII\Models\Account;
|
use FireflyIII\Models\Account;
|
||||||
use FireflyIII\Models\Category;
|
|
||||||
use FireflyIII\Models\Budget;
|
use FireflyIII\Models\Budget;
|
||||||
|
use FireflyIII\Models\Category;
|
||||||
use FireflyIII\Models\LimitRepetition;
|
use FireflyIII\Models\LimitRepetition;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Back home.
|
* Back home.
|
||||||
*/
|
*/
|
||||||
@ -345,7 +346,7 @@ Breadcrumbs::register(
|
|||||||
Breadcrumbs::register(
|
Breadcrumbs::register(
|
||||||
'transactions.create', function (Generator $breadcrumbs, $what) {
|
'transactions.create', function (Generator $breadcrumbs, $what) {
|
||||||
$breadcrumbs->parent('transactions.index', $what);
|
$breadcrumbs->parent('transactions.index', $what);
|
||||||
$breadcrumbs->push('Create new ' .e($what), route('transactions.create', $what));
|
$breadcrumbs->push('Create new ' . e($what), route('transactions.create', $what));
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
|
@ -12,16 +12,15 @@ class AccountMeta extends Model
|
|||||||
{
|
{
|
||||||
|
|
||||||
use ValidatingTrait;
|
use ValidatingTrait;
|
||||||
|
protected $fillable = ['account_id', 'name', 'data'];
|
||||||
protected $rules
|
protected $rules
|
||||||
= [
|
= [
|
||||||
'account_id' => 'required|exists:accounts,id',
|
'account_id' => 'required|exists:accounts,id',
|
||||||
'name' => 'required|between:1,100',
|
'name' => 'required|between:1,100',
|
||||||
'data' => 'required'
|
'data' => 'required'
|
||||||
];
|
];
|
||||||
protected $table = 'account_meta';
|
protected $table = 'account_meta';
|
||||||
|
|
||||||
protected $fillable = ['account_id', 'name', 'data'];
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return \Illuminate\Database\Eloquent\Relations\BelongsTo
|
* @return \Illuminate\Database\Eloquent\Relations\BelongsTo
|
||||||
*/
|
*/
|
||||||
|
@ -1,9 +1,9 @@
|
|||||||
<?php namespace FireflyIII\Providers;
|
<?php namespace FireflyIII\Providers;
|
||||||
|
|
||||||
use FireflyIII\Models\Account;
|
use FireflyIII\Models\Account;
|
||||||
use FireflyIII\Models\Transaction;
|
|
||||||
use FireflyIII\Models\BudgetLimit;
|
use FireflyIII\Models\BudgetLimit;
|
||||||
use FireflyIII\Models\LimitRepetition;
|
use FireflyIII\Models\LimitRepetition;
|
||||||
|
use FireflyIII\Models\Transaction;
|
||||||
use FireflyIII\Models\TransactionJournal;
|
use FireflyIII\Models\TransactionJournal;
|
||||||
use FireflyIII\Support\Facades\Navigation;
|
use FireflyIII\Support\Facades\Navigation;
|
||||||
use Illuminate\Contracts\Events\Dispatcher as DispatcherContract;
|
use Illuminate\Contracts\Events\Dispatcher as DispatcherContract;
|
||||||
@ -11,7 +11,6 @@ use Illuminate\Database\QueryException;
|
|||||||
use Illuminate\Foundation\Support\Providers\EventServiceProvider as ServiceProvider;
|
use Illuminate\Foundation\Support\Providers\EventServiceProvider as ServiceProvider;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Class EventServiceProvider
|
* Class EventServiceProvider
|
||||||
*
|
*
|
||||||
@ -67,44 +66,44 @@ class EventServiceProvider extends ServiceProvider
|
|||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
BudgetLimit::saved(function(BudgetLimit $budgetLimit) {
|
BudgetLimit::saved(
|
||||||
|
function (BudgetLimit $budgetLimit) {
|
||||||
|
|
||||||
$end = Navigation::addPeriod(clone $budgetLimit->startdate, $budgetLimit->repeat_freq, 0);
|
$end = Navigation::addPeriod(clone $budgetLimit->startdate, $budgetLimit->repeat_freq, 0);
|
||||||
$end->subDay();
|
$end->subDay();
|
||||||
|
|
||||||
$set = $budgetLimit->limitrepetitions()->where('startdate', $budgetLimit->startdate->format('Y-m-d'))->where('enddate', $end->format('Y-m-d'))->get();
|
$set = $budgetLimit->limitrepetitions()->where('startdate', $budgetLimit->startdate->format('Y-m-d'))->where('enddate', $end->format('Y-m-d'))
|
||||||
/*
|
->get();
|
||||||
* Create new LimitRepetition:
|
/*
|
||||||
*/
|
* Create new LimitRepetition:
|
||||||
if ($set->count() == 0) {
|
*/
|
||||||
|
if ($set->count() == 0) {
|
||||||
|
|
||||||
$repetition = new LimitRepetition;
|
$repetition = new LimitRepetition;
|
||||||
$repetition->startdate = $budgetLimit->startdate;
|
$repetition->startdate = $budgetLimit->startdate;
|
||||||
$repetition->enddate = $end;
|
$repetition->enddate = $end;
|
||||||
$repetition->amount = $budgetLimit->amount;
|
$repetition->amount = $budgetLimit->amount;
|
||||||
$repetition->budgetLimit()->associate($budgetLimit);
|
$repetition->budgetLimit()->associate($budgetLimit);
|
||||||
|
|
||||||
try {
|
try {
|
||||||
$repetition->save();
|
$repetition->save();
|
||||||
} catch (QueryException $e) {
|
} catch (QueryException $e) {
|
||||||
\Log::error('Trying to save new LimitRepetition failed!');
|
\Log::error('Trying to save new LimitRepetition failed!');
|
||||||
\Log::error($e->getMessage());
|
\Log::error($e->getMessage());
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if ($set->count() == 1) {
|
if ($set->count() == 1) {
|
||||||
/*
|
/*
|
||||||
* Update existing one.
|
* Update existing one.
|
||||||
*/
|
*/
|
||||||
$repetition = $set->first();
|
$repetition = $set->first();
|
||||||
$repetition->amount = $budgetLimit->amount;
|
$repetition->amount = $budgetLimit->amount;
|
||||||
$repetition->save();
|
$repetition->save();
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -10,7 +10,8 @@ use Illuminate\Support\ServiceProvider;
|
|||||||
*
|
*
|
||||||
* @package FireflyIII\Providers
|
* @package FireflyIII\Providers
|
||||||
*/
|
*/
|
||||||
class TestingServiceProvider extends ServiceProvider {
|
class TestingServiceProvider extends ServiceProvider
|
||||||
|
{
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Register the service provider.
|
* Register the service provider.
|
||||||
@ -19,8 +20,7 @@ class TestingServiceProvider extends ServiceProvider {
|
|||||||
*/
|
*/
|
||||||
public function register()
|
public function register()
|
||||||
{
|
{
|
||||||
if ($this->app->environment() == 'testing')
|
if ($this->app->environment() == 'testing') {
|
||||||
{
|
|
||||||
$this->app['config']['session.driver'] = 'native';
|
$this->app['config']['session.driver'] = 'native';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -58,6 +58,7 @@ class BudgetRepository implements BudgetRepositoryInterface
|
|||||||
foreach ($set as $entry) {
|
foreach ($set as $entry) {
|
||||||
$items[] = $entry;
|
$items[] = $entry;
|
||||||
}
|
}
|
||||||
|
|
||||||
return new LengthAwarePaginator($items, $count, $take, $offset);
|
return new LengthAwarePaginator($items, $count, $take, $offset);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,9 +1,11 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
namespace FireflyIII\Repositories\Budget;
|
namespace FireflyIII\Repositories\Budget;
|
||||||
|
|
||||||
|
use Carbon\Carbon;
|
||||||
use FireflyIII\Models\Budget;
|
use FireflyIII\Models\Budget;
|
||||||
use FireflyIII\Models\LimitRepetition;
|
use FireflyIII\Models\LimitRepetition;
|
||||||
use Carbon\Carbon;
|
|
||||||
/**
|
/**
|
||||||
* Interface BudgetRepositoryInterface
|
* Interface BudgetRepositoryInterface
|
||||||
*
|
*
|
||||||
@ -44,7 +46,7 @@ interface BudgetRepositoryInterface
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* @param Budget $budget
|
* @param Budget $budget
|
||||||
* @param array $data
|
* @param array $data
|
||||||
*
|
*
|
||||||
* @return Budget
|
* @return Budget
|
||||||
*/
|
*/
|
||||||
@ -55,7 +57,7 @@ interface BudgetRepositoryInterface
|
|||||||
*
|
*
|
||||||
* @param Budget $budget
|
* @param Budget $budget
|
||||||
* @param LimitRepetition $repetition
|
* @param LimitRepetition $repetition
|
||||||
* @param int $take
|
* @param int $take
|
||||||
*
|
*
|
||||||
* @return \Illuminate\Pagination\Paginator
|
* @return \Illuminate\Pagination\Paginator
|
||||||
*/
|
*/
|
||||||
|
@ -1,7 +1,9 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
namespace FireflyIII\Repositories\Category;
|
namespace FireflyIII\Repositories\Category;
|
||||||
|
|
||||||
use FireflyIII\Models\Category;
|
use FireflyIII\Models\Category;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Interface CategoryRepositoryInterface
|
* Interface CategoryRepositoryInterface
|
||||||
*
|
*
|
||||||
@ -25,7 +27,7 @@ interface CategoryRepositoryInterface
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* @param Category $category
|
* @param Category $category
|
||||||
* @param array $data
|
* @param array $data
|
||||||
*
|
*
|
||||||
* @return Category
|
* @return Category
|
||||||
*/
|
*/
|
||||||
|
@ -37,14 +37,11 @@
|
|||||||
"codeception/codeception": "@stable",
|
"codeception/codeception": "@stable",
|
||||||
"codeception/c3": "@stable",
|
"codeception/c3": "@stable",
|
||||||
"league/factory-muffin": "~2.1",
|
"league/factory-muffin": "~2.1",
|
||||||
|
|
||||||
"codeception/phpbuiltinserver": "*",
|
"codeception/phpbuiltinserver": "*",
|
||||||
"codeception/specify": "*",
|
"codeception/specify": "*",
|
||||||
"codeception/verify": "*",
|
"codeception/verify": "*",
|
||||||
"fzaninotto/faker": "1.*",
|
"fzaninotto/faker": "1.*",
|
||||||
"codeclimate/php-test-reporter": "dev-master",
|
"codeclimate/php-test-reporter": "dev-master"
|
||||||
"janhenkgerritsen/codeception-laravel5": "~1.0"
|
|
||||||
|
|
||||||
|
|
||||||
},
|
},
|
||||||
"autoload": {
|
"autoload": {
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
@extends('layouts.default')
|
@extends('layouts.default')
|
||||||
@section('content')
|
@section('content')
|
||||||
{{ Breadcrumbs::renderIfExists(Route::getCurrentRoute()->getName(), $date) }}
|
{!! Breadcrumbs::renderIfExists(Route::getCurrentRoute()->getName(), $date) !!}
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col-lg-6 col-md-6 col-sm-12">
|
<div class="col-lg-6 col-md-6 col-sm-12">
|
||||||
<table class="table table-bordered table-striped">
|
<table class="table table-bordered table-striped">
|
||||||
@ -13,9 +13,9 @@
|
|||||||
@foreach($accounts as $account)
|
@foreach($accounts as $account)
|
||||||
<tr>
|
<tr>
|
||||||
<td><a href="{{route('accounts.show',$account->id)}}">{{{$account->name}}}</a></td>
|
<td><a href="{{route('accounts.show',$account->id)}}">{{{$account->name}}}</a></td>
|
||||||
<td>{{Amount::format($account->startBalance)}}</td>
|
<td>{!! Amount::format($account->startBalance) !!}</td>
|
||||||
<td>{{Amount::format($account->endBalance)}}</td>
|
<td>{!! Amount::format($account->endBalance) !!}</td>
|
||||||
<td>{{Amount::format($account->startBalance - $account->endBalance,false)}}</td>
|
<td>{!! Amount::format($account->startBalance - $account->endBalance,false) !!}</td>
|
||||||
</tr>
|
</tr>
|
||||||
@endforeach
|
@endforeach
|
||||||
</table>
|
</table>
|
||||||
@ -47,15 +47,15 @@
|
|||||||
<i class="fa fa-fw fa-question-circle" data-toggle="tooltip" data-placement="top" title="The calculation used here is slightly different from the row below. The numbers should match."></i>
|
<i class="fa fa-fw fa-question-circle" data-toggle="tooltip" data-placement="top" title="The calculation used here is slightly different from the row below. The numbers should match."></i>
|
||||||
@endif
|
@endif
|
||||||
</td>
|
</td>
|
||||||
<td>{{Amount::format($budget['amount'])}}</td>
|
<td>{!! Amount::format($budget['amount']) !!}</td>
|
||||||
<?php $spent = 0;?>
|
<?php $spent = 0;?>
|
||||||
@foreach($accounts as $account)
|
@foreach($accounts as $account)
|
||||||
@if(isset($account->budgetInformation[$id]))
|
@if(isset($account->budgetInformation[$id]))
|
||||||
<td>
|
<td>
|
||||||
@if($id == 0)
|
@if($id == 0)
|
||||||
<a href="#">{{Amount::format($account->budgetInformation[$id]['amount'])}}</a>
|
<a href="#">{!! Amount::format($account->budgetInformation[$id]['amount']) !!}</a>
|
||||||
@else
|
@else
|
||||||
{{Amount::format($account->budgetInformation[$id]['amount'])}}
|
{!! Amount::format($account->budgetInformation[$id]['amount']) !!}
|
||||||
@endif
|
@endif
|
||||||
</td>
|
</td>
|
||||||
<?php
|
<?php
|
||||||
@ -63,11 +63,11 @@
|
|||||||
$accountSums[$account->id] += floatval($account->budgetInformation[$id]['amount']);
|
$accountSums[$account->id] += floatval($account->budgetInformation[$id]['amount']);
|
||||||
?>
|
?>
|
||||||
@else
|
@else
|
||||||
<td>{{Amount::format(0)}}</td>
|
<td>{!! Amount::format(0) !!}</td>
|
||||||
@endif
|
@endif
|
||||||
@endforeach
|
@endforeach
|
||||||
<td>{{Amount::format($budget['amount'] + $budget['spent'])}}</td>
|
<td>{!! Amount::format($budget['amount'] + $budget['spent']) !!}</td>
|
||||||
<td>{{Amount::format($budget['amount'] + $spent)}}</td>
|
<td>{!! Amount::format($budget['amount'] + $spent) !!}</td>
|
||||||
</tr>
|
</tr>
|
||||||
@endforeach
|
@endforeach
|
||||||
<tr>
|
<tr>
|
||||||
@ -77,10 +77,10 @@
|
|||||||
@foreach($accounts as $account)
|
@foreach($accounts as $account)
|
||||||
@if(isset($account->budgetInformation[0]))
|
@if(isset($account->budgetInformation[0]))
|
||||||
<td>
|
<td>
|
||||||
<a href="#">{{Amount::format($account->budgetInformation[0]['amount'])}}</a>
|
<a href="#">{!! Amount::format($account->budgetInformation[0]['amount']) !!}</a>
|
||||||
</td>
|
</td>
|
||||||
@else
|
@else
|
||||||
<td>{{Amount::format(0)}}</td>
|
<td>{!! Amount::format(0) !!}</td>
|
||||||
@endif
|
@endif
|
||||||
@endforeach
|
@endforeach
|
||||||
<td colspan="2"> </td>
|
<td colspan="2"> </td>
|
||||||
@ -89,7 +89,7 @@
|
|||||||
<td colspan="2">Balanced by transfers</td>
|
<td colspan="2">Balanced by transfers</td>
|
||||||
@foreach($accounts as $account)
|
@foreach($accounts as $account)
|
||||||
<td>
|
<td>
|
||||||
<a href="#">{{Amount::format($account->balancedAmount)}}</a>
|
<a href="#">{!! Amount::format($account->balancedAmount) !!}</a>
|
||||||
</td>
|
</td>
|
||||||
@endforeach
|
@endforeach
|
||||||
<td colspan="2"> </td>
|
<td colspan="2"> </td>
|
||||||
@ -98,14 +98,14 @@
|
|||||||
<tr>
|
<tr>
|
||||||
<td colspan="2">Balancing transfers</td>
|
<td colspan="2">Balancing transfers</td>
|
||||||
@foreach($accounts as $account)
|
@foreach($accounts as $account)
|
||||||
<td>{{Amount::format(0)}}</td>
|
<td>{!! Amount::format(0) !!}</td>
|
||||||
@endforeach
|
@endforeach
|
||||||
<td colspan="2"> </td>
|
<td colspan="2"> </td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td colspan="2">Income</td>
|
<td colspan="2">Income</td>
|
||||||
@foreach($accounts as $account)
|
@foreach($accounts as $account)
|
||||||
<td>{{Amount::format(0)}}</td>
|
<td>{!! Amount::format(0) !!}</td>
|
||||||
@endforeach
|
@endforeach
|
||||||
<td colspan="2"> </td>
|
<td colspan="2"> </td>
|
||||||
</tr>
|
</tr>
|
||||||
@ -118,10 +118,10 @@
|
|||||||
?>
|
?>
|
||||||
@if(isset($account->budgetInformation[0]))
|
@if(isset($account->budgetInformation[0]))
|
||||||
<td>
|
<td>
|
||||||
<a href="#">{{Amount::format($account->budgetInformation[0]['amount'] + $account->balancedAmount)}}</a>
|
<a href="#">{!! Amount::format($account->budgetInformation[0]['amount'] + $account->balancedAmount) !!}</a>
|
||||||
</td>
|
</td>
|
||||||
@else
|
@else
|
||||||
<td>{{Amount::format(0)}}</td>
|
<td>{!! Amount::format(0) !!}</td>
|
||||||
@endif
|
@endif
|
||||||
@endforeach
|
@endforeach
|
||||||
<td colspan="2"> </td>
|
<td colspan="2"> </td>
|
||||||
@ -129,14 +129,14 @@
|
|||||||
<tr>
|
<tr>
|
||||||
<td colspan="2"><em>Sum</em></td>
|
<td colspan="2"><em>Sum</em></td>
|
||||||
@foreach($accounts as $account)
|
@foreach($accounts as $account)
|
||||||
<td>{{Amount::format($accountSums[$account->id])}}</td>
|
<td>{!! Amount::format($accountSums[$account->id]) !!}</td>
|
||||||
@endforeach
|
@endforeach
|
||||||
<td colspan="2"> </td>
|
<td colspan="2"> </td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td colspan="2">Expected balance</td>
|
<td colspan="2">Expected balance</td>
|
||||||
@foreach($accounts as $account)
|
@foreach($accounts as $account)
|
||||||
<td>{{Amount::format($account->startBalance + $accountSums[$account->id])}}</td>
|
<td>{!! Amount::format($account->startBalance + $accountSums[$account->id]) !!}</td>
|
||||||
@endforeach
|
@endforeach
|
||||||
<td colspan="2"> </td>
|
<td colspan="2"> </td>
|
||||||
</tr>
|
</tr>
|
||||||
@ -152,5 +152,5 @@
|
|||||||
|
|
||||||
@stop
|
@stop
|
||||||
@section('scripts')
|
@section('scripts')
|
||||||
{{HTML::script('assets/javascript/firefly/reports.js')}}
|
<script type="text/javascript" src="js/reports.js"></script>
|
||||||
@stop
|
@stop
|
||||||
|
Loading…
Reference in New Issue
Block a user