@push('header') @endpush {{-- Status Messages --}} @if (session('success'))
{{ session('success') }}
@endif @if (session('error'))
{{ session('error') }}
@endif {{-- Validation Errors --}} @if ($errors->any())
    @foreach ($errors->all() as $error)
  • {{ $error }}
  • @endforeach
@endif {{-- Filter Section --}}
{{-- Supplier --}}
{{-- Date From --}}
{{-- Date To --}}
{{-- Category --}}
{{-- Posted Status --}}
{{-- Per Page --}}
{{-- Summary Cards --}}
Opening Balance
{{ number_format($openingBalance, 2) }}
Period Expenses
{{ number_format($totalAmount, 2) }}
Closing Balance
{{ number_format($closingBalance, 2) }}
Total Entries
{{ $expenses->total() }}
{{-- Main Report --}}
{{-- Report Header --}}

Moon Traders
Expense Detail Report
@if ($dateFrom && $dateTo) Period: {{ \Carbon\Carbon::parse($dateFrom)->format('d-M-Y') }} to {{ \Carbon\Carbon::parse($dateTo)->format('d-M-Y') }} @elseif ($dateTo) As of: {{ \Carbon\Carbon::parse($dateTo)->format('d-M-Y') }} @endif @if ($selectedSupplier)
{{ $selectedSupplier->supplier_name }} @endif @if ($category)
Category: {{ $categoryOptions[$category] ?? $category }} @endif

Printed by: {{ auth()->user()->name }} | {{ now()->format('d-M-Y h:i A') }}
{{-- Data Table --}}
@php $runningBalance = $openingBalance; @endphp {{-- Opening Balance Row --}} @if ($openingBalance != 0) @endif @forelse ($expenses as $index => $expense) @php $amount = (float) $expense->amount; $runningBalance += $amount; @endphp @canany(['expense-detail-edit', 'expense-detail-post', 'expense-detail-delete']) @endcanany @empty @endforelse {{-- Inline Add Form Row --}} @can('expense-detail-create') @endcan {{-- Footer Totals --}}
Sr# Txn Date Supplier Category Description Amount Closing Balance Actions
Opening Balance @if ($dateFrom) (Before {{ \Carbon\Carbon::parse($dateFrom)->format('d-M-Y') }}) @endif - {{ number_format($openingBalance, 2) }}
{{ $expenses->firstItem() + $index }} {{ $expense->transaction_date->format('d.m.Y') }} {{ $expense->supplier?->short_name ?? $expense->supplier?->supplier_name ?? '-' }} {{ $categoryOptions[$expense->category] ?? $expense->category }} {{ $expense->description ?? '-' }} @if ($expense->category === 'fuel' && $expense->vehicle)
Van: {{ $expense->vehicle->vehicle_number ?? '' }} | {{ $expense->liters ? number_format($expense->liters, 2).'L' : '' }} @endif @if ($expense->category === 'salaries' && $expense->employee)
{{ $expense->employee->name ?? '' }} ({{ $expense->employee_no ?? '' }}) @endif
{{ number_format($amount, 2) }} {{ number_format($runningBalance, 2) }} @if (!$expense->isPosted())
@can('expense-detail-post') @endcan @can('expense-detail-edit') @endcan @can('expense-detail-delete')
@csrf @method('DELETE')
@endcan
@else @endif
No expense entries found for the selected filters.
@csrf {{-- Dynamic fields for Fuel --}} {{-- Dynamic fields for Salaries --}}
+ Auto
Period Totals ({{ $expenses->total() }} entries) {{ number_format($totalAmount, 2) }} {{ number_format($closingBalance, 2) }}
{{-- Add Entry Toggle Button --}} @can('expense-detail-create')
@endcan
{{-- Expense Summary --}} @if ($selectedSupplier)
Expense Summary - {{ $selectedSupplier->short_name ?? $selectedSupplier->supplier_name }}
@foreach ($categoryOptions as $catKey => $catLabel) @endforeach
{{ $catLabel }}:- {{ number_format($categoryTotals[$catKey] ?? 0, 2) }}
Total:- {{ number_format($totalAmount, 2) }}
Closing Balance:- {{ number_format($closingBalance, 2) }}
@endif {{-- Pagination --}} @if ($expenses->hasPages())
{{ $expenses->links() }}
@endif
{{-- Edit Modal --}} @can('expense-detail-edit') @endcan @can('expense-detail-post')

Are you sure you want to post this expense to the General Ledger? This action cannot be reversed.

@endcan @push('scripts') @endpush