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

{{ $product->name }}

SKU {{ $product->sku }}
Current Stock {{ $product->stock }}
Last Movement @if($stockMovements->count() > 0) {{ $stockMovements->first()->created_at->diffForHumans() }} @else Never @endif
KES {{ number_format($product->sale_price, 2) }}
Current Sale Price
{{ $stats['total_movements'] }}
Total Movements
{{ round(($stats['total_movements'] / max($product->stock, 1)) * 100) }}% of stock activity
{{ $stats['total_in'] }}
Total Stock In
{{ $stats['total_movements'] > 0 ? round(($stats['total_in'] / $stats['total_movements']) * 100) : 0 }}% of movements
{{ $stats['total_out'] }}
Total Stock Out
{{ $stats['total_movements'] > 0 ? round(($stats['total_out'] / $stats['total_movements']) * 100) : 0 }}% of movements
{{ $stats['current_stock'] }}
Current Stock Level
Net: {{ $stats['net_movement'] >= 0 ? '+' : '' }}{{ $stats['net_movement'] }}
@if(isset($chartData['typeDistribution']))
{{ $chartData['typeDistribution']['in'] ?? 0 }}
Stock In Quantity
{{ $chartData['typeDistribution']['out'] ?? 0 }}
Stock Out Quantity
@php $netChange = ($chartData['typeDistribution']['in'] ?? 0) - ($chartData['typeDistribution']['out'] ?? 0); @endphp
{{ $netChange >= 0 ? '+' : '' }}{{ $netChange }}
Net Movement
{{ $stockMovements->total() }}
Movement Records
@endif
Stock Movement Timeline ({{ $chartData['view_mode'] ?? 'Daily' }} View)
Stock In
Stock Out
Net Change
@if(($chartData['view_mode'] ?? 'daily') == 'hourly')
@foreach($chartData['hourly_transactions'] ?? [] as $hour => $transactions) @if(!empty($transactions))
{{ $hour }}:00
{{ $transactions['type'] == 'in' ? '+' : '-' }}{{ $transactions['quantity'] ?? 0 }} {{ $transactions['reason'] ?? 'Various transactions' }} {{ $transactions['count'] ?? 0 }} transactions
@endif @endforeach
@else
{{ $chartData['daily_summary']['total_in'] ?? 0 }}
Total In
{{ $chartData['daily_summary']['total_out'] ?? 0 }}
Total Out
{{ ($chartData['daily_summary']['net_change'] ?? 0) >= 0 ? '+' : '' }}{{ $chartData['daily_summary']['net_change'] ?? 0 }}
Net Change
{{ $chartData['daily_summary']['transaction_count'] ?? 0 }}
Transactions
@endif
Movement Distribution
{{ $chartData['typeDistribution']['in'] ?? 0 }}
Stock In
{{ $chartData['typeDistribution']['out'] ?? 0 }}
Stock Out
@if(isset($chartData['today_transactions']) && count($chartData['today_transactions']) > 0)
Today's Transactions ({{ count($chartData['today_transactions']) }} movements)
@foreach($chartData['today_transactions'] as $transaction)
{{ $transaction['time'] }} {{ $transaction['type'] == 'in' ? '+' : '-' }}{{ $transaction['quantity'] }}
{{ $transaction['reason'] }}
{{ $transaction['user'] }} @if($transaction['batch']) Batch: {{ $transaction['batch'] }} @endif
@endforeach
@endif
to
Export
Stock Movement History

Showing all stock movements for {{ $product->name }}

{{ $stockMovements->total() }} records found
@if($stockMovements->isEmpty())
No stock movements found

This product hasn't had any stock movements yet.

@else
@foreach($stockMovements as $movement)
{{ $movement->movement_type == 'in' ? 'STOCK IN' : 'STOCK OUT' }} {{ $movement->movement_type == 'in' ? '+' : '-' }}{{ $movement->quantity }} @if($movement->quantity_before) Stock: {{ $movement->quantity_before }} → {{ $movement->quantity_before + $movement->quantity }} @endif
{{ $movement->reason }}
@if($movement->batch || $movement->reference_number || $movement->notes)
@if($movement->batch)
Batch: {{ $movement->batch->batch_number }} @if($movement->batch->expiry_date) Expires: {{ $movement->batch->expiry_date->format('M d, Y') }} @endif
@endif @if($movement->reference_number)
Reference: {{ $movement->reference_number }}
@endif @if($movement->notes)
Notes: {{ $movement->notes }}
@endif
@endif
{{ $movement->user->name ?? 'System' }}
{{ $movement->created_at->format('h:i A') }}
{{ $movement->created_at->format('M d, Y') }}
{{ $movement->created_at->diffForHumans() }}
@endforeach
Showing {{ $stockMovements->firstItem() }} to {{ $stockMovements->lastItem() }} of {{ $stockMovements->total() }} entries
@endif
@endsection @section('script') @endsection