diff --git a/app/Http/Controllers/Api/V1/TimeEntryController.php b/app/Http/Controllers/Api/V1/TimeEntryController.php index e992fee4..35fc32a2 100644 --- a/app/Http/Controllers/Api/V1/TimeEntryController.php +++ b/app/Http/Controllers/Api/V1/TimeEntryController.php @@ -234,6 +234,7 @@ class TimeEntryController extends Controller $request = Gotenberg::chromium(config('services.gotenberg.url')) ->pdf() ->pdfa('PDF/A-3b') + ->margins(0.39, 0.78, 0.39, 0.39) ->paperSize('8.27', '11.7') // A4 ->footer(Stream::string('footer', $footerHtml)) ->html(Stream::string('body', $html)); @@ -411,6 +412,7 @@ class TimeEntryController extends Controller ->pdf() ->waitForExpression("window.status === 'ready'") ->pdfa('PDF/A-3b') + ->margins(0.39, 0.78, 0.39, 0.39) ->paperSize('8.27', '11.7') // A4 ->footer(Stream::string('footer', $footerHtml)) ->assets(Stream::path(resource_path('pdf-js/echarts.min.js'), 'echarts.min.js')) diff --git a/resources/views/reports/time-entry-aggregate/pdf-footer.blade.php b/resources/views/reports/time-entry-aggregate/pdf-footer.blade.php index 6328a646..fe125406 100644 --- a/resources/views/reports/time-entry-aggregate/pdf-footer.blade.php +++ b/resources/views/reports/time-entry-aggregate/pdf-footer.blade.php @@ -1,17 +1,20 @@ - - - - -

- Page of -

- + + + + +
+ Page of +
+ diff --git a/resources/views/reports/time-entry-aggregate/pdf.blade.php b/resources/views/reports/time-entry-aggregate/pdf.blade.php index c73fe780..dc0c304d 100644 --- a/resources/views/reports/time-entry-aggregate/pdf.blade.php +++ b/resources/views/reports/time-entry-aggregate/pdf.blade.php @@ -3,7 +3,8 @@ @use('PhpOffice\PhpSpreadsheet\Cell\DataType') @use('Carbon\CarbonInterval') @inject('interval', 'App\Service\IntervalService') - +@inject('colorService', 'App\Service\ColorService') + @@ -36,6 +37,13 @@ font-size: 24px; font-weight: bold; } + + .data-table { + break-after: auto; + } + .no-break { + break-after: avoid-page; + } +

Report


@@ -56,83 +65,141 @@ Total cost: {{ Money::of(BigDecimal::ofUnscaledValue($aggregatedData['cost'], 2)->__toString(), $currency)->formatTo('en_US') }}
-
+
+ +
@foreach($aggregatedData['grouped_data'] as $group1Entry) -

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

+
+

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

- - - - - - - - - - - @php - $counter = 1; - $totalDuration = 0; - $totalCost = 0; - @endphp - @foreach($group1Entry['grouped_data'] as $group2Entry) - @php - $duration = CarbonInterval::seconds($group2Entry['seconds']); - @endphp +
- {{ $subGroup->description() }} - - Duration - - Duration (decimal) - - Cost -
+ - - - - + + + + + + @php - $totalDuration += $group2Entry['seconds']; - $totalCost += $group2Entry['cost']; + $counter = 1; + $totalDuration = 0; + $totalCost = 0; @endphp - @endforeach - -
- {{ $group2Entry['description'] ?? $group2Entry['key'] ?? '-' }} - - {{ $interval->format($duration) }} - - {{ round($duration->totalHours, 2) }} - - {{ Money::of(BigDecimal::ofUnscaledValue($group2Entry['cost'], 2)->__toString(), $currency)->formatTo('en_US') }} - + {{ $subGroup->description() }} + + Duration + + Duration (decimal) + + Cost +
+ @foreach($group1Entry['grouped_data'] as $group2Entry) + @php + $duration = CarbonInterval::seconds($group2Entry['seconds']); + @endphp + + + {{ $group2Entry['description'] ?? $group2Entry['key'] ?? '-' }} + + + {{ $interval->format($duration) }} + + + {{ round($duration->totalHours, 2) }} + + + {{ Money::of(BigDecimal::ofUnscaledValue($group2Entry['cost'], 2)->__toString(), $currency)->formatTo('en_US') }} + + + @php + $totalDuration += $group2Entry['seconds']; + $totalCost += $group2Entry['cost']; + @endphp + @endforeach + + +
@endforeach diff --git a/resources/views/reports/time-entry-index/pdf-footer.blade.php b/resources/views/reports/time-entry-index/pdf-footer.blade.php index 6328a646..6a10f196 100644 --- a/resources/views/reports/time-entry-index/pdf-footer.blade.php +++ b/resources/views/reports/time-entry-index/pdf-footer.blade.php @@ -1,17 +1,20 @@ - - - - -

- Page of -

- + + + + +
+ Page of +
+