Multi year was not visible.

This commit is contained in:
James Cole
2016-11-09 21:46:32 +01:00
parent 3600e1b5e7
commit 8583b574ac

View File

@@ -35,15 +35,17 @@ class ReportGeneratorFactory
public static function reportGenerator(string $type, Carbon $start, Carbon $end): ReportGeneratorInterface public static function reportGenerator(string $type, Carbon $start, Carbon $end): ReportGeneratorInterface
{ {
$period = 'Month'; $period = 'Month';
// more than one year date difference means multi year report.
if ($start->diffInMonths($end) > 12) {
$period = 'MultiYear';
}
// more than two months date difference means year report. // more than two months date difference means year report.
if ($start->diffInMonths($end) > 1) { if ($start->diffInMonths($end) > 1) {
$period = 'Year'; $period = 'Year';
} }
// more than one year date difference means multi year report.
if ($start->diffInMonths($end) > 12) {
$period = 'MultiYear';
}
$class = sprintf('FireflyIII\Generator\Report\%s\%sReportGenerator', $type, $period); $class = sprintf('FireflyIII\Generator\Report\%s\%sReportGenerator', $type, $period);
if (class_exists($class)) { if (class_exists($class)) {
/** @var ReportGeneratorInterface $obj */ /** @var ReportGeneratorInterface $obj */