@extends('layouts.app', ['title' => 'MitarbeiterAnzeig']) @section('content') {{-- newitem --}} {{-- --}} {{-- edit Item --}} {{-- --}} {{-- delete Item --}} @if (session('msg'))

{{ session('msg') }}

@endif {{-- main content --}}

Mitarbeiter: {{ $employee->first_name }} {{ $employee->last_name }}

Zeiterfassung aus:
{{--

Mein Stundenzettel für {{ Carbon\Carbon::parse($ddate)->format('F - 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; } $total_soll = 0; $startDate = Carbon\Carbon::parse($ddate)->startOfMonth(); $endDate = Carbon\Carbon::parse($ddate)->endOfMonth(); $contractStart = $employee->contract->start_day ? Carbon\Carbon::parse($employee->contract->start_day) : null; 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 += $employee->contract->get_days[$dayOfWeek] ?? 0; } } @endphp

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

@if (Auth::user()->get_employee->is_hrm) @endif

Soll:
Ist:
AZK Vormonat: @if ($new_balance < 0) {{ convertDecimalToHHMM($new_balance) }} ({{ number_format($new_balance, 2, ',', '.') }} Stunde) @else @endif
AZK aktuell:

{{-- $month = '2015-01'; $start = Carbon::parse($month)->startOfMonth(); $end = Carbon::parse($month)->endOfMonth(); $dates = []; while ($start->lte($end)) { $dates[] = $start->copy(); $start->addDay(); } --}} @for ($start = Carbon\Carbon::parse($ddate)->startOfMonth(); $start <= Carbon\Carbon::parse($ddate)->endOfMonth(); $start->addDay()) {{-- Datum --}} {{-- beginn --}} {{-- Ende --}} {{-- --}} @endfor {{-- @foreach (Carbon\Carbon::now()->daysInMonth as $item) @endforeach --}}
Datum Beginn Ende Arbeitsschichten Pausen Soll Ist Notiz
@if (!is_null($hrtimerecording->where('start_date', $start->toDateString())->first())) @endif
{{ $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)) }} --}} {{ 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 (!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 ($employee->contract) @if ($employee->contract->get_days[strtolower($start->format('l'))]) {{ $employee->contract->get_days[strtolower($start->format('l'))] }} @endif @else -- @endif @if ( !is_null( $hrtimerecording->where('start_date', $start->toDateString())->where('work', '1')->sortByDesc('id')->first())) @if ($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 = $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 @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 (!in_array($start->isoFormat('dd'), ['Sa', '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 @if ($hrtimerecording->where('start_date', $start->toDateString())->where('work', '1')->where('fk_costcenter_id', '!=', '')->count() > 0)
@foreach ($hrtimerecording->where('start_date', $start->toDateString())->where('work', '1') as $item) @endforeach
@if ($item->stop_time) {{ Carbon\Carbon::parse($item->total_time)->format('H:i') }} @else @endif @if ($item->project_title) {{ $item->project_title }} @else * - {{ $item->note }} @endif
@endif
Arbeitzeiten:
@if (Auth::user()->get_employee->is_hrm) @endif @foreach ($hrtimerecording->where('start_date', $start->toDateString())->where('work', '1') as $item) @if (Auth::user()->get_employee->is_hrm) @endif @endforeach
Beginn Ende IstAktionNachtrag
{{ 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->is_updated) Ja - {{ $item->last_updated_reason }} @else - @endif


Pausen:
@if (Auth::user()->get_employee->is_hrm) @endif @foreach ($hrtimerecording->where('start_date', $start->toDateString())->where('break', '1') as $item) @if (Auth::user()->get_employee->is_hrm) @endif @endforeach
Beginn Ende IstAktionNachtrag
{{ 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->is_updated) Ja - {{ $item->last_updated_reason }} @else - @endif

test test test test test test test test

{{-- container --}} @endsection