@use('App\Enums\ExportFormat') @use('Brick\Math\BigDecimal') @use('PhpOffice\PhpSpreadsheet\Cell\DataType') @use('PhpOffice\PhpSpreadsheet\Style\NumberFormat') @use('Carbon\CarbonInterval') @use('App\Enums\TimeEntryAggregationType') @inject('interval', 'App\Service\IntervalService') @php $counter = 1; $totalDuration = 0; $totalCost = 0; @endphp @foreach($data['grouped_data'] as $group1Entry) @foreach($group1Entry['grouped_data'] as $group2Entry) @php $duration = CarbonInterval::seconds($group2Entry['seconds']); @endphp @if($exportFormat === ExportFormat::ODS || $exportFormat === ExportFormat::CSV) @if ($group === TimeEntryAggregationType::Billable) @else @endif @if ($subGroup === TimeEntryAggregationType::Billable) @else @endif @else @if ($group === TimeEntryAggregationType::Billable) @else @endif @if ($subGroup === TimeEntryAggregationType::Billable) @else @endif @endif @php ++$counter; $totalDuration += $group2Entry['seconds']; $totalCost += $group2Entry['cost']; @endphp @endforeach @endforeach @php $totalDurationInterval = CarbonInterval::seconds($totalDuration); @endphp @if($exportFormat === ExportFormat::ODS || $exportFormat === ExportFormat::CSV) @else @endif
{{ $group->description() }} {{ $subGroup->description() }} Duration Duration (decimal) Amount ({{ Str::upper($currency) }})
{{ $group1Entry['key'] ? 'Yes' : 'No' }} {{ $group1Entry['description'] ?? $group1Entry['key'] ?? '-' }} {{ $group2Entry['key'] ? 'Yes' : 'No' }} {{ $group2Entry['description'] ?? $group2Entry['key'] ?? '-' }} {{ $interval->format($duration) }} {{ round($duration->totalHours, 2) }} {{ round(BigDecimal::ofUnscaledValue($group2Entry['cost'], 2)->toFloat(), 2) }} {{ $group1Entry['key'] ? 'Yes' : 'No' }} {{ $group1Entry['description'] ?? $group1Entry['key'] ?? '-' }} {{ $group2Entry['key'] ? 'Yes' : 'No' }} {{ $group2Entry['description'] ?? $group2Entry['key'] ?? '-' }} {{ $duration->totalDays }} {{ $duration->totalHours }} {{ BigDecimal::ofUnscaledValue($group2Entry['cost'], 2)->__toString() }}
Total {{ $interval->format($totalDurationInterval) }} {{ round($totalDurationInterval->totalHours, 2) }} {{ round(BigDecimal::ofUnscaledValue($totalCost, 2)->toFloat(), 2) }} @if($counter > 1) =SUM(C2:C{{ $counter }}) @else =0 @endif @if($counter > 1) =SUM(D2:D{{ $counter }}) @else =0 @endif @if($counter > 1) =SUM(E2:E{{ $counter }}) @else =0 @endif