@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
|
{{ $staffTimesheet->activityOfTimesheet->item_code }}
|
@if($staffTimesheet->timesheetFiles->where('category', 'site_diaries')->isNotEmpty())
@else
NA
@endif
|
@if($staffTimesheet->timesheetFiles->where('category', 'images')->isNotEmpty())
@else
NA
@endif
|
@if($staffTimesheet->timesheetFiles->where('category', 'person_photo')->isNotEmpty())
@else
NA
@endif
|
@if($staffTimesheet->timesheetFiles->where('category', 'drawings')->isNotEmpty())
@else
NA
@endif
|
{{ $staffTimesheet->total_hours }}
|
£{{ number_format($all_total_cost,4) }} |
£{{ number_format($total_estimate,4) }} |
£{{ number_format($total_profit,4) }} |
£{{ number_format($total_loss,4) }} |
Activity |
Date |
Notes |
Start Time |
End Time |
Hours |
People |
Total Hours |
Total Cost |
Estimate |
Profit |
Loss |
@php
$detailTimesheets = $staffTimesheet->project->staffTimesheets()
->where('sub_activity_id', $staffTimesheet->sub_activity_id)
->where('activity_id', $staffTimesheet->activity_id)
->where('role', 'detail')
->get();
@endphp
@if($detailTimesheets->isNotEmpty())
@foreach($detailTimesheets as $detailTimesheet)
@php
$total_hours = 0;
$a_total_cost = 0;
$tmj = 0;
$thj = 0;
$estimate = $detailTimesheet->activityOfTimesheet->total;
$per_estimate = $detailTimesheet->activityOfTimesheet->selling_cost;
@endphp
{{ $detailTimesheet->activityOfTimesheet->item_code }} {{ $detailTimesheet->subActivity->sub_code }}
|
|
|
|
|
Estimate: {{ number_format($detailTimesheet->activityOfTimesheet->quantity, 2) }}
|
|
{{ $detailTimesheet->total_hours }}
|
£{{ number_format($total_cost, 4) }} |
£{{ number_format($estimate, 4) }} |
£{{ number_format($profit, 4) }} |
£{{ number_format($loss, 4) }} |
@php
$bDetailTimesheets = $staffTimesheet->project->staffTimesheets()
->where('sub_activity_id', $staffTimesheet->sub_activity_id)
->where('activity_id', $detailTimesheet->activity_id)
->where('role', 'detail')
->get();
@endphp
@if($bDetailTimesheets->isNotEmpty())
@foreach($bDetailTimesheets as $bDetailTimesheet)
@php
$per_total_cost = ($per_estimate * (float)$bDetailTimesheet->total_hours);
$tt = (float)$bDetailTimesheet->total_hours;
$a = '';
$a = (float)$bDetailTimesheet->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
{{ $bDetailTimesheet->subActivity->sub_code }}
{{ $bDetailTimesheet->supervisor->full_name }}
|
{{ date("d/m/Y", strtotime($bDetailTimesheet->date)) }}
|
{{ $bDetailTimesheet->notes }}
|
{{ $bDetailTimesheet->start_time }}
|
{{ $bDetailTimesheet->end_time }}
|
{{ $tt }}
|
{{ $bDetailTimesheet->peoples }}
|
{{ $tt }}
|
£{{ number_format($per_total_cost, 4) }}
|
£{{ number_format($per_estimate, 4) }}/hr
|
|
|
@php
$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;
}
@endphp
@php
$all_total_hours = ($all_total_hours+$total_hours);
$all_total_cost = ($all_total_cost+$total_cost);
$total_estimate = ($total_estimate+$estimate);
$tm = ($tm+$tmj);
@endphp
@endforeach
@endif
@php
if($tm > 60){
$all_total_hours = ($all_total_hours+floor($tm/60));
$tm = floor($tm%60);
}
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
|
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) }} |
@endif