allow custom export repositories (#2182)

This commit is contained in:
Kevin Papst
2020-12-10 15:00:14 +01:00
committed by GitHub
parent c3fe8d1c39
commit 7a3388646b
18 changed files with 320 additions and 72 deletions

View File

@@ -46,6 +46,8 @@ trait RendererTrait
}
$id = $customerId . '_' . $projectId;
$type = $exportItem->getType();
$category = $exportItem->getCategory();
if (!isset($summary[$id])) {
$summary[$id] = [
@@ -56,6 +58,24 @@ trait RendererTrait
'rate' => 0,
'rate_internal' => 0,
'duration' => 0,
'type' => [],
'types' => [],
];
}
if (!isset($summary[$id]['type'][$type])) {
$summary[$id]['type'][$type] = [
'rate' => 0,
'rate_internal' => 0,
'duration' => 0,
];
}
if (!isset($summary[$id]['types'][$type][$category])) {
$summary[$id]['types'][$type][$category] = [
'rate' => 0,
'rate_internal' => 0,
'duration' => 0,
];
}
@@ -75,12 +95,23 @@ trait RendererTrait
}
$summary[$id]['rate'] += $exportItem->getRate();
$summary[$id]['type'][$type]['rate'] += $exportItem->getRate();
$summary[$id]['types'][$type][$category]['rate'] += $exportItem->getRate();
if (method_exists($exportItem, 'getInternalRate')) {
$summary[$id]['rate_internal'] += $exportItem->getInternalRate();
$summary[$id]['type'][$type]['rate_internal'] += $exportItem->getInternalRate();
$summary[$id]['types'][$type][$category]['rate_internal'] += $exportItem->getInternalRate();
} else {
$summary[$id]['rate_internal'] += $exportItem->getRate();
$summary[$id]['type'][$type]['rate_internal'] += $exportItem->getRate();
$summary[$id]['types'][$type][$category]['rate_internal'] += $exportItem->getRate();
}
$summary[$id]['duration'] += $duration;
$summary[$id]['type'][$type]['duration'] += $duration;
$summary[$id]['types'][$type][$category]['duration'] += $duration;
$summary[$id]['activities'][$activityId]['rate'] += $exportItem->getRate();
$summary[$id]['activities'][$activityId]['duration'] += $duration;
}