@extends('layouts.admin') @section('title', 'Purchase Order Details') @section('breadcrumb-title', 'Details') @section('breadcrumb-item') @endsection @section('content')
Purchase Order Details
Vendor {{ optional($purchase_order->supplier)->name }}
Order number {{ $purchase_order->order_number }}
Date {{ $purchase_order->date }}
Status {{ $purchase_order->status_name }}
Products
@php $groupedProducts = $purchase_order->products->groupBy('name')->map( function ($products, $name) { $firstProduct = $products->first(); $quantity = $products->sum('pivot.quantity'); $sub_total = $products->sum( function ($product) { return $product->pivot->quantity * $product->pivot->unit_price; }); return [ 'description' => $firstProduct->pivot->description, 'quantity' => $quantity, 'batch' => $firstProduct->pivot->batch, 'mfg_date' => $firstProduct->pivot->mfg_date, 'exp_date' => $firstProduct->pivot->exp_date, 'unit_price' => $firstProduct->pivot->unit_price, 'sub_total' => $sub_total, ]; }); @endphp @foreach($groupedProducts as $index => $details) @endforeach
# Product Description Quantity Batch Mfg Date Exp Date Unit Price Total
{{ $loop->iteration }} {{ $index }} {{ $details['description'] }} {{ $details['quantity'] }} {{ $details['batch'] }} {{ $details['mfg_date'] }} {{ $details['exp_date'] }} {{ $details['unit_price'] }} {{ $details['sub_total'] }}
Total {{ $purchase_order->total }}
@if(!$purchase_order->received) Receive Inventory @endif
@endsection