@extends('layouts.app') @section('title', 'Laporan') @section('content') @php $reports = [ 'sales' => ['Penjualan', 'Transaksi, produk, kasir, dan metode bayar.'], 'profit' => ['HPP & Laba', 'Omzet, HPP, laba kotor, beban, dan laba bersih.'], 'inventory' => ['Inventory', 'Riwayat stok masuk, keluar, dan penyesuaian.'], 'cash' => ['Kas', 'Arus kas masuk, keluar, dan saldo.'], ]; $moneyColumns = ['subtotal', 'total_hpp', 'gross_profit', 'amount']; $formatQuantity = fn ($value) => rtrim(rtrim(number_format((float) $value, 2, ',', '.'), '0'), ','); $formatUnitTotals = fn ($rows) => collect($rows)->map(fn ($row) => $formatQuantity($row->total).' '.($row->unit ?: 'satuan'))->implode(' · ') ?: '0'; $quantityColumns = ['quantity', 'quantity_before', 'quantity_after']; $columnLabels = [ 'number' => 'Nomor', 'sold_at' => 'Waktu', 'transaction_at' => 'Waktu', 'moved_at' => 'Waktu', 'branch' => 'Cabang', 'cashier' => 'Kasir', 'product' => 'Produk', 'item' => 'Item', 'unit' => 'Satuan', 'quantity' => 'Jumlah', 'quantity_before' => 'Stok sebelum', 'quantity_after' => 'Stok sesudah', 'subtotal' => 'Penjualan', 'total_hpp' => 'HPP', 'gross_profit' => 'Laba kotor', 'payment_method' => 'Pembayaran', 'status' => 'Status', 'type' => 'Jenis', 'event' => 'Jenis baris', 'account' => 'Akun kas', 'category' => 'Kategori', 'amount' => 'Jumlah', 'description' => 'Keterangan', 'notes' => 'Catatan', ]; @endphp
{{ $reports[$type][1] }}
{{ $stockRows->count() }} item aktif pada cabang yang dipilih.
| Cabang | Item | Jenis | Stok saat ini | Satuan |
|---|---|---|---|---|
| {{ $row->branch }} | {{ $row->item }} | {{ $row->item_type }} | {{ $formatQuantity($row->quantity) }} | {{ $row->unit }} |
| Belum ada bahan BOM atau produk stok langsung aktif. | ||||
Saldo awal dan saldo akhir selalu memakai seluruh transaksi kas periode ini, apa pun filternya. Kartu kas masuk dan keluar mengikuti filter metode pembayaran.
@endif @endif{{ $rows->total() }} baris ditemukan sesuai filter.
| {{ $columnLabels[$column] ?? str_replace('_', ' ', ucfirst($column)) }} | @endforeach @endif|||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| @if(in_array($key, $moneyColumns)) Rp{{ number_format($value, 0, ',', '.') }} @elseif(in_array($key, $quantityColumns)) {{ $formatQuantity($value) }} @else {{ $value }} @endif | @endforeach|||||||||||||||||||
| Belum ada data pada periode dan filter ini. | |||||||||||||||||||