@extends('layouts.app', ['title' => 'MitarbeiterAnzeig']) @section('content') {{-- new-urlaubstage --}} @if (session('msg'))

{{ session('msg') }}

@endif

Urlaubskonto {{ now()->year }}


@if (Auth::user()->get_employee->contract)
Vorjahr Resturlaub: {{ Auth::user()->get_employee->contract->get_days->last_year_vacation_rest }}
Urlaubsanspruch: {{ Auth::user()->get_employee->contract->get_days->vacation_entitlement }}
Gesamt Urlaubsanspruch: {{ Auth::user()->get_employee->contract->get_days->vacation_entitlement + Auth::user()->get_employee->contract->get_days->last_year_vacation_rest }}
{{--
bewilligte Urlaubstage : {{ Auth::user()->get_employee->contract->get_days->vacation_taken }}
--}}
genommen Urlaubstage : {{-- {{ $Vacation_all->where('is_closed', '==', '1')->where('is_accepted', '==', '1')->where('date_from', '<=', now()->toDateString())->sum('days_number') }} --}} @php $yearStart = Carbon\Carbon::now()->startOfYear(); $got_vacations = 0; $Vacations_manual_days_sum_all = $Vacation_all ->where('is_accepted', '1') ->whereNotNull('manual_days') ->where('date_from', '>=', $yearStart->toDateString()) ->where('date_to', '<=', Carbon\Carbon::parse($ddate)->endOfMonth()) ->sum('manual_days'); for ( $start = Carbon\Carbon::now()->startOfYear(); $start <= now()->toDateString(); $start->addDay() ) { $isVacationDay = $Vacation_all ->where('is_accepted', '1') ->where('date_from', '<=', $start->toDateString()) ->where('date_to', '>=', $start->toDateString()) ->count(); $isWorkDay = Auth::user()->get_employee->contract->get_days[ strtolower($start->format('l')) ] > 0; $isHoliday = in_array($start->toDateString(), $holidays->pluck('date')->toArray()); if ($isVacationDay && $isWorkDay && !$isHoliday) { $got_vacations += 1; } } @endphp {{ $got_vacations + $Vacations_manual_days_sum_all }}
@php $yearEnd = Carbon\Carbon::now()->endOfYear()->toDateString(); $upcoming_days = $Vacation_all ->where('is_accepted', '1') ->where('date_from', '>', now()->toDateString()) ->where('date_from', '<=', $yearEnd) ->sum('days_number'); @endphp
geplannt : {{ $upcoming_days }}
verfügbar noch: {{ Auth::user()->get_employee->contract->get_days->vacation_entitlement + Auth::user()->get_employee->contract->get_days->last_year_vacation_rest - $got_vacations - $upcoming_days - $Vacations_manual_days_sum_all }} {{-- {{ Auth::user()->get_employee->contract->get_days->vacation_rest }} --}}
{{-- @if ($Vacation_all->where('date_from', '=', '2024-12-23')->where('date_to', '=', '2024-12-31')->count() <= 0)
Sie haben noch keinen Urlaubsantrag für den Zeitraum vom 23.12.2024 bis zum 31.12.2024 für insgesamt 4 Tage als Schließzeit beantragt. Bitte beantragen Sie diesen jetzt ein.
@endif --}}

ausstehende Anträge
{{-- --}} {{-- @endif --}} {{-- --}} {{-- @if (Auth::user()->get_employee->is_mgt) @endif --}} @if ($Vacation_all->where('is_closed', '==', '0')->count() > 0) @foreach ($Vacation_all->where('is_closed', '==', '0')->sortBy('date_from') as $item) {{-- --}} {{-- --}} @endforeach @else @endif
Verfügbar Mitarbeiter Startdatum Enddatum Abeitstage Grund Bemerkung Status Action
@if ($item->get_employee->contract != null) {{ $item->get_employee->contract->get_days->vacation_rest }} Tage @else -- @endif {{ $item->get_employee->first_name }} {{ $item->get_employee->last_name }} {{ Carbon\Carbon::parse($item->date_from)->format('d.m.Y') }} {{-- {{ $item->date_from }} --}} {{ Carbon\Carbon::parse($item->date_to)->format('d.m.Y') }} {{ $item->days_number }} {{ $item->reason }} {{ $item->note }} @if ($item->is_accepted == 1) genemigt @elseif ($item->is_accepted === 0) abgelehnt @elseif ($item->is_accepted == null) in bearbeitung @endif
Keine neue Anträge
{{--
--}}

{{--
+ alte Anträge
--}}

{{-- --}} {{-- @endif --}} {{-- --}} {{-- @if (Auth::user()->get_employee->is_mgt) @endif --}} @if ($Vacation_all->where('is_closed', '==', '1')->count() > 0) @foreach ($Vacation_all->where('is_closed', '==', '1')->sortByDesc('date_from') as $item) {{-- --}} @endforeach @else @endif
Verfügbar Mitarbeiter Startdatum Enddatum Abeitstage Grund Bemerkung Status Action
{{ $item->get_employee->first_name }} {{ $item->get_employee->last_name }} {{ Carbon\Carbon::parse($item->date_from)->format('d.m.Y') }} {{-- {{ $item->date_from }} --}} {{ Carbon\Carbon::parse($item->date_to)->format('d.m.Y') }} {{ $item->days_number }} {{ $item->reason }} {{ $item->note }} {{-- {{ $item->is_accepted }} --}} @if ($item->is_accepted == '1') genehmigt @if ($item->is_accepted & ($item->date_from <= now()->toDateString())) und genommen @endif @elseif ($item->is_accepted == '0') abgelehnt @elseif ($item->is_accepted == null) in bearbeitung @endif
Keine neue Anträge
@else Es Fehlt die Daten aus dem Arbeitsvertrag @endif

Zeiterfassung 2024

meine Zeiterfassung aus :
@foreach ($months as $item) {{ Carbon\Carbon::create()->day(1)->month($item->month)->format('m.') }}{{ $item->year }} @endforeach

Stundenzettel für {{ \Carbon\Carbon::parse($ddate)->format('m.Y') }}

@php // if (!isset($ddate)) { // # code... // $today = \Carbon\Carbon::now(); // } 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) { $seconds = $hours * 3600; return $seconds; } function convertDecimalToHHMM($decimalHours) { // Replace comma with dot to handle European decimal format $decimalHours = str_replace(',', '.', $decimalHours); // Determine if the value is negative $isNegative = $decimalHours < 0; // Take absolute value for calculation $decimalHours = abs($decimalHours); // Separate hours and minutes $hours = floor($decimalHours); $minutes = ($decimalHours - $hours) * 60; // Format the result as HH:MM $formattedTime = sprintf('%02d:%02d', $hours, $minutes); // Add negative sign back if the original value was negative if ($isNegative) { $formattedTime = '-' . $formattedTime; } return $formattedTime; } function convertHMToHours($time) { // Split the input string by the colon [$hours, $minutes] = explode(':', $time); // Convert hours and minutes to integers and calculate the total hours as a decimal $totalHours = $hours + $minutes / 60; // Replace the decimal point with a comma $formattedTotalHours = str_replace('.', ',', number_format($totalHours, 2)); return $formattedTotalHours; } function convertSecondsToHours($seconds) { // Convert seconds to hours as a decimal $hours = $seconds / 3600; // Format the result to have two decimal places and replace the decimal point with a comma $formattedHours = str_replace('.', ',', number_format($hours, 2)); return $formattedHours; } $contractStart = Auth::user()->get_employee->contract->start_day ? Carbon\Carbon::parse(Auth::user()->get_employee->contract->start_day) : null; $total_soll = 0; $startDate = Carbon\Carbon::parse($ddate)->startOfMonth(); $endDate = Carbon\Carbon::parse($ddate)->endOfMonth(); // for ( // $start = Carbon\Carbon::parse($ddate)->startOfMonth(); // $start <= Carbon\Carbon::parse($ddate)->endOfMonth(); // $start->addDay() // ) { // if ( // !$Vacation_all // ->where('is_accepted', '1') // ->where('date_from', '<=', $start->toDateString()) // ->where('date_to', '>=', $start->toDateString()) // ->count() // ) { // $total_soll += Auth::user()->get_employee->contract->get_days[strtolower($start->format('l'))]; // } // } for ($start = $startDate; $start <= $endDate; $start->addDay()) { $isHoliday = $holidays->contains(function ($holiday) use ($start) { return $holiday->date == $start->toDateString(); }); $isSick = $sicks->contains(function ($sick) use ($start) { return $sick->date_from <= $start->toDateString() && $sick->date_to >= $start->toDateString(); }); $isVacation = $Vacation_all ->where('is_accepted', '1') ->where('date_from', '<=', $start->toDateString()) ->where('date_to', '>=', $start->toDateString()) ->count(); if ( !$isHoliday && !$isSick && !$isVacation && (!$contractStart || $start->greaterThanOrEqualTo($contractStart)) ) { $dayOfWeek = strtolower($start->format('l')); $total_soll += Auth::user()->get_employee->contract->get_days[$dayOfWeek] ?? 0; } } @endphp
Soll:
Ist:
AZK Vormonat: @if ($new_balance < 0) {{ convertDecimalToHHMM($new_balance) }} ({{ number_format($new_balance, 2, ',', '.') }} Stunde) @else @endif
AZK aktuell:
{{--
--}}
{{-- @if (Auth::user()->get_employee->is_hrm)
@endif --}}
{{-- $month = '2015-01'; $start = Carbon::parse($month)->startOfMonth(); $end = Carbon::parse($month)->endOfMonth(); $dates = []; while ($start->lte($end)) { $dates[] = $start->copy(); $start->addDay(); } --}} @php \Carbon\Carbon::setLocale('de'); @endphp @for ($start = Carbon\Carbon::parse($ddate)->startOfMonth(); $start <= Carbon\Carbon::parse($ddate)->endOfMonth(); $start->addDay()) {{-- Datum --}} {{-- beginn --}} {{-- Ende --}} {{-- soll --}} {{-- ist --}} @endfor
Datum Beginn Ende Arbeitsschichten Pausen Pause Soll Ist Nachtrag / Notiz
@if (!is_null($hrtimerecording->where('start_date', $start->toDateString())->first())) @endif
@php \Carbon\Carbon::setLocale('de'); // optional if app.locale is set to 'de' @endphp {{ $start->isoFormat('dd DD.MM.YYYY') }}
{{-- $currentTime =$hrtimerecording->where('start_date', $start->toDateString())->where('work', '1')->first()->start_time; --}} @if (!is_null($hrtimerecording->where('start_date', $start->toDateString())->where('work', '1')->first())) {{-- {{ date('H:i',strtotime($hrtimerecording->where('start_date', $start->toDateString())->where('work', '1')->first()->start_time)) }} --}} {{-- forjava --}} {{ Carbon\Carbon::parse($hrtimerecording->where('start_date', $start->toDateString())->where('work', '1')->first()->start_time)->format('H:i') }} @endif @if (is_null( $hrtimerecording->where('start_date', $start->toDateString())->where('work', '1')->where('status_open', '0')->last())) {{-- @if ($hrtimerecording->where('start_date', $start->toDateString())->where('work', '1')->last()->id == $hrtimerecording->where('start_date', $start->toDateString())->where('work', '1')->first()->id) --- --}} @else @if (is_null($hrtimerecording->where('start_date', $start->toDateString())->where('work', '1')->last()->stop_time)) --- @else {{ Carbon\Carbon::parse($hrtimerecording->where('start_date', $start->toDateString())->where('work', '1')->where('status_open', '0')->last()->stop_time)->format('H:i') }} @endif {{-- {{ $hrtimerecording->where('start_date', $start->toDateString())->where('work', '1')->sortByDesc('id')->first()->stop_time }} --}} @endif @if ( !is_null( $hrtimerecording->where('start_date', $start->toDateString())->where('work', '1')->sortByDesc('id')->first())) {{ $hrtimerecording->where('start_date', $start->toDateString())->where('work', '1')->sum('work') }} {{-- {{ Carbon\Carbon::parse($hrtimerecording->where('start_date', $start->toDateString())->where('work', '1')->sum('work'))->format('H:i') }} --}} @endif @if ( !is_null( $hrtimerecording->where('start_date', $start->toDateString())->where('break', '1')->sortByDesc('id')->first())) {{ $hrtimerecording->where('start_date', $start->toDateString())->where('break', '1')->sum('break') }} @endif @if ( !is_null( $hrtimerecording->where('start_date', $start->toDateString())->where('break', '1')->sortByDesc('id')->first())) {{ \Carbon\CarbonInterval::seconds($hrtimerecording->where('start_date', $start->toDateString())->where('break', '1')->sum('total_second'))->cascade()->format('%H:%I') }} @endif @if ($Vacation_all->where('is_accepted', '1')->where('date_from', '<=', $start->toDateString())->where('date_to', '>=', $start->toDateString())->count()) @else @if (Auth::user()->get_employee->contract) @if (Auth::user()->get_employee->contract->get_days[strtolower($start->format('l'))]) {{ convertDecimalToHHMM(Auth::user()->get_employee->contract->get_days[strtolower($start->format('l'))]) }} @endif @else -- @endif @endif {{-- @if ($Vacation_all->where('is_accepted', '1')->where('date_from', '<=', $start->toDateString())->where('date_to', '>=', $start->toDateString())->count()) @else --}} @if ( !is_null( $hrtimerecording->where('start_date', $start->toDateString())->where('work', '1')->sortByDesc('id')->first())) @if (Auth::user()->get_employee->contract) @php // Zeitangabe im Format "Stunden:Minuten" (hh:mm) $time = \Carbon\CarbonInterval::seconds( $hrtimerecording ->where('start_date', $start->toDateString()) ->where('work', '1') ->sum('total_second') - $hrtimerecording ->where('start_date', $start->toDateString()) ->where('break', '1') ->sum('total_second'), ) ->cascade() ->format('%H:%I'); // Aufteilen von Stunden und Minuten [$hours, $minutes] = explode(':', $time); // Umrechnen in Stunden (Fließkommazahl) $timeInHours = (float) $hours + $minutes / 60; // Fließkommazahl von Stunden zum Vergleich $floatHours = Auth::user()->get_employee->contract->get_days[ strtolower($start->format('l')) ]; // Beispiel: 8 Stunden und 30 Minuten als Fließkommazahl @endphp @php // Calculate total work time in seconds $totalWorkTimeInSeconds = $hrtimerecording ->where('start_date', $start->toDateString()) ->where('work', '1') ->where('status_open', '0') ->sum('total_second'); // Calculate total pause time in seconds $totalPauseTimeInSeconds = $hrtimerecording ->where('start_date', $start->toDateString()) ->where('break', '1') ->where('status_open', '0') ->sum('total_second'); // Compute the difference $netTimeInSeconds = $totalWorkTimeInSeconds - $totalPauseTimeInSeconds; // Determine if the time is negative $isNegative = $netTimeInSeconds < 0; // Convert the absolute value of the net time to a CarbonInterval $interval = \Carbon\CarbonInterval::seconds(abs($netTimeInSeconds)); // Format the interval $formattedTime = $interval->cascade()->format('%H:%I'); // Add a negative sign if the time is negative if ($isNegative) { $formattedTime = '-' . $formattedTime; } @endphp @if ($timeInHours < $floatHours) {{-- {{ \Carbon\CarbonInterval::seconds($hrtimerecording->where('start_date', $start->toDateString())->where('work', '1')->sum('total_second') - $hrtimerecording->where('start_date', $start->toDateString())->where('break', '1')->sum('total_second'))->cascade()->format('%H:%I') }} --}} {{ $formattedTime }} @else {{ $formattedTime }} @endif @endif @endif {{-- @endif --}} @if ($hrtimerecording->where('start_date', $start->toDateString())->where('is_updated', '1')->count()) Ja / @endif {{-- @if ($start->formatLocalized('%a.') != 'Sa.' and $start->formatLocalized('%a.') != 'So.') @if ($Vacation_all->where('is_accepted', '1')->where('date_from', '<=', $start->toDateString())->where('date_to', '>=', $start->toDateString())->count()) Urlaub @endif @if (!is_null($hrtimerecording->where('start_date', $start->toDateString())->where('work', '1')->first())) @if ($Vacation_all->where('is_accepted', '1')->where('date_from', '<=', $start->toDateString())->where('date_to', '>=', $start->toDateString())->count()) & @endif {{ $hrtimerecording->where('start_date', $start->toDateString())->where('work', '1')->first()->get_work_loction->name }} @endif @endif --}} {{-- @if ($start->formatLocalized('%a.') != 'Sa.' and $start->formatLocalized('%a.') != 'So.') @php $isVacation = $Vacation_all ->where('is_accepted', '1') ->where('date_from', '<=', $start->toDateString()) ->where('date_to', '>=', $start->toDateString()) ->count(); $isSick = $sicks ->where('date_from', '<=', $start->toDateString()) ->where('date_to', '>=', $start->toDateString()) ->count(); $isHoliday = $holidays->where('date', $start->toDateString())->count(); $workTime = $hrtimerecording ->where('start_date', $start->toDateString()) ->where('work', '1') ->first(); @endphp @if ($isVacation) Urlaub @elseif ($isSick) krank @elseif ($isHoliday) Holiday @else @if ($workTime) {{ Carbon\Carbon::parse($workTime->start_time)->format('H:i') }} - {{ Carbon\Carbon::parse($workTime->end_time)->format('H:i') }} @if ($workTime->get_work_loction) ({{ $workTime->get_work_loction->name }}) @endif @else - @endif @endif @else - @endif --}} @php \Carbon\Carbon::setLocale('de'); @endphp @if ($start->isoFormat('dd') != 'Sa' && $start->isoFormat('dd') != 'So') @php $isVacation = $Vacation_all ->where('is_accepted', '1') ->where('date_from', '<=', $start->toDateString()) ->where('date_to', '>=', $start->toDateString()) ->count(); $isSick = $sicks ->where('date_from', '<=', $start->toDateString()) ->where('date_to', '>=', $start->toDateString()) ->count(); $isHoliday = $holidays->where('date', $start->toDateString())->count(); $workTime = $hrtimerecording ->where('start_date', $start->toDateString()) ->where('work', '1') ->first(); @endphp @if ($isHoliday) Feiertag - {{ $holidays->where('date', $start->toDateString())->first()->fname }} @if ($workTime) & {{ $workTime->get_work_loction->name }} @endif @elseif ($isVacation) Urlaub @if ($workTime) & {{ $workTime->get_work_loction->name }} @endif @elseif ($isSick) Krank @if ($workTime) & {{ $workTime->get_work_loction->name }} @endif @else @if ($workTime) {{-- {{ Carbon\Carbon::parse($workTime->start_time)->format('H:i') }} - {{ Carbon\Carbon::parse($workTime->end_time)->format('H:i') }} --}} @if ($workTime->get_work_loction) {{ $workTime->get_work_loction->name }} @endif @else - @endif @endif @else - @endif
Arbeitzeiten
@foreach ($hrtimerecording->where('start_date', $start->toDateString())->where('work', '1') as $item) @endforeach
Beginn Ende Ist Arbeitsort Nachtrag
{{ Carbon\Carbon::parse($item->start_time)->format('H:i') }} @if ($item->stop_time) {{ Carbon\Carbon::parse($item->stop_time)->format('H:i') }} @endif @if ($item->stop_time) {{ Carbon\Carbon::parse($item->total_time)->format('H:i') }} @endif @if ($item->fk_work_location_id) {{ $item->get_work_loction->name }} @endif

@if ($item->is_updated) {{ $item->last_updated_reason }} @else - @endif


Pausen
@foreach ($hrtimerecording->where('start_date', $start->toDateString())->where('break', '1') as $item) @endforeach
Beginn Ende Ist Arbeitsort Nachtrag
{{ Carbon\Carbon::parse($item->start_time)->format('H:i') }} @if ($item->stop_time) {{ Carbon\Carbon::parse($item->stop_time)->format('H:i') }} @endif @if ($item->stop_time) {{ Carbon\Carbon::parse($item->total_time)->format('H:i') }} @endif @if ($item->fk_work_location_id) {{ $item->get_work_loction->name }} @endif

@if ($item->is_updated) {{ $item->last_updated_reason }} @else - @endif


{{-- container --}} @endsection