List of Timesheet for {{ $project->project_title }}
Company Address Telephone Fax E-mail
{{ $project->company->company_name }} {!! $project->company->address_line1 ? $project->company->address_line1.'
' : '' !!} {!! $project->company->address_line2 ? $project->company->address_line2.'
' : '' !!}
{{ $project->company->phone }} {{ $project->company->fax }} {{ $project->company->email }}
@php $total = 0; $total_h = 0; $total_p = 0; $total_hp = 0; $gtotal_cost = 0; $gall_total_cost = 0; $gtotal_estimate = 0; $gtotal_profit = 0; $gtotal_loss = 0; @endphp @if($staffTimesheets->isNotEmpty()) @foreach($staffTimesheets as $staffTimesheet) @php $total_estimate = 0; $total_cost = 0; $all_total_cost = 0; $all_total_hours = 0; $total_profit = 0; $total_loss = 0; $tm = 0; $profit = 0; $loss = 0; $gtotal_estimate = ($gtotal_estimate + $total_estimate); $gtotal_profit = ($gtotal_profit + $total_profit); $gtotal_loss = ($gtotal_loss + $total_loss); $gall_total_cost = ($gall_total_cost + $all_total_cost); @endphp @php $detailTimesheetsRow1 = $staffTimesheet->project->staffTimesheets() ->where('sub_activity_id', $staffTimesheet->sub_activity_id) ->where('activity_id', $staffTimesheet->activity_id) ->where('role', 'detail') ->groupBy('activity_id') ->get(); @endphp @if($detailTimesheetsRow1->isNotEmpty()) @foreach($detailTimesheetsRow1 as $detailTimesheetRow1) @php $total_hours = 0; $a_total_cost = 0; $tmj = 0; $estimate = $detailTimesheetRow1->activityOfTimesheet->total; $per_estimate = $detailTimesheetRow1->activityOfTimesheet->selling_cost; $bDetailTimesheetsRow1 = $staffTimesheet->project->staffTimesheets() ->where('sub_activity_id', $staffTimesheet->sub_activity_id) ->where('activity_id', $detailTimesheetRow1->activity_id) ->where('role', 'detail') ->orderBy('id') ->get(); @endphp @if($bDetailTimesheetsRow1->isNotEmpty()) @foreach($bDetailTimesheetsRow1 as $bDetailTimesheetRow1) @php @$per_total_cost = $per_estimate * (float)$bDetailTimesheetRow1->total_hours; $tt = (float)$bDetailTimesheetRow1->total_hours; $a = ''; $a = (float)$bDetailTimesheetRow1->total_hours; if (strpos($a, ':') !== false) { }else{ $tt = str_pad($tt, 2, '0', STR_PAD_LEFT).':00'; } $dtm = new DateTime('2019-11-09 '.$tt.''); $time = $dtm->format('H:i'); $ph = $dtm->format('H'); $pm = $dtm->format('i'); $tmin = ($ph*60)+$pm; $minpercost = $per_estimate/60; $per_total_cost = $tmin*$minpercost; $tmj = $tmj+$pm; @$total_hours = $total_hours+$ph; @$a_total_cost = $a_total_cost+$per_total_cost; @endphp @endforeach @endif @php if($tmj > 60){ $total_hours = $total_hours+floor($tmj/60); $tmj = floor($tmj%60); } $total_cost = $a_total_cost; $profit=0; $loss=0; if($total_cost > $estimate){ $loss=$total_cost - $estimate; } if($total_cost < $estimate){ $profit= $estimate - $total_cost; } $all_total_hours=$all_total_hours+$total_hours; $all_total_cost=$all_total_cost+$total_cost; $total_estimate=$total_estimate+$estimate; @endphp @endforeach @endif @php if($all_total_cost > $total_estimate){ $total_loss = ($all_total_cost - $total_estimate); }elseif($all_total_cost < $total_estimate){ $total_profit = ($total_estimate - $all_total_cost); } $gall_total_cost = ($gall_total_cost+$all_total_cost); $gtotal_estimate = ($gtotal_estimate+$total_estimate); $gtotal_profit = ($gtotal_profit+$total_profit); $gtotal_loss = ($gtotal_loss+$total_loss); @endphp @endforeach @endif
Sub Code Total Hours Total Cost Estimate Profit Loss
{{ $staffTimesheet->activityOfTimesheet->item_code }} {{ $all_total_hours }}:{{ $tmj }} £{{ number_format($all_total_cost,4) }} £{{ number_format($total_estimate,4) }} £{{ number_format($total_profit,4) }} £{{ number_format($total_loss,4) }}
@php $detailTimesheetsRow2 = $staffTimesheet->project->staffTimesheets() ->where('sub_activity_id', $staffTimesheet->sub_activity_id) ->where('activity_id', $staffTimesheet->activity_id) ->where('role', 'detail') ->groupBy('activity_id') ->get(); @endphp @if($detailTimesheetsRow2->isNotEmpty()) @foreach($detailTimesheetsRow2 as $detailTimesheetRow2) @php $total_hours = 0; $a_total_cost = 0; $tmj = 0; $estimate = $detailTimesheetRow2->activityOfTimesheet->total; $per_estimate = $detailTimesheetRow2->activityOfTimesheet->selling_cost; $bDetailTimesheetsRow2 = $staffTimesheet->project->staffTimesheets() ->where('sub_activity_id', $staffTimesheet->sub_activity_id) ->where('activity_id', $detailTimesheetRow2->activity_id) ->where('role', 'detail') ->get(); @endphp @if($bDetailTimesheetsRow2->isNotEmpty()) @foreach($bDetailTimesheetsRow2 as $bDetailTimesheetRow2) @php @$per_total_cost = ($per_estimate * $bDetailTimesheetRow2->total_hours); $tt = $bDetailTimesheetRow2->total_hours; $a = ''; $a = $bDetailTimesheetRow2->total_hours; if (strpos($a, ':') !== false) { }else{ $tt=str_pad($tt, 2, '0', STR_PAD_LEFT).':00'; } $dtm = new DateTime('2019-11-09 '.$tt.''); $time = $dtm->format('H:i'); $ph = $dtm->format('H'); $pm = $dtm->format('i'); $tmin = ($ph*60)+$pm; $minpercost = $per_estimate/60; $per_total_cost = $tmin*$minpercost; $tmj = $tmj+$pm; @$total_hours = $total_hours+$ph; @$a_total_cost = $a_total_cost+$per_total_cost; @endphp @endforeach @php if($tmj > 60){ $total_hours = $total_hours+floor($tmj/60); $tmj = floor($tmj%60); } $total_cost = $a_total_cost; $profit=0; $loss=0; if($total_cost > $estimate){ $loss = ($total_cost - $estimate); } if($total_cost < $estimate){ $profit = ($estimate - $total_cost); } @endphp @endif @php $detailTimesheetsRow3 = $staffTimesheet->project->staffTimesheets() ->where('sub_activity_id', $staffTimesheet->sub_activity_id) ->where('activity_id', $detailTimesheetRow2->activity_id) ->where('role', 'detail') ->get(); @endphp @if($detailTimesheetsRow3->isNotEmpty()) @foreach($detailTimesheetsRow3 as $detailTimesheetRow3) @php @$per_total_cost = ($per_estimate * (float)$detailTimesheetRow3->total_hours); $tt = (float)$detailTimesheetRow3->total_hours; $a = ''; $a = (float)$detailTimesheetRow3->total_hours; if (strpos($a, ':') !== false) { }else{ $tt = str_pad($tt, 2, '0', STR_PAD_LEFT).':00'; } $dtm = new DateTime('2019-11-09 '.$tt.''); $time = $dtm->format('H:i'); $ph = $dtm->format('H'); $pm = $dtm->format('i'); $tmin = ($ph*60)+$pm; $minpercost = $per_estimate/60; $per_total_cost = $tmin*$minpercost; @endphp @endforeach @endif @endforeach @endif
Activity Date Notes Start Time End Time< Hours People Total Hours Total Cost Estimate Profit Loss
{{ $detailTimesheetRow2->activityOfTimesheet->item_code }} {{ $detailTimesheetRow2->subActivity->sub_code }} Estimate: {{ number_format($detailTimesheetRow2->activityOfTimesheet->quantity, 2) }} {{ $total_hours }} £{{ number_format($total_cost, 4) }} £{{ number_format($estimate, 4) }} £{{ number_format($profit, 4) }} £{{ number_format($loss, 4) }}
{{ $detailTimesheetRow3->subActivity->sub_code }}
{{ $detailTimesheetRow3->supervisor->full_name }}
{{ date("d/m/Y", strtotime($detailTimesheetRow3->date)) }} {{ $detailTimesheetRow3->notes }} {{ $detailTimesheetRow3->start_time }} {{ $detailTimesheetRow3->end_time }} {{ $tt }} {{ $detailTimesheetRow3->peoples }} {{ $tt }} £{{ number_format($per_total_cost, 4) }} £{{ number_format($per_estimate, 4) }}/hr
Total Cost : £{{ number_format($gall_total_cost,4) }} Estimate : £{{ number_format($gtotal_estimate,4) }} Profit : £{{ number_format($gtotal_profit,4) }} Loss : £{{ number_format($gtotal_loss,4) }}