new user-year reporting and data-type chooser (#3155)

This commit is contained in:
Kevin Papst
2022-02-16 12:18:04 +01:00
committed by GitHub
parent 1852d71974
commit 85a63c4b78
58 changed files with 1862 additions and 683 deletions

View File

@@ -0,0 +1,121 @@
<?php
/*
* This file is part of the Kimai time-tracking app.
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace App\Controller\Reporting;
use App\Controller\AbstractController;
use App\Entity\User;
use App\Model\DailyStatistic;
use App\Model\DateStatisticInterface;
use App\Model\Statistic\StatisticDate;
use App\Repository\ActivityRepository;
use App\Repository\ProjectRepository;
use App\Timesheet\TimesheetStatisticService;
use DateTime;
abstract class AbstractUserReportController extends AbstractController
{
protected $statisticService;
private $projectRepository;
private $activityRepository;
public function __construct(TimesheetStatisticService $statisticService, ProjectRepository $projectRepository, ActivityRepository $activityRepository)
{
$this->statisticService = $statisticService;
$this->projectRepository = $projectRepository;
$this->activityRepository = $activityRepository;
}
protected function canSelectUser(): bool
{
// also found in App\EventSubscriber\Actions\UserSubscriber
if (!$this->isGranted('view_other_timesheet') || !$this->isGranted('view_other_reporting')) {
return false;
}
return true;
}
protected function getStatisticDataRaw(DateTime $begin, DateTime $end, User $user): array
{
return $this->statisticService->getDailyStatisticsGrouped($begin, $end, [$user]);
}
protected function createStatisticModel(DateTime $begin, DateTime $end, User $user): DateStatisticInterface
{
return new DailyStatistic($begin, $end, $user);
}
protected function prepareReport(DateTime $begin, DateTime $end, User $user): array
{
$data = $this->getStatisticDataRaw($begin, $end, $user);
$data = array_pop($data);
$projectIds = [];
$activityIds = [];
foreach ($data as $projectId => $projectValues) {
$projectIds[$projectId] = $projectId;
$dailyProjectStatistic = $this->createStatisticModel($begin, $end, $user);
foreach ($projectValues['activities'] as $activityId => $activityValues) {
$activityIds[$activityId] = $activityId;
if (!isset($data[$projectId]['duration'])) {
$data[$projectId]['duration'] = 0;
}
if (!isset($data[$projectId]['rate'])) {
$data[$projectId]['rate'] = 0.0;
}
if (!isset($data[$projectId]['internalRate'])) {
$data[$projectId]['internalRate'] = 0.0;
}
if (!isset($data[$projectId]['activities'][$activityId]['duration'])) {
$data[$projectId]['activities'][$activityId]['duration'] = 0;
}
if (!isset($data[$projectId]['activities'][$activityId]['rate'])) {
$data[$projectId]['activities'][$activityId]['rate'] = 0.0;
}
if (!isset($data[$projectId]['activities'][$activityId]['internalRate'])) {
$data[$projectId]['activities'][$activityId]['internalRate'] = 0.0;
}
/** @var StatisticDate $date */
foreach ($activityValues['data']->getData() as $date) {
$statisticDate = $dailyProjectStatistic->getByDateTime($date->getDate());
$statisticDate->setTotalDuration($statisticDate->getTotalDuration() + $date->getTotalDuration());
$statisticDate->setTotalRate($statisticDate->getTotalRate() + $date->getTotalRate());
$statisticDate->setTotalInternalRate($statisticDate->getTotalInternalRate() + $date->getTotalInternalRate());
$data[$projectId]['duration'] = $data[$projectId]['duration'] + $date->getTotalDuration();
$data[$projectId]['rate'] = $data[$projectId]['rate'] + $date->getTotalRate();
$data[$projectId]['internalRate'] = $data[$projectId]['internalRate'] + $date->getTotalInternalRate();
$data[$projectId]['activities'][$activityId]['duration'] = $data[$projectId]['activities'][$activityId]['duration'] + $date->getTotalDuration();
$data[$projectId]['activities'][$activityId]['rate'] = $data[$projectId]['activities'][$activityId]['rate'] + $date->getTotalRate();
$data[$projectId]['activities'][$activityId]['internalRate'] = $data[$projectId]['activities'][$activityId]['internalRate'] + $date->getTotalInternalRate();
}
}
$data[$projectId]['data'] = $dailyProjectStatistic;
}
$activities = $this->activityRepository->findByIds($activityIds);
foreach ($activities as $activity) {
$activityIds[$activity->getId()] = $activity;
}
foreach ($data as $projectId => $projectValues) {
foreach ($projectValues['activities'] as $activityId => $activityValues) {
$data[$projectId]['activities'][$activityId]['activity'] = $activityIds[$activityId];
}
}
$projects = $this->projectRepository->findByIds($projectIds);
foreach ($projects as $project) {
$data[$project->getId()]['project'] = $project;
}
return $data;
}
}

View File

@@ -1,243 +0,0 @@
<?php
/*
* This file is part of the Kimai time-tracking app.
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace App\Controller\Reporting;
use App\Controller\AbstractController;
use App\Entity\User;
use App\Model\DailyStatistic;
use App\Model\Statistic\StatisticDate;
use App\Reporting\MonthByUser;
use App\Reporting\MonthByUserForm;
use App\Reporting\WeekByUser;
use App\Reporting\WeekByUserForm;
use App\Repository\ActivityRepository;
use App\Repository\ProjectRepository;
use App\Timesheet\TimesheetStatisticService;
use DateTime;
use Exception;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Security;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\Routing\Annotation\Route;
use Symfony\Component\Security\Core\Exception\AccessDeniedException;
/**
* @Route(path="/reporting")
* @Security("is_granted('view_reporting')")
*/
final class ReportByUserController extends AbstractController
{
private $statisticService;
private $projectRepository;
private $activityRepository;
public function __construct(TimesheetStatisticService $statisticService, ProjectRepository $projectRepository, ActivityRepository $activityRepository)
{
$this->statisticService = $statisticService;
$this->projectRepository = $projectRepository;
$this->activityRepository = $activityRepository;
}
private function canSelectUser(): bool
{
// also found in App\EventSubscriber\Actions\UserSubscriber
if (!$this->isGranted('view_other_timesheet') || !$this->isGranted('view_other_reporting')) {
return false;
}
return true;
}
/**
* @Route(path="/month_by_user", name="report_user_month", methods={"GET","POST"})
*
* @param Request $request
* @return Response
* @throws Exception
*/
public function monthByUser(Request $request): Response
{
$currentUser = $this->getUser();
$dateTimeFactory = $this->getDateTimeFactory($currentUser);
$canChangeUser = $this->canSelectUser();
$values = new MonthByUser();
$values->setUser($currentUser);
$values->setDate($dateTimeFactory->getStartOfMonth());
$form = $this->createForm(MonthByUserForm::class, $values, [
'include_user' => $canChangeUser,
'timezone' => $dateTimeFactory->getTimezone()->getName(),
'start_date' => $values->getDate(),
]);
$form->submit($request->query->all(), false);
if ($values->getUser() === null) {
$values->setUser($currentUser);
}
if ($currentUser !== $values->getUser() && !$canChangeUser) {
throw new AccessDeniedException('User is not allowed to see other users timesheet');
}
if ($values->getDate() === null) {
$values->setDate($dateTimeFactory->getStartOfMonth());
}
$start = $values->getDate();
$start->modify('first day of 00:00:00');
$end = clone $start;
$end->modify('last day of 23:59:59');
$selectedUser = $values->getUser();
$previousMonth = clone $start;
$previousMonth->modify('-1 month');
$nextMonth = clone $start;
$nextMonth->modify('+1 month');
$data = $this->prepareReport($start, $end, $selectedUser);
return $this->render('reporting/report_by_user.html.twig', [
'report_title' => 'report_user_month',
'box_id' => 'user-month-reporting-box',
'form' => $form->createView(),
'rows' => $data,
'days' => new DailyStatistic($start, $end, $selectedUser),
'user' => $selectedUser,
'current' => $start,
'next' => $nextMonth,
'previous' => $previousMonth,
]);
}
/**
* @Route(path="/week_by_user", name="report_user_week", methods={"GET","POST"})
*
* @param Request $request
* @return Response
* @throws Exception
*/
public function weekByUser(Request $request): Response
{
$currentUser = $this->getUser();
$dateTimeFactory = $this->getDateTimeFactory($currentUser);
$canChangeUser = $this->canSelectUser();
$values = new WeekByUser();
$values->setUser($currentUser);
$values->setDate($dateTimeFactory->getStartOfWeek());
$form = $this->createForm(WeekByUserForm::class, $values, [
'include_user' => $canChangeUser,
'timezone' => $dateTimeFactory->getTimezone()->getName(),
'start_date' => $values->getDate(),
]);
$form->submit($request->query->all(), false);
if ($values->getUser() === null) {
$values->setUser($currentUser);
}
if ($currentUser !== $values->getUser() && !$canChangeUser) {
throw new AccessDeniedException('User is not allowed to see other users timesheet');
}
if ($values->getDate() === null) {
$values->setDate($dateTimeFactory->getStartOfWeek());
}
$start = $dateTimeFactory->getStartOfWeek($values->getDate());
$end = $dateTimeFactory->getEndOfWeek($values->getDate());
$selectedUser = $values->getUser();
$previous = clone $start;
$previous->modify('-1 week');
$next = clone $start;
$next->modify('+1 week');
$data = $this->prepareReport($start, $end, $selectedUser);
return $this->render('reporting/report_by_user.html.twig', [
'report_title' => 'report_user_week',
'box_id' => 'user-week-reporting-box',
'form' => $form->createView(),
'days' => new DailyStatistic($start, $end, $selectedUser),
'rows' => $data,
'user' => $selectedUser,
'current' => $start,
'next' => $next,
'previous' => $previous,
]);
}
private function prepareReport(DateTime $begin, DateTime $end, User $user): array
{
$data = $this->statisticService->getDailyStatisticsGrouped($begin, $end, [$user]);
$data = array_pop($data);
$projectIds = [];
$activityIds = [];
foreach ($data as $projectId => $projectValues) {
$projectIds[$projectId] = $projectId;
$dailyProjectStatistic = new DailyStatistic($begin, $end, $user);
foreach ($projectValues['activities'] as $activityId => $activityValues) {
$activityIds[$activityId] = $activityId;
if (!isset($data[$projectId]['duration'])) {
$data[$projectId]['duration'] = 0;
}
if (!isset($data[$projectId]['rate'])) {
$data[$projectId]['rate'] = 0.0;
}
if (!isset($data[$projectId]['activities'][$activityId]['duration'])) {
$data[$projectId]['activities'][$activityId]['duration'] = 0;
}
if (!isset($data[$projectId]['activities'][$activityId]['rate'])) {
$data[$projectId]['activities'][$activityId]['rate'] = 0.0;
}
/** @var StatisticDate $day */
foreach ($activityValues['days']->getDays() as $day) {
$statDay = $dailyProjectStatistic->getDayByDateTime($day->getDate());
$statDay->setTotalDuration($statDay->getTotalDuration() + $day->getDuration());
$statDay->setTotalRate($statDay->getTotalRate() + $day->getRate());
$data[$projectId]['duration'] = $data[$projectId]['duration'] + $day->getDuration();
$data[$projectId]['rate'] = $data[$projectId]['rate'] + $day->getRate();
$data[$projectId]['activities'][$activityId]['duration'] = $data[$projectId]['activities'][$activityId]['duration'] + $day->getDuration();
$data[$projectId]['activities'][$activityId]['rate'] = $data[$projectId]['activities'][$activityId]['rate'] + $day->getRate();
}
}
$data[$projectId]['days'] = $dailyProjectStatistic;
}
$activities = $this->activityRepository->findByIds($activityIds);
foreach ($activities as $activity) {
$activityIds[$activity->getId()] = $activity;
}
foreach ($data as $projectId => $projectValues) {
foreach ($projectValues['activities'] as $activityId => $activityValues) {
$data[$projectId]['activities'][$activityId]['activity'] = $activityIds[$activityId];
}
}
$projects = $this->projectRepository->findByIds($projectIds);
foreach ($projects as $project) {
$data[$project->getId()]['project'] = $project;
}
return $data;
}
}

View File

@@ -25,13 +25,13 @@ use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\Routing\Annotation\Route;
/**
* @Route(path="/reporting")
* @Route(path="/reporting/users")
* @Security("is_granted('view_reporting') and is_granted('view_other_reporting') and is_granted('view_other_timesheet')")
*/
final class ReportUsersMonthController extends AbstractController
{
/**
* @Route(path="/monthly_users_list", name="report_monthly_users", methods={"GET","POST"})
* @Route(path="/month", name="report_monthly_users", methods={"GET","POST"})
*/
public function report(Request $request, TimesheetStatisticService $statisticService, UserRepository $userRepository): Response
{
@@ -42,7 +42,7 @@ final class ReportUsersMonthController extends AbstractController
}
/**
* @Route(path="/export/monthly_users_list", name="report_monthly_users_export", methods={"GET","POST"})
* @Route(path="/month_export", name="report_monthly_users_export", methods={"GET","POST"})
*/
public function export(Request $request, TimesheetStatisticService $statisticService, UserRepository $userRepository): Response
{
@@ -53,7 +53,7 @@ final class ReportUsersMonthController extends AbstractController
$reader = new Html();
$spreadsheet = $reader->loadFromString($content);
$writer = new BinaryFileResponseWriter(new XlsxWriter(), 'kimai-export-users-weekly');
$writer = new BinaryFileResponseWriter(new XlsxWriter(), 'kimai-export-users-monthly');
return $writer->getFileResponse($spreadsheet);
}
@@ -110,6 +110,8 @@ final class ReportUsersMonthController extends AbstractController
}
return [
'period_attribute' => 'days',
'dataType' => $values->getSumType(),
'report_title' => 'report_monthly_users',
'box_id' => 'monthly-user-list-reporting-box',
'export_route' => 'report_monthly_users_export',

View File

@@ -25,13 +25,13 @@ use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\Routing\Annotation\Route;
/**
* @Route(path="/reporting")
* @Route(path="/reporting/users")
* @Security("is_granted('view_reporting') and is_granted('view_other_reporting') and is_granted('view_other_timesheet')")
*/
final class ReportUsersWeekController extends AbstractController
{
/**
* @Route(path="/weekly_users_list", name="report_weekly_users", methods={"GET","POST"})
* @Route(path="/week", name="report_weekly_users", methods={"GET","POST"})
*/
public function report(Request $request, TimesheetStatisticService $statisticService, UserRepository $userRepository): Response
{
@@ -42,7 +42,7 @@ final class ReportUsersWeekController extends AbstractController
}
/**
* @Route(path="/export/weekly_users_list", name="report_weekly_users_export", methods={"GET","POST"})
* @Route(path="/week_export", name="report_weekly_users_export", methods={"GET","POST"})
*/
public function export(Request $request, TimesheetStatisticService $statisticService, UserRepository $userRepository): Response
{
@@ -107,6 +107,8 @@ final class ReportUsersWeekController extends AbstractController
}
return [
'period_attribute' => 'days',
'dataType' => $values->getSumType(),
'report_title' => 'report_weekly_users',
'box_id' => 'weekly-user-list-reporting-box',
'export_route' => 'report_weekly_users_export',

View File

@@ -27,13 +27,13 @@ use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\Routing\Annotation\Route;
/**
* @Route(path="/reporting")
* @Route(path="/reporting/users")
* @Security("is_granted('view_reporting') and is_granted('view_other_reporting') and is_granted('view_other_timesheet')")
*/
final class ReportUsersYearController extends AbstractController
{
/**
* @Route(path="/yearly_users_list", name="report_yearly_users", methods={"GET","POST"})
* @Route(path="/year", name="report_yearly_users", methods={"GET","POST"})
*
* @param Request $request
* @return Response
@@ -48,7 +48,7 @@ final class ReportUsersYearController extends AbstractController
}
/**
* @Route(path="/export/yearly_users_list", name="report_yearly_users_export", methods={"GET","POST"})
* @Route(path="/year_export", name="report_yearly_users_export", methods={"GET","POST"})
*
* @param Request $request
* @return Response
@@ -118,6 +118,9 @@ final class ReportUsersYearController extends AbstractController
}
return [
'query' => $values,
'period_attribute' => 'months',
'dataType' => $values->getSumType(),
'report_title' => 'report_yearly_users',
'box_id' => 'yearly-user-list-reporting-box',
'export_route' => 'report_yearly_users_export',

View File

@@ -0,0 +1,101 @@
<?php
/*
* This file is part of the Kimai time-tracking app.
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace App\Controller\Reporting;
use App\Entity\User;
use App\Model\DailyStatistic;
use App\Reporting\MonthByUser;
use App\Reporting\MonthByUserForm;
use Exception;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Security;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\Routing\Annotation\Route;
use Symfony\Component\Security\Core\Exception\AccessDeniedException;
/**
* @Route(path="/reporting/user")
* @Security("is_granted('view_reporting')")
*/
final class UserMonthController extends AbstractUserReportController
{
/**
* @Route(path="/month", name="report_user_month", methods={"GET","POST"})
*
* @param Request $request
* @return Response
* @throws Exception
*/
public function monthByUser(Request $request): Response
{
return $this->render('reporting/report_by_user.html.twig', $this->getData($request));
}
private function getData(Request $request): array
{
$currentUser = $this->getUser();
$dateTimeFactory = $this->getDateTimeFactory($currentUser);
$canChangeUser = $this->canSelectUser();
$values = new MonthByUser();
$values->setUser($currentUser);
$values->setDate($dateTimeFactory->getStartOfMonth());
$form = $this->createForm(MonthByUserForm::class, $values, [
'include_user' => $canChangeUser,
'timezone' => $dateTimeFactory->getTimezone()->getName(),
'start_date' => $values->getDate(),
]);
$form->submit($request->query->all(), false);
if ($values->getUser() === null) {
$values->setUser($currentUser);
}
if ($currentUser !== $values->getUser() && !$canChangeUser) {
throw new AccessDeniedException('User is not allowed to see other users timesheet');
}
if ($values->getDate() === null) {
$values->setDate($dateTimeFactory->getStartOfMonth());
}
$start = $values->getDate();
$start->modify('first day of 00:00:00');
$end = clone $start;
$end->modify('last day of 23:59:59');
$selectedUser = $values->getUser();
$previousMonth = clone $start;
$previousMonth->modify('-1 month');
$nextMonth = clone $start;
$nextMonth->modify('+1 month');
$data = $this->prepareReport($start, $end, $selectedUser);
return [
'decimal' => $values->isDecimal(),
'dataType' => $values->getSumType(),
'report_title' => 'report_user_month',
'box_id' => 'user-month-reporting-box',
'form' => $form->createView(),
'rows' => $data,
'period' => new DailyStatistic($start, $end, $selectedUser),
'user' => $selectedUser,
'current' => $start,
'next' => $nextMonth,
'previous' => $previousMonth,
];
}
}

View File

@@ -0,0 +1,97 @@
<?php
/*
* This file is part of the Kimai time-tracking app.
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace App\Controller\Reporting;
use App\Entity\User;
use App\Model\DailyStatistic;
use App\Reporting\WeekByUser;
use App\Reporting\WeekByUserForm;
use Exception;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Security;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\Routing\Annotation\Route;
use Symfony\Component\Security\Core\Exception\AccessDeniedException;
/**
* @Route(path="/reporting/user")
* @Security("is_granted('view_reporting')")
*/
final class UserWeekController extends AbstractUserReportController
{
/**
* @Route(path="/week", name="report_user_week", methods={"GET","POST"})
*
* @param Request $request
* @return Response
* @throws Exception
*/
public function weekByUser(Request $request): Response
{
return $this->render('reporting/report_by_user.html.twig', $this->getData($request));
}
private function getData(Request $request): array
{
$currentUser = $this->getUser();
$dateTimeFactory = $this->getDateTimeFactory($currentUser);
$canChangeUser = $this->canSelectUser();
$values = new WeekByUser();
$values->setUser($currentUser);
$values->setDate($dateTimeFactory->getStartOfWeek());
$form = $this->createForm(WeekByUserForm::class, $values, [
'include_user' => $canChangeUser,
'timezone' => $dateTimeFactory->getTimezone()->getName(),
'start_date' => $values->getDate(),
]);
$form->submit($request->query->all(), false);
if ($values->getUser() === null) {
$values->setUser($currentUser);
}
if ($currentUser !== $values->getUser() && !$canChangeUser) {
throw new AccessDeniedException('User is not allowed to see other users timesheet');
}
if ($values->getDate() === null) {
$values->setDate($dateTimeFactory->getStartOfWeek());
}
$start = $dateTimeFactory->getStartOfWeek($values->getDate());
$end = $dateTimeFactory->getEndOfWeek($values->getDate());
$selectedUser = $values->getUser();
$previous = clone $start;
$previous->modify('-1 week');
$next = clone $start;
$next->modify('+1 week');
$data = $this->prepareReport($start, $end, $selectedUser);
return [
'decimal' => $values->isDecimal(),
'dataType' => $values->getSumType(),
'report_title' => 'report_user_week',
'box_id' => 'user-week-reporting-box',
'form' => $form->createView(),
'period' => new DailyStatistic($start, $end, $selectedUser),
'rows' => $data,
'user' => $selectedUser,
'current' => $start,
'next' => $next,
'previous' => $previous,
];
}
}

View File

@@ -0,0 +1,109 @@
<?php
/*
* This file is part of the Kimai time-tracking app.
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace App\Controller\Reporting;
use App\Entity\User;
use App\Model\DateStatisticInterface;
use App\Model\MonthlyStatistic;
use App\Reporting\YearByUser;
use App\Reporting\YearByUserForm;
use DateTime;
use Exception;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Security;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\Routing\Annotation\Route;
use Symfony\Component\Security\Core\Exception\AccessDeniedException;
/**
* @Route(path="/reporting/user")
* @Security("is_granted('view_reporting')")
*/
final class UserYearController extends AbstractUserReportController
{
/**
* @Route(path="/year", name="report_user_year", methods={"GET","POST"})
*
* @param Request $request
* @return Response
* @throws Exception
*/
public function yearByUser(Request $request): Response
{
return $this->render('reporting/report_by_user_year.html.twig', $this->getData($request));
}
private function getData(Request $request): array
{
$currentUser = $this->getUser();
$dateTimeFactory = $this->getDateTimeFactory($currentUser);
$canChangeUser = $this->canSelectUser();
$values = new YearByUser();
$values->setUser($currentUser);
$values->setDate($dateTimeFactory->createStartOfYear());
$form = $this->createForm(YearByUserForm::class, $values, [
'include_user' => $canChangeUser,
'timezone' => $dateTimeFactory->getTimezone()->getName(),
'start_date' => $values->getDate(),
]);
$form->submit($request->query->all(), false);
if ($values->getUser() === null) {
$values->setUser($currentUser);
}
if ($currentUser !== $values->getUser() && !$canChangeUser) {
throw new AccessDeniedException('User is not allowed to see other users timesheet');
}
if ($values->getDate() === null) {
$values->setDate($dateTimeFactory->createStartOfYear());
}
$start = $dateTimeFactory->createStartOfYear($values->getDate());
$end = $dateTimeFactory->createEndOfYear($values->getDate());
$selectedUser = $values->getUser();
$previous = clone $start;
$previous->modify('-1 year');
$next = clone $start;
$next->modify('+1 year');
$data = $this->prepareReport($start, $end, $selectedUser);
return [
'decimal' => $values->isDecimal(),
'dataType' => $values->getSumType(),
'report_title' => 'report_user_year',
'box_id' => 'user-year-reporting-box',
'form' => $form->createView(),
'period' => new MonthlyStatistic($start, $end, $selectedUser),
'rows' => $data,
'user' => $selectedUser,
'current' => $start,
'next' => $next,
'previous' => $previous,
];
}
protected function getStatisticDataRaw(DateTime $begin, DateTime $end, User $user): array
{
return $this->statisticService->getMonthlyStatisticsGrouped($begin, $end, [$user]);
}
protected function createStatisticModel(DateTime $begin, DateTime $end, User $user): DateStatisticInterface
{
return new MonthlyStatistic($begin, $end, $user);
}
}