@extends('layouts.app') @section('content')

{{ __('Inventory Movement Report') }}

{{ __('Track product movements through purchase orders and receipts') }}

@if($data && count($data) > 0) @endif
@if($data && count($data) > 0)

{{ __('Total Orders') }}

{{ count($data) }}

{{ __('Total Ordered') }}

{{ $data->sum('quantity_ordered') }}

{{ __('Total Received') }}

{{ $data->sum('quantity_received') }}

{{ __('Pending Reception') }}

{{ $data->sum(function($item) { return $item['quantity_ordered'] - $item['quantity_received']; }) }}

@endif
@if($data && count($data) > 0)
@forelse($data as $movement) @empty @endforelse
# {{ __('PO Number') }} {{ __('PO Date') }} {{ __('Quantity Ordered') }} {{ __('Quantity Received') }} {{ __('Pending') }} {{ __('Reception %') }} {{ __('Status') }}
{{ $loop->iteration }} {{ $movement['po_number'] }} {{ \Carbon\Carbon::parse($movement['po_date'])->format('Y-m-d') }}

{{ \Carbon\Carbon::parse($movement['po_date'])->diffForHumans() }}

{{ $movement['quantity_ordered'] }} {{ $movement['quantity_received'] }} @php $pending = $movement['quantity_ordered'] - $movement['quantity_received']; $badgeClass = $pending == 0 ? 'bg-gray-100 text-black' : 'bg-yellow-100 text-yellow-700'; @endphp {{ $pending }} @php $percentage = $movement['quantity_ordered'] > 0 ? round(($movement['quantity_received'] / $movement['quantity_ordered']) * 100) : 0; @endphp
{{ $percentage }}%
@php $statusConfig = [ 'draft' => ['class' => 'bg-gray-100 text-black', 'icon' => 'fa-file-alt'], 'sent' => ['class' => 'bg-blue-100 text-blue-700', 'icon' => 'fa-paper-plane'], 'received' => ['class' => 'bg-green-100 text-green-700', 'icon' => 'fa-check-circle'], 'completed' => ['class' => 'bg-green-100 text-green-700', 'icon' => 'fa-check-double'], 'cancelled' => ['class' => 'bg-red-100 text-red-700', 'icon' => 'fa-times-circle'], 'pending' => ['class' => 'bg-yellow-100 text-yellow-700', 'icon' => 'fa-pause-circle'], ]; $config = $statusConfig[$movement['status']] ?? $statusConfig['pending']; @endphp {{ __(ucfirst($movement['status'])) }}

{{ __('No movements found') }}

{{ __('No inventory movements match your criteria') }}

@else

{{ __('No Data Available') }}

{{ __('Please select a product to view its inventory movements') }}

{{ __('Back to Products') }}
@endif
@if($data && count($data) > 0)

{{ __('Quantity Comparison') }}

{{ __('Reception Progress') }}

@endif
@push('scripts') @endpush @endsection