Laporan Penjualan

Tanggal Cetak: {{ date('d/m/Y H:i') }}

@foreach ($penjualan as $p)
Faktur: {{ $p->faktur ?? '-' }}
Customer: {{ $p->customer->nama ?? 'Umum' }}
Alamat: {{ $p->customer->alamat ?? '-' }}
Catatan: {{ $p->catatan ?? '-' }}
Tanggal/Jam: {{ date('d-m-Y H:i', strtotime($p->created_at)) }}
Kasir: {{ $p->user->nama ?? '-' }}
Total Barang: {{ $p->PenjualanBarang->count() }}
@foreach ($p->PenjualanBarang as $index => $barang) @endforeach
No Kode Nama Produk Qty Harga Jual Diskon Subtotal Profit
{{ $index + 1 }} {{ $barang->barang->kode ?? '-' }} {{ $barang->barang->nama ?? '-' }} {{ $barang->qty }} / {{ $barang->barang->satuan->nama ?? 'Qty' }} Rp {{ number_format($barang->harga_jual, 0, ',', '.') }} Rp {{ number_format($barang->diskon, 0, ',', '.') }} Rp {{ number_format($barang->total_calculated, 0, ',', '.') }} Rp {{ number_format($barang->total_profit, 0, ',', '.') }}
Diskon Penjualan Rp {{ number_format($p->diskon, 0, ',', '.') }}
Subtotal Rp {{ number_format($p->PenjualanBarang->sum(function($b){ return $b->subtotal; }), 0, ',', '.') }} Rp {{ number_format($p->PenjualanBarang->sum('diskon'), 0, ',', '.') }} Rp {{ number_format($p->PenjualanBarang->sum(function($b) use ($p){ return $b->subtotal - $p->diskon; }), 0, ',', '.') }} Rp {{ number_format($p->PenjualanBarang->sum(function($b) use($p) { return $b->subtotal_profit - $p->diskon; }), 0, ',', '.') }}
@endforeach