@extends('layouts.app', ['title' => 'Zeiterfassung']) @section('content') @php $toDay = Carbon\Carbon::parse($ddate); $currentDate = Carbon\Carbon::parse($ddate); $prevDate = $currentDate->copy()->subDay()->format('Y-m-d'); $nextDate = $currentDate->copy()->addDay()->format('Y-m-d'); @endphp
{{-- Header --}}

Zeiterfassung {{ $currentDate->format('d.m.Y') }}

Heute
Anwesend
{{ $HrTimeRecordingToday->groupBy('fk_employee_id')->count() }} / {{ $employees->count() }}
@if(Auth::user()->get_employee->is_hrm) @endif
@if(session('msg'))
{{ session('msg') }}
@endif {{-- Employee presence badges --}}
{{-- Main table --}}
@php $groupedEmployees = $HrTimeRecordingToday->pluck('fk_employee_id')->unique(); @endphp @foreach ($department->sortBy('code') as $item) @foreach ($item->get_employee as $iteme) @if ($HrTimeRecordingToday->where('fk_employee_id', $iteme->employee_id)->where('work', '1')->count()) {{-- Mitarbeiter --}} {{-- Beginn --}} {{-- Ende --}} {{-- Schichten --}} {{-- Pausen --}} {{-- Soll --}} {{-- Ist --}} {{-- Notiz / Arbeitsort --}} {{-- Collapsible detail row --}} @endif @endforeach @endforeach
Mitarbeiter Beginn Ende Schichten Pausen Soll Ist Notiz / Arbeitsort
{{ $item->name }}
@if ($HrTimeRecordingToday->where('fk_employee_id', $iteme->employee_id)->count()) @endif {{ $iteme->first_name }} {{ $iteme->last_name }}
@if ($HrTimeRecordingToday->where('fk_employee_id', $iteme->employee_id)->where('work', '1')->count()) {{ Carbon\Carbon::parse($HrTimeRecordingToday->where('fk_employee_id', $iteme->employee_id)->where('work', '1')->first()->start_time)->format('H:i') }} @endif @if ($HrTimeRecordingToday->where('fk_employee_id', $iteme->employee_id)->where('work', '1')->where('status_open', '0')->count()) @if (is_null($HrTimeRecordingToday->where('fk_employee_id', $iteme->employee_id)->where('work', '1')->last()->stop_time)) @else {{ Carbon\Carbon::parse($HrTimeRecordingToday->where('fk_employee_id', $iteme->employee_id)->where('work', '1')->where('status_open', '0')->last()->stop_time)->format('H:i') }} @endif @endif @if ($HrTimeRecordingToday->where('fk_employee_id', $iteme->employee_id)->where('work', '1')->sortByDesc('id')->first()) {{ $HrTimeRecordingToday->where('fk_employee_id', $iteme->employee_id)->where('work', '1')->sum('work') }} @endif @if ($HrTimeRecordingToday->where('fk_employee_id', $iteme->employee_id)->where('break', '1')->sortByDesc('id')->first()) {{ \Carbon\CarbonInterval::seconds($HrTimeRecordingToday->where('fk_employee_id', $iteme->employee_id)->where('break', '1')->sum('total_second'))->cascade()->format('%H:%I') }} @endif @if ($iteme->contract) @if ($iteme->contract->get_days[strtolower(now()->format('l'))]) {{ $iteme->contract->get_days[strtolower(now()->format('l'))] }} @endif @else @endif @if ($HrTimeRecordingToday->where('fk_employee_id', $iteme->employee_id)->where('work', '1')->sortByDesc('id')->first()) @if ($iteme->contract) @php $time = \Carbon\CarbonInterval::seconds( $HrTimeRecordingToday->where('fk_employee_id', $iteme->employee_id)->where('work', '1')->sum('total_second') - $HrTimeRecordingToday->where('fk_employee_id', $iteme->employee_id)->where('break', '1')->sum('total_second'), )->cascade()->format('%H:%I'); [$hours, $minutes] = explode(':', $time); $timeInHours = (float) $hours + $minutes / 60; $floatHours = $iteme->contract->get_days[strtolower(now()->format('l'))]; $totalWorkTimeInSeconds = $HrTimeRecordingToday->where('fk_employee_id', $iteme->employee_id)->where('work', '1')->where('status_open', '0')->sum('total_second'); $totalPauseTimeInSeconds = $HrTimeRecordingToday->where('fk_employee_id', $iteme->employee_id)->where('break', '1')->where('status_open', '0')->sum('total_second'); $netTimeInSeconds = $totalWorkTimeInSeconds - $totalPauseTimeInSeconds; $isNegative = $netTimeInSeconds < 0; $interval = \Carbon\CarbonInterval::seconds(abs($netTimeInSeconds)); $formattedTime = $interval->cascade()->format('%H:%I'); if ($isNegative) { $formattedTime = '-' . $formattedTime; } @endphp @if ($timeInHours < $floatHours) {{ $formattedTime }} @else {{ $formattedTime }} @endif @endif @endif @if ($HrTimeRecordingToday->where('fk_employee_id', $iteme->employee_id)->where('is_updated', '1')->count()) Nachtrag @endif @php $start = Carbon\Carbon::today(); @endphp @if ($start->isoFormat('dd') != 'Sa' && $start->isoFormat('dd') != 'So') @php $isVacation = $Vacation_all->where('fk_employee_id', $iteme->employee_id)->where('is_accepted', '1')->where('date_from', '<=', $start->toDateString())->where('date_to', '>=', $start->toDateString())->count(); $isSick = $sicks->where('fk_employee_id', $iteme->employee_id)->where('date_from', '<=', $start->toDateString())->where('date_to', '>=', $start->toDateString())->count(); $isHoliday = $holidays->where('date', $start->toDateString())->count(); $workTime = $HrTimeRecordingToday->where('fk_employee_id', $iteme->employee_id)->where('start_date', $start->toDateString())->where('work', '1')->first(); @endphp @if ($isHoliday) {{ $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 && $workTime->get_work_loction) {{ $workTime->get_work_loction->name }} @endif @endif @endif @if ($HrTimeRecordingToday->where('fk_employee_id', $iteme->employee_id)->where('work', '1')->where('fk_costcenter_id', '!=', '')->count() > 0)
@foreach ($HrTimeRecordingToday->where('fk_employee_id', $iteme->employee_id)->where('work', '1') as $itemBv)
@if ($itemBv->stop_time) {{ Carbon\Carbon::parse($itemBv->total_time)->format('H:i') }} @else @endif @if ($itemBv->project_title) {{ $itemBv->project_title }} @else * — {{ $itemBv->note }} @endif
@endforeach
@endif
Arbeitszeiten
@if (Auth::user()->get_employee->is_hrm)@endif @foreach ($HrTimeRecordingToday->where('fk_employee_id', $iteme->employee_id)->where('work', '1') as $itemT) @if (Auth::user()->get_employee->is_hrm) @endif @endforeach
Beginn Ende Ist OrtNachtrag
{{ Carbon\Carbon::parse($itemT->start_time)->format('H:i') }} {{ $itemT->stop_time ? Carbon\Carbon::parse($itemT->stop_time)->format('H:i') : '' }} {{ $itemT->stop_time ? Carbon\Carbon::parse($itemT->total_time)->format('H:i') : '' }} {{ $itemT->fk_work_location_id ? $itemT->get_work_loction->name : '' }}
@if ($itemT->is_updated) {{ $itemT->last_updated_reason }} @else @endif
Pausen
@if (Auth::user()->get_employee->is_hrm)@endif @foreach ($HrTimeRecordingToday->where('fk_employee_id', $iteme->employee_id)->where('break', '1') as $itemT) @if (Auth::user()->get_employee->is_hrm) @endif @endforeach
Beginn Ende Ist OrtNachtrag
{{ Carbon\Carbon::parse($itemT->start_time)->format('H:i') }} {{ $itemT->stop_time ? Carbon\Carbon::parse($itemT->stop_time)->format('H:i') : '' }} {{ $itemT->stop_time ? Carbon\Carbon::parse($itemT->total_time)->format('H:i') : '' }} {{ $itemT->fk_work_location_id ? $itemT->get_work_loction->name : '' }}
@if ($itemT->is_updated) {{ $itemT->last_updated_reason }} @else @endif
{{-- Modal: Neue Zeiten --}} {{-- Modal: Zeiten bearbeiten --}} {{-- Modal: Zeiten löschen --}} @endsection