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

المنتجات المشتراة

تقرير شامل للمنتجات والأصناف المشتراة من الموردين

@if(!empty($data))

إجمالي المنتجات

{{ count($data) }}

إجمالي الكميات

{{ number_format($data->sum('total_quantity'), 0) }}

إجمالي التكاليف

{{ number_format($data->sum('total_cost'), 2) }} ر.س

متوسط السعر

{{ number_format($data->count() > 0 ? $data->sum('total_cost') / $data->sum('total_quantity') : 0, 2) }} ر.س

@endif
@forelse($data as $item) @empty @endforelse
# اسم المنتج الكمية الإجمالية التكلفة الإجمالية متوسط السعر عدد الموردين النسبة المئوية
{{ $loop->iteration }}
{{ $item['product_name'] ?? 'غير معروف' }}

ID: {{ $item['product_id'] }}

{{ number_format($item['total_quantity'], 0) }} وحدة {{ number_format($item['total_cost'], 2) }} ر.س @if($item['total_quantity'] > 0) {{ number_format($item['total_cost'] / $item['total_quantity'], 2) }} ر.س @else - @endif {{ $item['supplier_count'] ?? 1 }} موردين

{{ number_format(($item['total_cost'] / $data->sum('total_cost') * 100) ?? 0, 1) }}%

لا توجد بيانات حالياً

لم يتم شراء أي منتجات بعد

@if(!empty($data) && count($data) > 0)

إجمالي المنتجات

{{ count($data) }}

إجمالي الكميات المشتراة

{{ number_format($data->sum('total_quantity'), 0) }} وحدة

إجمالي المصروفات

{{ number_format($data->sum('total_cost'), 2) }} ر.س

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

أعلى 10 منتجات بالتكلفة

@foreach($data->take(10) as $item)

{{ $item['product_name'] ?? 'غير معروف' }}

{{ number_format($item['total_quantity'], 0) }} وحدة × {{ number_format($item['total_cost'] / max($item['total_quantity'], 1), 2) }} ر.س

{{ number_format($item['total_cost'], 2) }} ر.س

{{ number_format(($item['total_cost'] / $data->sum('total_cost') * 100), 1) }}% من الإجمالي

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