@extends('layouts.app', ['title' => 'Urlaubskonten']) @section('content') @php function secondsToTime($totalSeconds) { $sign = $totalSeconds < 0 ? '-' : ''; $totalSeconds = abs($totalSeconds); $hours = floor($totalSeconds / 3600); $minutes = floor(($totalSeconds % 3600) / 60); return $sign . sprintf('%02d:%02d', $hours, $minutes); } function hoursToSeconds($hours) { return $hours * 3600; } function convertDecimalToHHMM($decimalHours) { $decimalHours = str_replace(',', '.', $decimalHours); $isNegative = $decimalHours < 0; $decimalHours = abs($decimalHours); $hours = floor($decimalHours); $minutes = ($decimalHours - $hours) * 60; $result = sprintf('%02d:%02d', $hours, $minutes); return $isNegative ? '-' . $result : $result; } function convertHMToHours($time) { [$hours, $minutes] = explode(':', $time); return str_replace('.', ',', number_format($hours + $minutes / 60, 2)); } function convertSecondsToHours($seconds) { return str_replace('.', ',', number_format($seconds / 3600, 2)); } @endphp
{{-- Header --}}

Urlaubskonten

{{-- Tabelle --}}
@php $groupedEmployees = $employees->pluck('fk_employee_id')->unique(); @endphp @foreach($department as $item) @php $startDate = Carbon\Carbon::parse($ddate)->startOfMonth(); $endDate = Carbon\Carbon::parse($ddate)->endOfMonth(); @endphp @foreach($item->get_employee->where('has_time_recording', '1') as $iteme) @if($iteme->contract && $iteme->contract->get_days) @php $got_vacations = 0; for ( $start = Carbon\Carbon::parse('2025-01')->startOfMonth(); $start <= Carbon\Carbon::parse($ddate)->endOfMonth(); $start->addDay() ) { $isVacationDay = $Vacations ->where('is_accepted', '1') ->where('fk_employee_id', $iteme->employee_id) ->where('date_from', '<=', $start->toDateString()) ->where('date_to', '>=', $start->toDateString()) ->count(); $isWorkDay = $iteme->contract->get_days[strtolower($start->format('l'))] > 0; $isHoliday = in_array($start->toDateString(), $holidays->pluck('date')->toArray()); if ($isVacationDay && $isWorkDay && !$isHoliday) { $got_vacations += 1; } } $vorjahr = $iteme->contract->get_days->last_year_vacation_rest; $anspruch = $iteme->contract->get_days->vacation_entitlement; $rest = $vorjahr + $anspruch - $got_vacations; @endphp @else @endif @endforeach @endforeach
Mitarbeiter Vorjahr Anspruch Genommen Rest
{{ $item->name }}
{{ $iteme->first_name }} {{ $iteme->last_name }} {{ $vorjahr }} T {{ $anspruch }} T {{ $got_vacations }} T @if($rest > 5) {{ $rest }} T @elseif($rest > 0) {{ $rest }} T @else {{ $rest }} T @endif
{{ $iteme->first_name }} {{ $iteme->last_name }} Kein Vertrag angelegt
@endsection