added search modal for timesheet export (#2728)
This commit is contained in:
@@ -706,36 +706,43 @@ abstract class AbstractSpreadsheetRenderer
|
||||
$entryHeaderRow++;
|
||||
}
|
||||
|
||||
if (null !== $durationColumn) {
|
||||
$startCoordinate = $sheet->getCellByColumnAndRow($durationColumn, 2)->getCoordinate();
|
||||
$endCoordinate = $sheet->getCellByColumnAndRow($durationColumn, $entryHeaderRow - 1)->getCoordinate();
|
||||
$this->setDurationTotal($sheet, $durationColumn, $entryHeaderRow, $startCoordinate, $endCoordinate);
|
||||
$style = $sheet->getStyleByColumnAndRow($durationColumn, $entryHeaderRow);
|
||||
$style->getBorders()->getTop()->setBorderStyle(Border::BORDER_THIN);
|
||||
$style->getFont()->setBold(true);
|
||||
}
|
||||
if ($this->isTotalRowSupported()) {
|
||||
if (null !== $durationColumn) {
|
||||
$startCoordinate = $sheet->getCellByColumnAndRow($durationColumn, 2)->getCoordinate();
|
||||
$endCoordinate = $sheet->getCellByColumnAndRow($durationColumn, $entryHeaderRow - 1)->getCoordinate();
|
||||
$this->setDurationTotal($sheet, $durationColumn, $entryHeaderRow, $startCoordinate, $endCoordinate);
|
||||
$style = $sheet->getStyleByColumnAndRow($durationColumn, $entryHeaderRow);
|
||||
$style->getBorders()->getTop()->setBorderStyle(Border::BORDER_THIN);
|
||||
$style->getFont()->setBold(true);
|
||||
}
|
||||
|
||||
if (null !== $rateColumn) {
|
||||
$startCoordinate = $sheet->getCellByColumnAndRow($rateColumn, 2)->getCoordinate();
|
||||
$endCoordinate = $sheet->getCellByColumnAndRow($rateColumn, $entryHeaderRow - 1)->getCoordinate();
|
||||
$this->setRateTotal($sheet, $rateColumn, $entryHeaderRow, $startCoordinate, $endCoordinate);
|
||||
$style = $sheet->getStyleByColumnAndRow($rateColumn, $entryHeaderRow);
|
||||
$style->getBorders()->getTop()->setBorderStyle(Border::BORDER_THIN);
|
||||
$style->getFont()->setBold(true);
|
||||
}
|
||||
if (null !== $rateColumn) {
|
||||
$startCoordinate = $sheet->getCellByColumnAndRow($rateColumn, 2)->getCoordinate();
|
||||
$endCoordinate = $sheet->getCellByColumnAndRow($rateColumn, $entryHeaderRow - 1)->getCoordinate();
|
||||
$this->setRateTotal($sheet, $rateColumn, $entryHeaderRow, $startCoordinate, $endCoordinate);
|
||||
$style = $sheet->getStyleByColumnAndRow($rateColumn, $entryHeaderRow);
|
||||
$style->getBorders()->getTop()->setBorderStyle(Border::BORDER_THIN);
|
||||
$style->getFont()->setBold(true);
|
||||
}
|
||||
|
||||
if (null !== $internalRateColumn) {
|
||||
$startCoordinate = $sheet->getCellByColumnAndRow($internalRateColumn, 2)->getCoordinate();
|
||||
$endCoordinate = $sheet->getCellByColumnAndRow($internalRateColumn, $entryHeaderRow - 1)->getCoordinate();
|
||||
$this->setRateTotal($sheet, $internalRateColumn, $entryHeaderRow, $startCoordinate, $endCoordinate);
|
||||
$style = $sheet->getStyleByColumnAndRow($internalRateColumn, $entryHeaderRow);
|
||||
$style->getBorders()->getTop()->setBorderStyle(Border::BORDER_THIN);
|
||||
$style->getFont()->setBold(true);
|
||||
if (null !== $internalRateColumn) {
|
||||
$startCoordinate = $sheet->getCellByColumnAndRow($internalRateColumn, 2)->getCoordinate();
|
||||
$endCoordinate = $sheet->getCellByColumnAndRow($internalRateColumn, $entryHeaderRow - 1)->getCoordinate();
|
||||
$this->setRateTotal($sheet, $internalRateColumn, $entryHeaderRow, $startCoordinate, $endCoordinate);
|
||||
$style = $sheet->getStyleByColumnAndRow($internalRateColumn, $entryHeaderRow);
|
||||
$style->getBorders()->getTop()->setBorderStyle(Border::BORDER_THIN);
|
||||
$style->getFont()->setBold(true);
|
||||
}
|
||||
}
|
||||
|
||||
return $spreadsheet;
|
||||
}
|
||||
|
||||
protected function isTotalRowSupported(): bool
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param ExportItemInterface[] $exportItems
|
||||
* @param TimesheetQuery $query
|
||||
|
||||
@@ -167,7 +167,9 @@ trait RendererTrait
|
||||
}
|
||||
}
|
||||
|
||||
$allBudgets = $projectStatisticService->getBudgetStatisticModelForProjects($projects, $query->getEnd());
|
||||
$today = $this->getToday($query);
|
||||
|
||||
$allBudgets = $projectStatisticService->getBudgetStatisticModelForProjects($projects, $today);
|
||||
|
||||
foreach ($allBudgets as $projectId => $statisticModel) {
|
||||
$project = $statisticModel->getProject();
|
||||
@@ -183,6 +185,29 @@ trait RendererTrait
|
||||
return $summary;
|
||||
}
|
||||
|
||||
private function getToday(TimesheetQuery $query): \DateTime
|
||||
{
|
||||
$end = $query->getEnd();
|
||||
|
||||
if ($end !== null) {
|
||||
return $end;
|
||||
}
|
||||
|
||||
if ($query->getCurrentUser() !== null) {
|
||||
$timezone = $query->getCurrentUser()->getTimezone();
|
||||
|
||||
return new \DateTime('now', new \DateTimeZone($timezone));
|
||||
}
|
||||
|
||||
if ($query->getUser() !== null) {
|
||||
$timezone = $query->getUser()->getTimezone();
|
||||
|
||||
return new \DateTime('now', new \DateTimeZone($timezone));
|
||||
}
|
||||
|
||||
return new \DateTime();
|
||||
}
|
||||
|
||||
/**
|
||||
* @param ExportItemInterface[] $exportItems
|
||||
* @param TimesheetQuery $query
|
||||
@@ -236,7 +261,9 @@ trait RendererTrait
|
||||
}
|
||||
}
|
||||
|
||||
$allBudgets = $activityStatisticService->getBudgetStatisticModelForActivities($activities, $query->getEnd());
|
||||
$today = $this->getToday($query);
|
||||
|
||||
$allBudgets = $activityStatisticService->getBudgetStatisticModelForActivities($activities, $today);
|
||||
|
||||
foreach ($allBudgets as $activityId => $statisticModel) {
|
||||
$project = $statisticModel->getActivity()->getProject();
|
||||
|
||||
@@ -15,6 +15,11 @@ use PhpOffice\PhpSpreadsheet\Style\Alignment;
|
||||
|
||||
class XlsxRenderer extends AbstractSpreadsheetRenderer
|
||||
{
|
||||
protected function isTotalRowSupported(): bool
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
public function getFileExtension(): string
|
||||
{
|
||||
return '.xlsx';
|
||||
|
||||
Reference in New Issue
Block a user