← Back to reports
@if (session('error'))
{{ session('error') }}
@endif

Stock Register

Pick a warehouse, then tick the transfers and purchases that brought stock in and the sales that took it out. You get one column per document and a balance per product.

@can('reports.export') @if ($register && $register['rows']) @endif @endcan
@if (! $warehouse)
@else
@php $groups = [ ['key' => 'transfers', 'model' => 'transferIds', 'title' => 'Transfers in', 'rows' => $documents['transfers']], ['key' => 'receipts', 'model' => 'receiptIds', 'title' => 'Purchases received', 'rows' => $documents['receipts']], ['key' => 'sales', 'model' => 'saleIds', 'title' => 'Sales', 'rows' => $documents['sales']], ]; @endphp @foreach ($groups as $group)
{{ $group['title'] }}
@forelse ($group['rows'] as $doc) @empty
None in this date range
@endforelse
@if ($group['rows']->count() >= $listLimit)
Showing the latest {{ $listLimit }} - narrow the dates to see older ones.
@endif
@endforeach
@if ($register && $register['rows']) @php $nIn = count($register['ins']); $nOut = count($register['outs']); $colTotalsIn = array_fill(0, $nIn, 0); $colTotalsOut = array_fill(0, $nOut, 0); $grandIn = $grandOut = 0; @endphp
@foreach ($register['ins'] as $c) @endforeach @foreach ($register['outs'] as $c) @endforeach @foreach ($register['rows'] as $n => $row) @php $in = array_sum($row['in']); $out = array_sum($row['out']); $balance = $in - $out; $grandIn += $in; $grandOut += $out; @endphp @foreach ($row['in'] as $i => $q) @php $colTotalsIn[$i] += $q; @endphp @endforeach @foreach ($row['out'] as $i => $q) @php $colTotalsOut[$i] += $q; @endphp @endforeach @endforeach @foreach ($colTotalsIn as $t) @endforeach @foreach ($colTotalsOut as $t) @endforeach
Sl Product
{{ $c['top'] }}
{{ $c['bottom'] }}
Total Pieces
{{ $c['top'] }}
{{ $c['bottom'] }}
Total Sold Balance Stock
{{ $n + 1 }} {{ $row['product'] }}{{ $q ?: '-' }}{{ $in ?: '-' }}{{ $q ?: '-' }}{{ $out ?: '-' }} $balance < 0, 'text-gray-800 dark:text-gray-100' => $balance >= 0, ])>{{ $balance ?: '-' }}
Total · {{ count($register['rows']) }} {{ \Illuminate\Support\Str::plural('product', count($register['rows'])) }}{{ $t ?: '-' }}{{ $grandIn ?: '-' }}{{ $t ?: '-' }}{{ $grandOut ?: '-' }} {{ ($grandIn - $grandOut) ?: '-' }}
Balance = stock in − sold, over the ticked documents only. A red cell means more was sold than came in. Stock held at {{ $warehouse->name }} before the first document is not included.
Sales are net of goods returned against them and include free (scheme) units.
@elseif ($register)
@else
@endif @endif