@if($timesheets->isNotEmpty()) @foreach($timesheets as $timesheet) @php $mtotal_hours = 0; $mtime2 = '00:00'; $mth = 0; $mtm = 0; @endphp @php $getactivity = DB::table('sub_activities')->where('id', $timesheet->sub_activity_id)->first(); @endphp {{$getactivity->activity}} @if($timesheet->timesheetFiles->where('category', 'site_diaries')->isNotEmpty()) @else NA @endif @if($timesheet->timesheetFiles->where('category', 'images')->isNotEmpty()) @else NA @endif @if($timesheet->timesheetFiles->where('category', 'person_photo')->isNotEmpty()) @else NA @endif @if($timesheet->timesheetFiles->where('category', 'drawings')->isNotEmpty()) @else NA @endif {{ $timesheet->total_hours }} @php $detailTimesheets = $timesheet->project->staffTimesheets() ->where('main_activity_id', $timesheet->main_activity_id) ->where('sub_activity_id', $timesheet->sub_activity_id) ->where('activity_id', $timesheet->activity_id) ->where('role', 'detail') ->groupBy('activity') ->get(); @endphp @if($detailTimesheets->isNotEmpty()) @foreach($detailTimesheets as $detailTimesheet) @php $total_hours = 0; $time2 = '00:00'; $th = 0; $tm = 0; @endphp @php $detailTimesheets1 = $timesheet->project->staffTimesheets() ->where('main_activity_id', $detailTimesheet->main_activity_id) ->where('sub_activity_id', $detailTimesheet->sub_activity_id) ->where('activity_id', $detailTimesheet->activity_id) ->where('activity', $detailTimesheet->activity) ->where('role', 'detail') ->get(); @endphp @if($detailTimesheets1->isNotEmpty()) @foreach($detailTimesheets1 as $detailTimesheet1) @php @$total_hours = $total_hours + (float)$detailTimesheet1->total_hours; $tt = (float)$detailTimesheet1->total_hours; $a = ''; $a = (float)$detailTimesheet1->total_hours; if (strpos($a, ':') !== false) { }else{ $tt=str_pad($tt, 2, '0', STR_PAD_LEFT).':00'; } $dtm = new DateTime('2019-11-09 '.$tt.''); $ph = $dtm->format('H'); $pm = $dtm->format('i'); $th = $th+$ph; $tm = $tm+$pm; @endphp @endforeach @endif @php if($tm > 60){ $th = $th + floor($tm/60); $tm = floor($tm%60); } $th = str_pad($th, 2, '0', STR_PAD_LEFT); $tm = str_pad($tm, 2, '0', STR_PAD_LEFT); @endphp @php $mth = $mth+$th; $mtm = $mtm+$tm; @endphp @endforeach @endif
Activity Date Notes Start Time End Time Hours People Total Hours Approval Action
{{ $detailTimesheet->activityOfTimesheet->item_code }} {{ $detailTimesheet->activity }} Estimate: {{ number_format($detailTimesheet->activityOfTimesheet->quantity, 2) }} {{ number_format((float)$detailTimesheet->total_hours, 2) }}
{{ $detailTimesheet1->activity }} / {{ $detailTimesheet1->supervisor->full_name ?? '' }} {{ date("d/m/Y", strtotime($detailTimesheet1->timesheet_date)) }} {{ $detailTimesheet1->notes }} {{ $detailTimesheet1->start_time }} {{ $detailTimesheet1->end_time }} {{ $detailTimesheet1->hours }} {{ $detailTimesheet1->peoples }} {{ $detailTimesheet1->total_hours }} @if($detailTimesheet1->approver) ✔ By {{ $detailTimesheet1->approver->full_name }} {{ date("d/m/Y", strtotime($detailTimesheet1->approval_date)) }} @endif @if(auth()->user()->can('access', 'timesheets add')) @endif
@php if($mtm>60){ $mth=$mth+floor($mtm/60); $mtm=floor($mtm%60); } $mth=str_pad($mth, 2, '0', STR_PAD_LEFT); $mtm=str_pad($mtm, 2, '0', STR_PAD_LEFT); @endphp @endforeach @endif