Firefly III: a personal finances manager
PHP accountingbudgetbudgetingbudgetscash-flowcashflowcredit-carddockerexpensesfinancefinancesfinanciallinuxmoneypaycheckpersonal-financephpphp7
Implemented some todo's.
James Colef0f965421c00
diff --git a/app/controllers/TransactionController.php b/app/controllers/TransactionController.phpindex 048c470ce5..1f5caa78f6 100644--- a/app/controllers/TransactionController.php+++ b/app/controllers/TransactionController.php@@ -277,6 +277,21 @@ class TransactionController extends BaseController*/public function show(TransactionJournal $journal){+ $journal->transactions->each(+ function(\Transaction $t) use ($journal) {+ $t->before = floatval(+ $t->account->transactions()->leftJoin(+ 'transaction_journals', 'transaction_journals.id', '=', 'transactions.transaction_journal_id'+ )->where('transaction_journals.date', '<=', $journal->date->format('Y-m-d'))->where(+ 'transaction_journals.created_at', '<=', $journal->created_at->format('Y-m-d H:i:s')+ )->where('transaction_journals.id', '!=', $journal->id)->sum('transactions.amount')+ );+ $t->after = $t->before + $t->amount;+ }+ );+++return View::make('transactions.show')->with('journal', $journal)->with('subTitle', $journal->transactionType->type . ' "' . $journal->description . '"');diff --git a/app/models/Account.php b/app/models/Account.phpindex ad6f210b67..63f6790b48 100644--- a/app/models/Account.php+++ b/app/models/Account.php@@ -66,26 +66,6 @@ class Account extends Ardent{return $this->hasMany('Transaction');}-- /**- *- * TODO remove this method in favour of something in the FireflyIII libraries.- *- * @param TransactionJournal $journal- *- * @return float- */- public function balanceBeforeJournal(TransactionJournal $journal)- {- return floatval(- $this->transactions()->leftJoin(- 'transaction_journals', 'transaction_journals.id', '=', 'transactions.transaction_journal_id'- )->where('transaction_journals.date', '<=', $journal->date->format('Y-m-d'))->where(- 'transaction_journals.created_at', '<=', $journal->created_at->format('Y-m-d H:i:s')- )->where('transaction_journals.id', '!=', $journal->id)->sum('transactions.amount')- );- }-/*** TODO remove this method in favour of something in the FireflyIII libraries.*diff --git a/app/views/reminders/show.blade.php b/app/views/reminders/show.blade.phpindex 34d02d9865..0b12c927c5 100644--- a/app/views/reminders/show.blade.php+++ b/app/views/reminders/show.blade.php@@ -19,7 +19,6 @@@endif</p><p>- <!-- TODO implement all options --><a href="{{route('reminders.act',$reminder->id)}}" class="btn btn-primary"><i class="fa fa-fw fa-thumbs-o-up"></i> I want to do this</a><a href="{{route('reminders.dismiss',$reminder->id)}}" class="btn btn-success"><i class="fa fa-smile-o fa-fw"></i> I already did this</a><a href="{{route('reminders.dismiss',$reminder->id)}}" class="btn btn-danger"><i class="fa fa-fw fa-clock-o"></i> Not this time</a>diff --git a/app/views/transactions/show.blade.php b/app/views/transactions/show.blade.phpindex b4c3eb5414..3339468ef4 100644--- a/app/views/transactions/show.blade.php+++ b/app/views/transactions/show.blade.php@@ -74,7 +74,7 @@</tr><tr><td>New balance</td>- <td>{{mf($t->account->balanceBeforeJournal($journal))}} → {{mf($t->account->balanceBeforeJournal($journal) + $t->amount)}}</td>+ <td>{{mf($t->before)}} → {{mf($t->after)}}</td></tr>@if(!is_null($t->description))<tr>diff --git a/bootstrap/start.php b/bootstrap/start.phpindex 3f375d48cf..e05212f1db 100644--- a/bootstrap/start.php+++ b/bootstrap/start.php@@ -115,4 +115,6 @@ Event::subscribe('FireflyIII\Event\TransactionJournal');// see if the various has-many-throughs actually get used.// set very tight rules on all models// create custom uniquely rules.+// TODO add "Create new X" button to any list there is: categories, accounts, piggies, etc.+// TODO Install PHP5 and code thing and create very small methods.return $app;diff --git a/public/assets/javascript/firefly/gcharts.js b/public/assets/javascript/firefly/gcharts.jsindex 3636599c68..c0bc5dd090 100644--- a/public/assets/javascript/firefly/gcharts.js+++ b/public/assets/javascript/firefly/gcharts.js@@ -1,9 +1,6 @@google.load('visualization', '1.1', {'packages': ['corechart', 'bar', 'sankey', 'table']});-/*-TODO manage the combination of default options AND custom options.- */-function googleLineChart(URL, container) {+function googleLineChart(URL, container, options) {if ($('#' + container).length == 1) {$.getJSON(URL).success(function (data) {/*@@ -31,7 +28,7 @@ function googleLineChart(URL, container) {/*Draw it:*/- chart.draw(gdata, defaultLineChartOptions);+ chart.draw(gdata, options || defaultLineChartOptions);}).fail(function () {$('#' + container).addClass('google-chart-error');@@ -41,7 +38,7 @@ function googleLineChart(URL, container) {}}-function googleBarChart(URL, container) {+function googleBarChart(URL, container, options) {if ($('#' + container).length == 1) {$.getJSON(URL).success(function (data) {/*@@ -69,7 +66,7 @@ function googleBarChart(URL, container) {/*Draw it:*/- chart.draw(gdata, defaultBarChartOptions);+ chart.draw(gdata, options || defaultBarChartOptions);}).fail(function () {$('#' + container).addClass('google-chart-error');@@ -79,7 +76,7 @@ function googleBarChart(URL, container) {}}-function googleColumnChart(URL, container) {+function googleColumnChart(URL, container, options) {if ($('#' + container).length == 1) {$.getJSON(URL).success(function (data) {/*@@ -106,7 +103,7 @@ function googleColumnChart(URL, container) {/*Draw it:*/- chart.draw(gdata, defaultColumnChartOptions);+ chart.draw(gdata, options || defaultColumnChartOptions);}).fail(function () {$('#' + container).addClass('google-chart-error');@@ -116,7 +113,7 @@ function googleColumnChart(URL, container) {}}-function googleStackedColumnChart(URL, container) {+function googleStackedColumnChart(URL, container, options) {if ($('#' + container).length == 1) {$.getJSON(URL).success(function (data) {/*@@ -143,7 +140,7 @@ function googleStackedColumnChart(URL, container) {/*Draw it:*/- chart.draw(gdata, defaultStackedColumnChartOptions);+ chart.draw(gdata, options || defaultStackedColumnChartOptions);}).fail(function () {$('#' + container).addClass('google-chart-error');@@ -153,7 +150,7 @@ function googleStackedColumnChart(URL, container) {}}-function googleComboChart(URL, container) {+function googleComboChart(URL, container, options) {if ($('#' + container).length == 1) {$.getJSON(URL).success(function (data) {/*@@ -180,7 +177,7 @@ function googleComboChart(URL, container) {/*Draw it:*/- chart.draw(gdata, defaultComboChartOptions);+ chart.draw(gdata, options || defaultComboChartOptions);}).fail(function () {$('#' + container).addClass('google-chart-error');@@ -190,7 +187,7 @@ function googleComboChart(URL, container) {}}-function googlePieChart(URL, container) {+function googlePieChart(URL, container, options) {if ($('#' + container).length == 1) {$.getJSON(URL).success(function (data) {/*@@ -218,7 +215,7 @@ function googlePieChart(URL, container) {/*Draw it:*/- chart.draw(gdata, defaultPieChartOptions);+ chart.draw(gdata, options || defaultPieChartOptions);}).fail(function () {$('#' + container).addClass('google-chart-error');@@ -228,7 +225,7 @@ function googlePieChart(URL, container) {}}-function googleSankeyChart(URL, container) {+function googleSankeyChart(URL, container, options) {if ($('#' + container).length == 1) {$.getJSON(URL).success(function (data) {/*@@ -258,7 +255,7 @@ function googleSankeyChart(URL, container) {/*Draw it:*/- chart.draw(gdata, defaultSankeyChartOptions);+ chart.draw(gdata, options || defaultSankeyChartOptions);}).fail(function () {$('#' + container).addClass('google-chart-error');diff --git a/public/index.php b/public/index.phpindex c4f34cbfec..50f994dcdc 100644--- a/public/index.php+++ b/public/index.php@@ -20,9 +20,7 @@require __DIR__.'/../bootstrap/autoload.php';-/*- * TODO: add "Create new X" button to any list there is: categories, accounts, piggies, etc.- */+/*|--------------------------------------------------------------------------