|
{{ $labourTimesheet->subActivity->sub_code }}
|
{{ $labourTimesheet->activityOfTimesheet->item_code }}
|
{{ $labourTimesheet->activityOfTimesheet->activity }}
|
{{ $labourTimesheet->allocated_hour }}
|
{{ $labourTimesheet->total_spent_hour }}
|
{{ $labourTimesheet->remaining_hour }}
|
£{{ number_format($all_total_cost,2) }} |
£{{ number_format($total_estimate,2) }} |
£{{ number_format($total_profit,2) }} |
£{{ number_format($total_loss,2) }} |
Lab code |
Date |
Operative |
Start time |
End time |
Peoples |
Spent/hr |
Rate |
Total cost |
@php
$labourTimesheets1 = $labourTimesheet->project->labourTimesheets()
->where('activity_id', $labourTimesheet->activity_id)
->get();
@endphp
@if($labourTimesheets1->isNotEmpty())
@foreach($labourTimesheets1 as $labourTimesheet1)
@php
$total_hours = 0;
$a_total_cost = 0;
$tmj = 0;
$thj = 0;
$estimate = $labourTimesheet1->activityOfTimesheet->total;
$per_estimate = $labourTimesheet1->activityOfTimesheet->selling_cost;
@endphp
{{ $labourTimesheet1->activityOfTimesheet->item_code }}
|
|
|
|
Estimate: {{ number_format($labourTimesheet1->activityOfTimesheet->quantity, 2) }}
|
{{ $labourTimesheet1->peoples }} |
{{ $labourTimesheet1->spent_hour }}
|
|
|
@if($labourTimesheet1->timesheetMaterials->isNotEmpty())
@foreach($labourTimesheet1->timesheetMaterials as $timesheetMaterial1)
@php
$per_total_cost = ($per_estimate * (float)$timesheetMaterial1->hours);
$tt = (float)$timesheetMaterial1->hours;
$a = '';
$a = (float)$timesheetMaterial1->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;
@$spent_rate = ($timesheetMaterial1->hours*$timesheetMaterial1->rate);
@endphp
{{ $timesheetMaterial1->lab_code }}
|
{{ date("d/m/Y", strtotime($labourTimesheet1->timesheet_date)) }}
|
{{ $timesheetMaterial1->operative }}
|
{{ $timesheetMaterial1->start_time }}
|
{{ $timesheetMaterial1->end_time }}
|
1 |
{{ $timesheetMaterial1->hours }}
|
{{ $timesheetMaterial1->rate }}
|
£{{ number_format($spent_rate, 2) }}
|
@php
$tmj = ($tmj+$pm);
@$total_hours = ($total_hours+$ph);
@$a_total_cost = ($a_total_cost+$spent_rate);
@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 = (float)$labourTimesheet->allocated_hour*$per_estimate;
$tm = ($tm+$tmj);
@endphp
@endforeach
@endif
@php
if($tm > 60){
$all_total_hours = ($all_total_hours+floor($tm/60));
$all_total_hourss = ($all_total_hourss + $all_total_hours);
$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,2) }} |
Estimate : £{{ number_format($gtotal_estimate,2) }} |
Profit : £{{ number_format($gtotal_profit,2) }} |
Loss : £{{ number_format($gtotal_loss,2) }} |
@endif