diff --git a/app/Helpers/Collection/Balance.php b/app/Helpers/Collection/Balance.php index cbafe987ce..34258fc88f 100644 --- a/app/Helpers/Collection/Balance.php +++ b/app/Helpers/Collection/Balance.php @@ -1,6 +1,7 @@ account = $account; } - /** - * @return float - */ - public function getSpent() - { - return $this->spent; - } - - /** - * @param float $spent - */ - public function setSpent($spent) - { - $this->spent = $spent; - } - /** * @return float */ @@ -73,7 +54,21 @@ class BalanceEntry $this->left = $left; } + /** + * @return float + */ + public function getSpent() + { + return $this->spent; + } + /** + * @param float $spent + */ + public function setSpent($spent) + { + $this->spent = $spent; + } } \ No newline at end of file diff --git a/app/Helpers/Collection/BalanceHeader.php b/app/Helpers/Collection/BalanceHeader.php index 3563420408..5c0f46c72a 100644 --- a/app/Helpers/Collection/BalanceHeader.php +++ b/app/Helpers/Collection/BalanceHeader.php @@ -43,5 +43,4 @@ class BalanceHeader } - } \ No newline at end of file diff --git a/app/Helpers/Collection/Bill.php b/app/Helpers/Collection/Bill.php index 973b886482..28a0036244 100644 --- a/app/Helpers/Collection/Bill.php +++ b/app/Helpers/Collection/Bill.php @@ -43,8 +43,9 @@ class Bill $this->bills->sortBy( function (BillLine $bill) { $active = intval($bill->getBill()->active) == 0 ? 1 : 0; - $name = $bill->getBill()->name; - return $active.$name; + $name = $bill->getBill()->name; + + return $active . $name; } ); diff --git a/app/Helpers/Collection/Budget.php b/app/Helpers/Collection/Budget.php index 7cd5e1f3fa..c551505b78 100644 --- a/app/Helpers/Collection/Budget.php +++ b/app/Helpers/Collection/Budget.php @@ -1,6 +1,7 @@ spent += floatval($add); } + /** + * @return \Illuminate\Support\Collection + */ + public function getBudgetLines() + { + return $this->budgetLines; + } + /** * @return float */ @@ -135,15 +144,5 @@ class Budget $this->spent = $spent; } - /** - * @return \Illuminate\Support\Collection - */ - public function getBudgetLines() - { - return $this->budgetLines; - } - - - } \ No newline at end of file diff --git a/app/Helpers/Collection/BudgetLine.php b/app/Helpers/Collection/BudgetLine.php index a950ed088f..7c5f48e16c 100644 --- a/app/Helpers/Collection/BudgetLine.php +++ b/app/Helpers/Collection/BudgetLine.php @@ -22,13 +22,13 @@ class BudgetLine protected $repetition; /** @var float */ - protected $budgeted = 0; + protected $budgeted = 0; /** @var float */ - protected $left = 0; + protected $left = 0; /** @var float */ protected $overspent = 0; /** @var float */ - protected $spent = 0; + protected $spent = 0; /** * @return BudgetModel @@ -127,8 +127,4 @@ class BudgetLine } - - - - } \ No newline at end of file diff --git a/app/Helpers/Report/ReportQuery.php b/app/Helpers/Report/ReportQuery.php index 63432c86f2..a2fd5ee077 100644 --- a/app/Helpers/Report/ReportQuery.php +++ b/app/Helpers/Report/ReportQuery.php @@ -113,7 +113,9 @@ class ReportQuery implements ReportQueryInterface $query->orderBy('transaction_journals.date'); // get everything - $data = $query->get(['transaction_journals.*', 'transaction_types.type', 'ac_to.name as name','ac_to.id as account_id', 'ac_to.encrypted as account_encrypted']); + $data = $query->get( + ['transaction_journals.*', 'transaction_types.type', 'ac_to.name as name', 'ac_to.id as account_id', 'ac_to.encrypted as account_encrypted'] + ); $data->each( function (TransactionJournal $journal) { @@ -285,7 +287,9 @@ class ReportQuery implements ReportQueryInterface $query->orderBy('transaction_journals.date'); // get everything - $data = $query->get(['transaction_journals.*', 'transaction_types.type', 'ac_from.name as name','ac_from.id as account_id', 'ac_from.encrypted as account_encrypted']); + $data = $query->get( + ['transaction_journals.*', 'transaction_types.type', 'ac_from.name as name', 'ac_from.id as account_id', 'ac_from.encrypted as account_encrypted'] + ); $data->each( function (TransactionJournal $journal) { diff --git a/app/Http/Controllers/BillController.php b/app/Http/Controllers/BillController.php index a2877aa940..a5ea27d221 100644 --- a/app/Http/Controllers/BillController.php +++ b/app/Http/Controllers/BillController.php @@ -7,7 +7,6 @@ use FireflyIII\Models\Account; use FireflyIII\Models\Bill; use FireflyIII\Models\Transaction; use FireflyIII\Models\TransactionJournal; -use FireflyIII\Repositories\Account\AccountRepositoryInterface; use FireflyIII\Repositories\Bill\BillRepositoryInterface; use Input; use Redirect; diff --git a/app/Http/Controllers/Chart/BudgetController.php b/app/Http/Controllers/Chart/BudgetController.php index 4de38a9199..d5ca79286c 100644 --- a/app/Http/Controllers/Chart/BudgetController.php +++ b/app/Http/Controllers/Chart/BudgetController.php @@ -28,7 +28,7 @@ class BudgetController extends Controller */ public function budget(GChart $chart, BudgetRepositoryInterface $repository, Budget $budget) { - $chart->addColumn(trans('firefly.period'),'date'); + $chart->addColumn(trans('firefly.period'), 'date'); $chart->addColumn(trans('firefly.spent'), 'number'); @@ -50,6 +50,7 @@ class BudgetController extends Controller } $chart->generate(); + return Response::json($chart->getData()); } diff --git a/app/Http/Controllers/Chart/CategoryController.php b/app/Http/Controllers/Chart/CategoryController.php index 29a3610556..b7c45506c1 100644 --- a/app/Http/Controllers/Chart/CategoryController.php +++ b/app/Http/Controllers/Chart/CategoryController.php @@ -4,7 +4,6 @@ namespace FireflyIII\Http\Controllers\Chart; use Carbon\Carbon; -use Crypt; use FireflyIII\Http\Controllers\Controller; use FireflyIII\Models\Category; use FireflyIII\Models\LimitRepetition; @@ -82,8 +81,8 @@ class CategoryController extends Controller foreach ($set as $entry) { $sum = floatval($entry['sum']); - if($sum != 0) { - $chart->addRow($entry['name'], $sum); + if ($sum != 0) { + $chart->addRow($entry['name'], $sum); } } diff --git a/app/Http/routes.php b/app/Http/routes.php index e232d5172f..1987fbd585 100644 --- a/app/Http/routes.php +++ b/app/Http/routes.php @@ -188,7 +188,7 @@ Route::get('/register', ['uses' => 'Auth\AuthController@getRegister', 'as' => 'r Route::controllers( [ - 'auth' => 'Auth\AuthController', + 'auth' => 'Auth\AuthController', 'password' => 'Auth\PasswordController', ] ); @@ -276,7 +276,9 @@ Route::group( */ // accounts: Route::get('/chart/account/frontpage', ['uses' => 'Chart\AccountController@frontpage']); - Route::get('/chart/account/month/{year}/{month}/{shared?}', ['uses' => 'Chart\AccountController@all'])->where(['year' => '[0-9]{4}', 'month' => '[0-9]{1,2}', 'shared' => 'shared']); + Route::get('/chart/account/month/{year}/{month}/{shared?}', ['uses' => 'Chart\AccountController@all'])->where( + ['year' => '[0-9]{4}', 'month' => '[0-9]{1,2}', 'shared' => 'shared'] + ); Route::get('/chart/account/{account}', ['uses' => 'Chart\AccountController@single']); diff --git a/app/Repositories/Account/AccountRepository.php b/app/Repositories/Account/AccountRepository.php index b5e7cfcd31..c8ff2053eb 100644 --- a/app/Repositories/Account/AccountRepository.php +++ b/app/Repositories/Account/AccountRepository.php @@ -306,7 +306,7 @@ class AccountRepository implements AccountRepositoryInterface /** * @param Account $account - * @param Carbon $date + * @param Carbon $date * * @return float */ diff --git a/app/Repositories/Account/AccountRepositoryInterface.php b/app/Repositories/Account/AccountRepositoryInterface.php index 1a25f120d5..605f8c15c2 100644 --- a/app/Repositories/Account/AccountRepositoryInterface.php +++ b/app/Repositories/Account/AccountRepositoryInterface.php @@ -115,7 +115,7 @@ interface AccountRepositoryInterface /** * @param Account $account - * @param Carbon $date + * @param Carbon $date * * @return float */ diff --git a/app/Repositories/Budget/BudgetRepository.php b/app/Repositories/Budget/BudgetRepository.php index 6a0dc8a9d8..3d35eff2a0 100644 --- a/app/Repositories/Budget/BudgetRepository.php +++ b/app/Repositories/Budget/BudgetRepository.php @@ -417,6 +417,7 @@ class BudgetRepository implements BudgetRepositoryInterface public function expensesOnDayCorrected(Budget $budget, Carbon $date) { $sum = floatval($budget->transactionjournals()->transactionTypes(['Withdrawal'])->onDate($date)->get(['transaction_journals.*'])->sum('amount')); + return $sum * -1; } } diff --git a/app/Repositories/Category/CategoryRepositoryInterface.php b/app/Repositories/Category/CategoryRepositoryInterface.php index 23425b5ff7..9f282c84fe 100644 --- a/app/Repositories/Category/CategoryRepositoryInterface.php +++ b/app/Repositories/Category/CategoryRepositoryInterface.php @@ -115,6 +115,7 @@ interface CategoryRepositoryInterface /** * * Corrected for tags. + * * @param Category $category * @param Carbon $date * diff --git a/app/Repositories/PiggyBank/PiggyBankRepository.php b/app/Repositories/PiggyBank/PiggyBankRepository.php index ab4ad796b3..cc847817b7 100644 --- a/app/Repositories/PiggyBank/PiggyBankRepository.php +++ b/app/Repositories/PiggyBank/PiggyBankRepository.php @@ -9,7 +9,6 @@ use FireflyIII\Models\PiggyBank; use FireflyIII\Models\PiggyBankEvent; use FireflyIII\Models\PiggyBankRepetition; use Illuminate\Support\Collection; -use Navigation; /** * Class PiggyBankRepository diff --git a/app/Support/ExpandedForm.php b/app/Support/ExpandedForm.php index 750a0edd84..e117e7ba1b 100644 --- a/app/Support/ExpandedForm.php +++ b/app/Support/ExpandedForm.php @@ -51,7 +51,8 @@ class ExpandedForm if (isset($options['label'])) { return $options['label']; } - return trans('form.'.$name); + + return trans('form.' . $name); } diff --git a/app/Support/Twig/Budget.php b/app/Support/Twig/Budget.php index 51f449a3bb..787f14bd39 100644 --- a/app/Support/Twig/Budget.php +++ b/app/Support/Twig/Budget.php @@ -41,15 +41,16 @@ class Budget extends Twig_Extension $functions[] = new Twig_SimpleFunction( 'spentInRepetitionCorrected', function (LimitRepetition $repetition) { - $sum = - Auth::user()->transactionjournals() - ->leftJoin('budget_transaction_journal', 'budget_transaction_journal.transaction_journal_id', '=', 'transaction_journals.id') - ->leftJoin('budget_limits', 'budget_limits.budget_id', '=', 'budget_transaction_journal.budget_id') - ->leftJoin('limit_repetitions', 'limit_repetitions.budget_limit_id', '=', 'budget_limits.id') - ->before($repetition->enddate) - ->after($repetition->startdate) - ->where('limit_repetitions.id', '=', $repetition->id) - ->get(['transaction_journals.*'])->sum('amount'); + $sum + = Auth::user()->transactionjournals() + ->leftJoin('budget_transaction_journal', 'budget_transaction_journal.transaction_journal_id', '=', 'transaction_journals.id') + ->leftJoin('budget_limits', 'budget_limits.budget_id', '=', 'budget_transaction_journal.budget_id') + ->leftJoin('limit_repetitions', 'limit_repetitions.budget_limit_id', '=', 'budget_limits.id') + ->before($repetition->enddate) + ->after($repetition->startdate) + ->where('limit_repetitions.id', '=', $repetition->id) + ->get(['transaction_journals.*'])->sum('amount'); + return floatval($sum); } ); diff --git a/app/Support/Twig/Journal.php b/app/Support/Twig/Journal.php index 299cdaf6d6..a77e29692b 100644 --- a/app/Support/Twig/Journal.php +++ b/app/Support/Twig/Journal.php @@ -85,6 +85,7 @@ class Journal extends Twig_Extension // return tag formatted for a "balancing act", even if other // tags are present. $amount = App::make('amount')->formatJournal($journal, false); + return ' ' . $tag->tag . ''; } @@ -94,6 +95,7 @@ class Journal extends Twig_Extension */ if ($tag->tagMode == 'advancePayment' && $journal->transactionType->type == 'Deposit') { $amount = App::make('amount')->formatJournal($journal, false); + return ' ' . $tag->tag . ''; } @@ -103,6 +105,7 @@ class Journal extends Twig_Extension */ if ($tag->tagMode == 'advancePayment' && $journal->transactionType->type == 'Withdrawal') { $amount = App::make('amount')->formatJournal($journal); + return '' . $amount . ''; }