@extends('layouts.app') @section('title', 'Branch Stock Report') @push('styles') @endpush @section('content') @can('view_branch_stock')

Branch Stock Report

Stock levels across all branches

PDF
@if(auth()->user()->canAccessAllData())
@include('reports.partials.branch-filter')
@endif

Total Branches

{{ $branchesWithStock->count() }}

Total Items

{{ $totalProducts }}

Total Quantity

{{ number_format($totalQuantity) }}

Total Value

{{ $currency }}{{ number_format($totalValue, 2) }}

@forelse($branchesWithStock as $branch)

{{ $branch->name }}

{{ $branch->products->count() }} items | Total: {{ $branch->products->sum('pivot.quantity') }} qty

Value

{{ $currency }}{{ number_format($branch->products->sum(fn($m) => $m->pivot->quantity * $m->cost_price), 2) }}

@if($branch->products->count() > 0)
@foreach($branch->products as $product) @endforeach
Product Category Qty Cost Price Subtotal
{{ $product->name }} {{ $product->category->name }} {{ $product->pivot->quantity }} {{ $currency }}{{ number_format($product->cost_price, 2) }} {{ $currency }}{{ number_format($product->pivot->quantity * $product->cost_price, 2) }}
Total {{ $branch->products->sum('pivot.quantity') }} {{ $currency }}{{ number_format($branch->products->sum(fn($m) => $m->pivot->quantity * $m->cost_price), 2) }}
@else

No stock assigned to this branch.

@endif
@empty

No branch stock data available

Assign stock to branches from product create/edit forms.

@endforelse @endcan @endsection