@extends('layouts.app') @section('title','Purchase History') @section('content') @php($uae=fn($t)=>\Illuminate\Support\Carbon::parse($t,'UTC')->setTimezone('Asia/Dubai')->format('d M Y')) @php($keep=fn(array $extra)=>route('sales.history.index',array_filter(array_merge(request()->only(['q','customer_q','from','to','include_void']),$extra),fn($v)=>$v!==null&&$v!=='')))
{{ $company->name }} โ what each customer bought and who bought each product, from posted invoice and return lines
| {{ $by==='product'?'Product':'Customer' }} | Net qty | Net amount | Last purchase | Invoice lines |
|---|---|---|---|---|
| @if($by==='product'){{ $row->sku }} {{ $row->name }}@else{{ $row->customer_name }} {{ $row->customer_code }}@endif |
{{ \App\Support\StockQuantity::display(number_format((float)$row->quantity,4,'.','')) }} | {{ $row->currency }} {{ number_format((float)$row->total,2) }} | {{ $row->last_purchase_at ? $uae($row->last_purchase_at) : 'โ' }} | {{ $row->invoice_lines }} |
| Date | Document | Customer | Product | Qty | Unit price | Discount | Net | VAT | Total |
|---|---|---|---|---|---|---|---|---|---|
| {{ $uae($line->document_at) }} | @if($line->kind==='invoice')Invoice {{ $line->document_number }}@if($line->status==='void') Void@endif @elseReturn {{ $line->document_number }}@endif | {{ $line->customer_name }} {{ $line->customer_code }} |
{{ $line->sku_snapshot }} {{ $line->name_snapshot }} |
{{ \App\Support\StockQuantity::display(number_format((float)$line->quantity,4,'.','')) }} | {{ number_format((float)$line->gross_unit_price,4) }} | {{ $line->discount_amount===null?'โ':number_format((float)$line->discount_amount,2) }} | {{ number_format((float)$line->taxable_amount,2) }} | {{ number_format((float)$line->vat_amount,2) }} | {{ $line->currency }} {{ number_format((float)$line->line_total,2) }} |
| No lines. | |||||||||