refs #265 for custom date

This commit is contained in:
cuneytsenturk 2018-11-05 13:38:28 +03:00
parent 9988d49f46
commit 209e4435e1

View File

@ -126,7 +126,6 @@ class Dashboard extends Controller
$start = Date::parse(request('start', $this->today->startOfYear()->format('Y-m-d'))); $start = Date::parse(request('start', $this->today->startOfYear()->format('Y-m-d')));
$end = Date::parse(request('end', $this->today->endOfYear()->format('Y-m-d'))); $end = Date::parse(request('end', $this->today->endOfYear()->format('Y-m-d')));
$period = request('period', 'month'); $period = request('period', 'month');
$range = request('range', 'custom');
$start_month = $start->month; $start_month = $start->month;
$end_month = $end->month; $end_month = $end->month;
@ -137,8 +136,11 @@ class Dashboard extends Controller
$s = clone $start; $s = clone $start;
if ($range == 'last_12_months') { if ($range == 'last_12_months') {
$end_month = 12; $end_month = 12;
$start_month = 1; $start_month = 0;
} elseif ($range == 'custom') {
$end_month = $end->diffInMonths($start);
$start_month = 0;
} }
for ($j = $end_month; $j >= $start_month; $j--) { for ($j = $end_month; $j >= $start_month; $j--) {