@extends('pages.admin.layout') @section('content')
@php $now = \Carbon\Carbon::now(); if($now->format('l') !== "Wednesday" && $now->format('l') !== "Friday") $now = \Carbon\Carbon::parse('last friday'); $prevWeek = App\OrderAvailablity::where("week_year", ($now->weekOfYear).$now->year)->first(); $selected = Request::query('weekID') ?? FALSE; $now = \Carbon\Carbon::now(); if ($now->format('l') !== "Friday") $now = \Carbon\Carbon::parse('next friday'); $now = $now->hour(23)->minute(59)->second(59); if(!$selected) { $currentWeekID = App\OrderAvailablity::where("week_year", $now->weekOfYear . $now->year)->first(); } else { $currentWeekID = App\OrderAvailablity::where("id", $selected)->first(); } $type = Request::query('type') ?? FALSE; $orderArea = Request::query('orderArea') ?? FALSE; @endphp
{{ method_field('get') }} @csrf
Supplier Report for: {{$currentWeekID->title}} - Type: {{$type}}
@if($supplierDetails->suppliers->count() > 0)
@foreach($supplierDetails->suppliers->sortBy("name") as $supplier) @if($supplier) @php $supplierCategories = array(); @endphp @foreach($supplier->products->sortBy("category") as $item) @if(!isset($supplierCategories[$item->category])) @php $supplierCategories[$item->category] = true; @endphp @endif @endforeach @endif @endforeach
Name Quantity Unit Price Amount Owed
{{$supplier->name}} (ID: {{$supplier->id}}) Download PDF {{$supplier->product_count}} £{{ number_format($supplier->totalowed, 2)}}
{{$item->category}}
@php if($item) { echo($item->product_name); } @endphp - @php if($item->item_name) { echo($item->item_name); } else {echo 'N/A';} @endphp {{ $item->quantity}} £{{ number_format($item->price, 2)}} £{{ number_format($item->owed, 2)}}
@else
@endsection @section('scripts') @endsection