@extends('layouts.app') @section('title', 'Best Clients') @section('content')
@if(session('success'))
{{ session('success') }}
@endif @if ($errors->any())
{!! implode('
', $errors->all(':message')) !!}
@endif

Total Clients

{{ $clients->count() }}

Best Client

has('from')) onfocus="this.type='date'" onblur="if(this.value===''){this.type='text'}" @else type="date" @endif class="form-control bg-white" placeholder="From" name="from" value="@if(request()->has('from')){{request()->from}}@endif" />
has('to')) onfocus="this.type='date'" onblur="if(this.value===''){this.type='text'}" @else type="date" @endif class="form-control bg-white" placeholder="To" name="to" value="@if(request()->has('to')){{request()->to}}@endif" />
@if(!request()->has('from'))

Showing results from past 90 days.

@endif
@foreach($clients as $client) @php $grand_sales = 0; $grand_estimated_profit = 0; $grand_actual_profit = 0; @endphp @if(isset($client->projects)) @foreach($client->projects as $project) @php $plant = 0; $labour = 0; $material = 0; $subcontract = 0; $other = 0; $sales_net = 0; $sub_contracts_total = 0; $sub_contracts_other_total = 0; $estimated_net = 0; $po_total_plant = 0; $po_total_material = 0; $po_total_labour = 0; $po_total = 0; $estimated_gross_profit = 0; $actual_gross_profit = 0; @endphp @if($project->tender==1) @else @endif @endforeach @endif @endforeach
Client Projects Total Sales Estimated Gross Profit Actual Gross Profit
{{ $client->company_name }} {{ $client->projects->count() }} £{{ number_format($grand_sales, 2) }} £{{ number_format($grand_estimated_profit, 2) }} £{{ number_format($grand_actual_profit, 2) }}
@endsection @section('js') @endsection