<div class="headlap">
    <h3>LAPORAN DATA PENGELUARAN <br>
        {{ $data['tgl1'] }} - {{ $data['tgl2'] }}
    </h3>
    <div style="border:1px solid; margin: 10px"></div>
    <table class="lap">
        <thead>
            <tr>
                <th>No</th>
                <th>No. Pengeluaran</th>
                <th>Supplier</th>
                <th>Tanggal</th>
                <th>Total</th>
            </tr>
        </thead>
        <tbody>
            @php
                $ttl = [];
            @endphp
            @forelse ($pengeluaran as $p)
                @php
                    $ttl[] = $p->total;
                @endphp
                <tr>
                    <td class="text-center">{{ $no++ }}</td>
                    <td>{{ $p->kd_pengeluaran }}</td>
                    <td>{{ $p->supplier->nm_supplier }}</td>
                    <td>{{ tgl_time($p->created_at) }}</td>
                    <td class="text-right">{{ $p->total }}</td>
                </tr>
            @empty
                <tr>
                    <td colspan="5" class="text-center">Data tidak ditemukan</td>
                </tr>
            @endforelse

        @empty(!array_sum($ttl))
            <tr style="background-color: rgb(241, 210, 210)">

                <td class="text-center" style="font-size:17px; font-weight: bold" colspan="4">Jumlah Total</td>
                <td class="text-right" style="font-size:17px; font-weight: bold">
                    {{ array_sum($ttl) }}
                </td>
            </tr>
        @endempty

    </tbody>
</table>

</div>
