@extends('layouts.app') @push('css') {{-- @include('components.dataTable-style-links') --}} @endpush @section('content')
@php $totalPrice = 0; @endphp @foreach ($Purchase as $purchase) @foreach ($purchase->items as $index => $item) @php $received = ($item->inventoryItem->total_received ?? 0) - ($item->inventoryItem->total_in_stock ?? 0); $remaining = ($item->value ?? 0) - $received; $itemTotal = ($item->value ?? 0) * ($item->price ?? 0); $totalPrice += $itemTotal; @endphp @endforeach @endforeach
{{ __('ID') }}
{{ Auth::user()->id ?? __('Guest') }}
{{ __('Item name') }} {{ __('Supplier') }} {{ __('Reserved quantity') }} {{ __('Received') }} {{ __('Remaining Quantity') }} {{ __('Price') }} {{ __('Total Price') }}
{{ $loop->iteration }} {{ $item->item->name ?? 'N/A' }} {{ $item->supplier->name ?? 'N/A' }} {{ $item->value ?? 0 }} {{ $received }} {{ $remaining }} {{ $item->price ?? 0 }} {{ number_format($itemTotal, 2) }}
{{ __('All Total') }} {{ number_format($totalPrice, 2) }}
@php $grandTotal = 0; @endphp @foreach ($groupedByCustomer as $customerName => $items) @php $customerTotal = 0; @endphp @foreach ($items as $item) @php $quantity = $item->value ?? 0; $received_quantity = $item->inventoryItem->total_received_without_changes ?? 0; $remaining = ($item->value ?? 0) - $received_quantity; $price = $item->price ?? 0; $total = $quantity * $price; $customerTotal += $total; $grandTotal += $total; @endphp @endforeach @endforeach
{{ __('Serial Number') }} {{ __('Item Name') }} {{ __('Quantity') }} {{ __('Reserved Quantity') }} {{ __('Remaining Quantity') }} {{ __('Price') }} {{ __('Total') }}
{{ $customerName }}
{{ $item->sale->serial_number }} {{ $item->item->name ?? 'N/A' }} {{ $quantity }} {{ $received_quantity }} {{ $remaining }} {{ number_format($price, 2) }} {{ number_format($total, 2) }}
{{ __('Subtotal for') }} {{ $customerName }} {{ number_format($customerTotal, 2) }}
{{ __('Grand Total') }} {{ number_format($grandTotal, 2) }}
@endsection @section('scripts') @endsection