@if($activities->isNotEmpty()) @foreach($activities as $activity) @php $allocated_hour = $activity->quantity*$activity->subActivity->quantity*$activity->subActivity->mainActivity->quantity; $total_spent_hour = "00:00"; $remaining_hour = "00:00"; $timesheet = \Modules\TimesheetManager\Entities\LabourTimesheet::where('project_id', $activity->subActivity->mainActivity->project->id) ->where('activity_id', $activity->id)->first(); if($timesheet){ $total_spent_hour = $timesheet->total_spent_hour ?? "00:00"; $remaining_hour = $timesheet->remaining_hour ?? "00:00"; }else{ $remaining_hour = $allocated_hour; } $tt = $remaining_hour; $a = $remaining_hour; if (strpos($a, '.') !== false) { $h = strtok($a, '.'); $m = substr(strstr($a, '.'), 1); $tt = str_pad($h, 2, '0', STR_PAD_LEFT).':'.str_pad($m, 2, '0', STR_PAD_LEFT); $a = $tt; } if (strpos($a, ':') !== false) { }else{ $tt = str_pad($tt, 2, '0', STR_PAD_LEFT).':00'; } $remaining_hour = $tt; $aa = $allocated_hour; $ah = $allocated_hour; if (strpos($ah, '.') !== false) { $h = strtok($ah, '.'); $m = substr(strstr($ah, '.'), 1); $aa = str_pad($h, 2, '0', STR_PAD_LEFT).':'.str_pad($m, 2, '0', STR_PAD_LEFT); $ah = $aa; } if (strpos($ah, ':') !== false) { }else{ $aa = str_pad($aa, 2, '0', STR_PAD_LEFT).':00'; } $allocated_hour = $aa; @endphp @endforeach @endif
Activity Code Activity Site Operative Allocated/hr Spent/hr Total Spent/hr Remaining/hr
{{ $activity->item_code }} {{ $activity->activity }} {{ Form::number('activities['.$activity->id.'][peoples]', 0, [ 'class' => "form-control peoples", 'id' => "peoples".$activity->id, 'data-id' => $activity->id, 'onkeypress'=>'javascript:return isNumber(event)', 'onchange'=> 'prepareLaboursForm(this.value, "'.$activity->item_code.'", '.$activity->id.')', ]) }} {{ $allocated_hour }} 00:00 {{ $total_spent_hour }} {{ $remaining_hour }}