@extends('layouts.admin') @section('page-title', 'Expense Report') @section('page-subtitle', 'Filter, review, and export employee expenses') @section('content') @php use Illuminate\Support\Str; @endphp
{{-- FILTER CARD --}}

Filters

Choose a month or custom date range. You can also filter by employee.

{{-- Export button --}}
{{-- Month --}}

If selected, from/to will auto-fill for that month.

{{-- From Date --}}
{{-- To Date --}}
{{-- Employee --}}
Reset
{{-- SUMMARY STRIP --}}
Total Records
{{ $totalRecords ?? 0 }}
Total Amount
₹ {{ number_format($totalAmount ?? 0, 2) }}
Active Session
{{ $activeSession->name ?? 'Not Set' }}
Current Range
@if($fromDate || $toDate) {{ $fromDate ?? '...' }} – {{ $toDate ?? '...' }} @else All dates @endif
@if($mode === 'summary') {{-- SUMMARY TABLE --}}
Employee Summary
Showing top employees by expense
@forelse($summaryData as $row) @empty @endforelse
Employee Name Emp Code No. of Claims Total Amount (₹) Action
{{ $row->name }} {{ $row->employee->emp_code ?? '-' }} {{ $row->expenses_count }} ₹ {{ number_format($row->expenses_sum_amount, 2) }} View Details
No expenses found for this period.
@else {{-- DETAIL TABLE --}}
{{ $selectedEmployee->name ?? 'Employee' }}
Detailed Expense Report
{{ $expenses->total() }} records found
@forelse($expenses as $exp) @php $files = []; if (!empty($exp->proof_paths) && is_array($exp->proof_paths)) { $files = $exp->proof_paths; } elseif (!empty($exp->proof_path)) { $files = [['path' => $exp->proof_path, 'original_name' => $exp->proof_original_name ?? basename($exp->proof_path)]]; } @endphp @empty @endforelse
Date Group Party Purpose Amount (₹) Session Created Attachments
{{ $exp->expense_date?->format('d M Y') }}
{{ $exp->created_at?->diffForHumans() }}
{{ $exp->group ?? 'General' }} {{ $exp->party_name ?? '-' }}
{{ $exp->purpose ?? '-' }}
₹ {{ number_format($exp->amount, 2) }} {{ optional($exp->financialSession)->name ?? '-' }} {{ $exp->created_at?->format('d M Y H:i') }} @if(count($files))
@foreach($files as $f) @php $filePath = $f['path'] ?? ''; $origName = $f['original_name'] ?? basename($filePath); $downloadUrl = route('admin.expenses.download', $exp->id) . '?file=' . urlencode($filePath); @endphp @endforeach
@else
@endif
No expenses found for this employee in selected period.
{{-- Pagination --}} @if($expenses->hasPages())
{{ $expenses->links() }}
@endif
@endif @endsection