@extends('layouts.app') @section('title', 'Laporan Penjualan') @section('page-title', 'Laporan Penjualan') @section('content')
{{-- Filter --}}
Reset {{-- Quick date shortcuts --}}
@foreach(['Hari Ini' => [now()->format('Y-m-d'), now()->format('Y-m-d')], 'Minggu Ini' => [now()->startOfWeek()->format('Y-m-d'), now()->format('Y-m-d')], 'Bulan Ini' => [now()->startOfMonth()->format('Y-m-d'), now()->format('Y-m-d')]] as $label => $range) {{ $label }} @endforeach
{{-- Summary Cards --}}
TOTAL TRANSAKSI
{{ $summary->total_trx ?? 0 }}
TOTAL PENJUALAN
Rp {{ number_format($summary->total_sales ?? 0, 0, ',', '.') }}
RATA-RATA TRANSAKSI
Rp {{ number_format($summary->avg_transaction ?? 0, 0, ',', '.') }}
TOTAL DISKON
Rp {{ number_format($summary->total_discount ?? 0, 0, ',', '.') }}
{{-- Payment method split --}}

💳 Metode Pembayaran

@foreach(['cash' => ['💵 Tunai', 'emerald'], 'transfer' => ['🏦 Transfer', 'blue'], 'qris' => ['📱 QRIS', 'purple']] as $key => [$label, $color]) @php $val = $summary->{"${key}_sales"} ?? 0; $total = $summary->total_sales ?: 1; $pct = round($val/$total*100); @endphp
{{ $label }} Rp {{ number_format($val, 0, ',', '.') }}
{{ $pct }}%
@endforeach
{{-- Produk Terlaris --}}

🏆 Produk Terlaris

@forelse($topProducts as $i => $p) @empty @endforelse
# Produk Qty Terjual Revenue
{{ $i+1 }} {{ $p->product_name }} {{ $p->qty_sold }} Rp {{ number_format($p->total_revenue, 0, ',', '.') }}
Tidak ada data
{{-- Grafik Harian --}} @if($dailyData->count() > 0)

📊 Grafik Penjualan Harian

@endif {{-- Tabel Transaksi --}}

Daftar Transaksi

{{ $transactions->total() }} transaksi
@forelse($transactions as $trx) @empty @endforelse
No. Invoice Tanggal Kasir Pelanggan Item Metode Total Struk
{{ $trx->invoice_number }} {{ $trx->transaction_date->format('d/m/Y H:i') }} {{ $trx->user->name }} {{ $trx->customer_name ?? 'Umum' }} {{ $trx->items->count() }} {{ strtoupper($trx->payment_method) }} Rp {{ number_format($trx->grand_total, 0, ',', '.') }}
Tidak ada transaksi pada periode ini
{{ $transactions->withQueryString()->links() }}
{{-- Hidden Iframe for Printing --}} @push('scripts') {{-- Modal Detail --}} @endpush @endsection