Release 1.20.1 (#3317)

- improved timesheet calculator with changesets and priority
- calculate and include exported stats (e.g. available in export templates)
- added hourly rate column to timesheet listing
This commit is contained in:
Kevin Papst
2022-05-21 13:13:56 +02:00
committed by GitHub
parent 3e6100f368
commit d5f8655827
15 changed files with 277 additions and 43 deletions

View File

@@ -11,6 +11,7 @@ namespace App\Export\Base;
use App\Activity\ActivityStatisticService;
use App\Invoice\InvoiceItemInterface;
use App\Model\TimesheetCountedStatistic;
use App\Project\ProjectStatisticService;
use App\Repository\Query\TimesheetQuery;
@@ -172,6 +173,7 @@ trait RendererTrait
{
$summary = [];
$projects = [];
$empty = new TimesheetCountedStatistic();
foreach ($exportItems as $exportItem) {
$customer = null;
@@ -183,15 +185,14 @@ trait RendererTrait
$customer = $project->getCustomer();
$customerId = $customer->getId();
$projectId = $project->getId();
if ($project->hasBudgets()) {
$projects[] = $project;
}
$projects[] = $project;
}
$id = $customerId . '_' . $projectId;
if (!isset($summary[$id])) {
$summary[$id] = [
'totals' => $empty->jsonSerialize(),
'time' => $project->getTimeBudget(),
'money' => $project->getBudget(),
'time_left' => null,
@@ -209,6 +210,8 @@ trait RendererTrait
foreach ($allBudgets as $projectId => $statisticModel) {
$project = $statisticModel->getProject();
$id = $project->getCustomer()->getId() . '_' . $projectId;
$total = $statisticModel->getStatisticTotal();
$summary[$id]['totals'] = $total->jsonSerialize();
if ($statisticModel->hasTimeBudget()) {
$summary[$id]['time_left'] = $statisticModel->getTimeBudgetOpenRelative();
$summary[$id]['time_left_total'] = $statisticModel->getTimeBudgetOpen();
@@ -255,6 +258,7 @@ trait RendererTrait
{
$summary = [];
$activities = [];
$empty = new TimesheetCountedStatistic();
foreach ($exportItems as $exportItem) {
$customerId = 'none';
@@ -270,9 +274,7 @@ trait RendererTrait
continue;
}
if ($activity->hasBudgets()) {
$activities[] = $activity;
}
$activities[] = $activity;
if (null !== ($project = $exportItem->getProject())) {
$projectId = $project->getId();
@@ -289,6 +291,7 @@ trait RendererTrait
if (!isset($summary[$id][$activityId])) {
$summary[$id][$activityId] = [
'totals' => $empty->jsonSerialize(),
'time' => $activity->getTimeBudget(),
'money' => $activity->getBudget(),
'time_left' => null,
@@ -306,6 +309,8 @@ trait RendererTrait
foreach ($allBudgets as $activityId => $statisticModel) {
$project = $statisticModel->getActivity()->getProject();
$id = $project->getCustomer()->getId() . '_' . $project->getId();
$total = $statisticModel->getStatisticTotal();
$summary[$id][$activityId]['totals'] = $total->jsonSerialize();
if ($statisticModel->hasTimeBudget()) {
$summary[$id][$activityId]['time_left'] = $statisticModel->getTimeBudgetOpenRelative();
$summary[$id][$activityId]['time_left_total'] = $statisticModel->getTimeBudgetOpen();