@use('Brick\Math\BigDecimal') @use('PhpOffice\PhpSpreadsheet\Cell\DataType') @use('Carbon\CarbonInterval') @inject('interval', 'App\Service\IntervalService') Report

Report

{{ $start->format('Y-m-d') }} - {{ $end->format('Y-m-d') }}

Duration: {{ $interval->format(CarbonInterval::seconds($aggregatedData['seconds'])) }}
Total cost: {{ round(BigDecimal::ofUnscaledValue($aggregatedData['cost'], 2)->toFloat(), 2) }}
@foreach($aggregatedData['grouped_data'] as $group1Entry)

{{ $group->description() }}: {{ $group1Entry['description'] ?? $group1Entry['key'] ?? '-' }}

@php $counter = 1; $totalDuration = 0; $totalCost = 0; @endphp @foreach($group1Entry['grouped_data'] as $group2Entry) @php $duration = CarbonInterval::seconds($group2Entry['seconds']); @endphp @php $totalDuration += $group2Entry['seconds']; $totalCost += $group2Entry['cost']; @endphp @endforeach
{{ $subGroup->description() }} Duration Duration (decimal) Amount ({{ Str::upper($currency) }})
{{ $group2Entry['description'] ?? $group2Entry['key'] ?? '-' }} {{ $interval->format($duration) }} {{ round($duration->totalHours, 2) }} {{ round(BigDecimal::ofUnscaledValue($group2Entry['cost'], 2)->toFloat(), 2) }}
@endforeach