@php use Carbon\Carbon; @endphp
<!doctype html>
<html>
<head>
    <meta charset="utf-8">
    <title>Stock Transfer Report</title>
    <style>
        body { font-family: DejaVu Sans, sans-serif; font-size: 12px; }
        table { width: 100%; border-collapse: collapse; }
        th, td { border: 1px solid #ddd; padding: 6px; }
        th { background: #f4f4f4; }
    </style>
</head>
<body>
    <h3>Stock Transfer Report</h3>
    <table>
        <thead>
            <tr>
                <th>#</th>
                <th>Date</th>
                <th>Transfer #</th>
                <th>From Branch</th>
                <th>To Branch</th>
                <th>Product (From)</th>
                <th>Product (To)</th>
                <th>Qty</th>
            </tr>
        </thead>
        <tbody>
            @foreach($stockTransferItems as $index => $it)
                <tr>
                    <td>{{ $index + 1 }}</td>
                    <td>{{ $it->stockTransfer->date_time ? Carbon::parse($it->stockTransfer->date_time)->format('Y-m-d') : '-' }}</td>
                    <td>{{ $it->stockTransfer->id ?? '-' }}</td>
                    <td>{{ $it->stockTransfer->fromBranch->name ?? '-' }}</td>
                    <td>{{ $it->stockTransfer->toBranch->name ?? '-' }}</td>
                    <td>{{ $it->fromProduct->product_name ?? '-' }}</td>
                    <td>{{ $it->toProduct->product_name ?? '-' }}</td>
                    <td>{{ number_format($it->qty, 2) }}</td>
                </tr>
            @endforeach
        </tbody>
    </table>
</body>
</html>