<?= $this->extend('layouts/main') ?>
<?= $this->section('content') ?>

<h4 class="mb-4">Laporan Barang Masuk</h4>

<table class="table table-bordered table-striped">
    <thead>
        <tr>
            <th>#</th>
            <th>Kode</th>
            <th>Tanggal</th>
            <th>Nama Barang</th>
            <th>Qty</th>
            <th>Harga</th>
            <th>Total</th>
            <th>Petugas</th>
        </tr>
    </thead>
    <tbody>
        <?php foreach ($product_in as $key => $p): ?>
        <tr>
            <td><?= $key + 1 ?></td>
            <td><?= esc($p['kode'] ?? '-') ?></td>
            <td><?= date('d-m-Y', strtotime($p['tanggal_masuk'] ?? 'now')) ?></td>
            <td><?= esc($p['item_name'] ?? '-') ?></td>
            <td><?= esc($p['qty'] ?? 0) ?></td>
            <td>Rp <?= number_format($p['harga'] ?? 0, 0, ',', '.') ?></td>
            <td>Rp <?= number_format(($p['qty'] ?? 0) * ($p['harga'] ?? 0), 0, ',', '.') ?></td>
            <td><?= esc($p['username'] ?? '-') ?></td>
        </tr>
        <?php endforeach ?>
    </tbody>
</table>

<?= $this->endSection() ?>
