Some changes in the charts and range thing.

This commit is contained in:
James Cole
2014-07-08 07:51:25 +02:00
parent c7d3ef6a97
commit 5e8cfb512b
7 changed files with 96 additions and 11 deletions

View File

@@ -2,6 +2,7 @@
use Carbon\Carbon as Carbon;
use Firefly\Storage\Account\AccountRepositoryInterface as ARI;
use Firefly\Helper\Toolkit\Toolkit as tk;
class ChartController extends BaseController
{
@@ -16,17 +17,16 @@ class ChartController extends BaseController
/**
* Show home charts.
*/
public function home($account = null)
public function homeAccount($account = null)
{
list($start,$end) = tk::getDateRange();
$current = clone $start;
// chart
$chart = App::make('gchart');
$chart->addColumn('Day of the month', 'date');
// date
$today = new Carbon;
$past = clone $today;
$past->subMonth();
$current = clone $past;
if (is_null($account)) {
// get accounts:
@@ -36,7 +36,7 @@ class ChartController extends BaseController
$chart->addColumn($account->name, 'number');
}
while ($current <= $today) {
while ($current <= $end) {
$row = [clone $current];
// loop accounts:
@@ -52,7 +52,7 @@ class ChartController extends BaseController
return View::make('error')->with('message', 'No account found.');
}
$chart->addColumn($account->name, 'number');
while ($current <= $today) {
while ($current <= $end) {
$row = [clone $current, $account->balance(clone $current)];
$current->addDay();
$chart->addRowArray($row);