@extends('admin.layouts.master') @section('title', 'تحليل الفاقد') @section('page-header') @include('admin.reports._header', [ 'title' => 'تحليل الفاقد التفصيلي', 'subtitle' => 'تحديد مصادر وأسباب الفاقد لاتخاذ قرارات تحسين فعّالة', 'icon' => 'ti-trash-x', 'color' => 'danger', ]) @endsection @section('content') @include('admin.reports._filters', ['from'=>$from, 'to'=>$to, 'showCompare'=>false]) @php $insights = []; if ($wasteRate > 5) $insights[] = ['type'=>'negative', 'text'=>"نسبة الفاقد {$wasteRate}% أعلى من الحد الصحي (3-5%)"]; elseif ($wasteRate <= 3) $insights[] = ['type'=>'positive', 'text'=>"نسبة الفاقد {$wasteRate}% في النطاق الممتاز"]; else $insights[] = ['type'=>'warning', 'text'=>"نسبة الفاقد {$wasteRate}% ضمن الحد المقبول"]; if ($byReason->isNotEmpty()) { $top = $byReason->first(); $topPct = $totalCost > 0 ? round($top['cost']/$totalCost*100, 1) : 0; $insights[] = ['type'=>'warning', 'text'=>"".$top['reason']." يشكل {$topPct}% من تكلفة الفاقد - أولوية للحل"]; } if ($byStage->isNotEmpty()) { $topS = $byStage->first(); $insights[] = ['type'=>'warning', 'text'=>"أكثر مرحلة فاقد: ".$topS['stage']." بتكلفة ".number_format($topS['cost'], 0)." ج"]; } @endphp @if(!empty($insights))
| # | الصنف | الكمية | التكلفة | نسبة من الإجمالي |
|---|---|---|---|---|
| {{ $i + 1 }} | {{ $row['item'] }} | {{ number_format($row['qty'], 2) }} | {{ number_format($row['cost'], 2) }} |
@php $pct = $totalCost > 0 ? round($row['cost']/$totalCost*100, 1) : 0; @endphp
{{ $pct }}%
|
| لا يوجد فاقد مسجل | ||||
| التاريخ | البطاقة | المرحلة | الصنف | الكمية | التكلفة | السبب |
|---|---|---|---|---|---|---|
| {{ $w->waste_date?->format('Y-m-d') }} | {{ $w->jobTicket?->ticket_no }} | {{ $w->jobStage?->productionStage?->name ?? '-' }} | {{ $w->item?->name ?? '-' }} | {{ number_format($w->quantity, 2) }} | {{ number_format($w->estimated_cost, 2) }} | {{ $w->reason ?? 'غير محدد' }} |