Medicine Stock History
{{ $medicine->name }}
Generated on
{{ date('d M Y, h:i A') }}
Report Type: {{ $reportType === 'central' ? 'Central Stock Report' : 'Health Post Stock Report' }}
Total Transactions: {{ count($data) }}
@if(count($data) > 0)
Current Balance: {{ $data[count($data) - 1]['balance'] }} {{ $data[0]['unit'] }}
@endif
@php $totalIn = 0; $totalOut = 0; @endphp @foreach($data as $index => $entry) @php $totalIn += $entry['qty_in']; $totalOut += $entry['qty_out']; $rowClass = ''; if ($entry['type'] === 'Opening Stock') $rowClass = 'bg-opening'; elseif (str_contains($entry['type'], 'Stock Pull')) $rowClass = 'bg-pull'; elseif ($entry['type'] === 'Received from Central') $rowClass = 'bg-received'; elseif ($entry['type'] === 'Distributed to Patient') $rowClass = 'bg-distributed'; @endphp @endforeach
Date Transaction Batch Qty In Qty Out Balance Mfg Date Exp Date
{{ \Carbon\Carbon::parse($entry['date'])->format('d M Y') }}
{{ \Carbon\Carbon::parse($entry['date'])->format('h:i A') }}
{{ $entry['type'] }} {{ $entry['batch_no'] ?? '-' }} {{ $entry['qty_in'] > 0 ? '+' . $entry['qty_in'] : '-' }} {{ $entry['qty_out'] > 0 ? '-' . $entry['qty_out'] : '-' }} {{ $entry['balance'] }} {{ $entry['mfg_date'] ? \Carbon\Carbon::parse($entry['mfg_date'])->format('d-m-Y') : '-' }} {{ $entry['exp_date'] ? \Carbon\Carbon::parse($entry['exp_date'])->format('d-m-Y') : '-' }}
TOTALS: +{{ $totalIn }} -{{ $totalOut }} {{ count($data) > 0 ? $data[count($data) - 1]['balance'] : 0 }}