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

Stock Report

@foreach($products as $p) @php $in = $p->purchaseItems->sum('qty'); $out = $p->saleItems->sum('qty'); $avail = $in - $out; @endphp @endforeach
ID Product In Qty Out Qty Available
{{ $p->id }} {{ $p->name }} {{ $in }} {{ $out }} {{ $avail }}
@endsection