@extends('layouts.app') @section('title', 'Expenses - ' . setting('system_name')) @section('content')

Expenses

Running costs such as rent, wages and electricity. They are taken off your profit in the @if(auth()->user()->hasPermission('view_profit_loss_report')) Profit & Loss report. @else Profit & Loss report. @endif

{{-- Add an expense --}} @if(auth()->user()->hasPermission('add_expense'))
Record an expense
@csrf
@error('expense_date')
{{ $message }}
@enderror
@error('category')
{{ $message }}
@enderror
@error('amount')
{{ $message }}
@enderror
@php $drawer = \App\Http\Controllers\RegisterController::getOpenRegister(); @endphp @if($drawer) {{-- Cash taken out of the till: lowers that register's expected cash, so it is not counted as a shortage --}}
@endif
@endif
{{-- Totals by category --}}
{{ $from->format('d M Y') }} – {{ $to->format('d M Y') }}
Total expenses
{{ formatCurrency($total) }}
@forelse($byCategory as $row)
{{ $row->category }} ({{ $row->count }}) {{ formatCurrency($row->total) }}
@empty

No expenses recorded for this period.

@endforelse
{{-- List --}}
@if(auth()->user()->hasPermission('delete_expense'))@endif @forelse($expenses as $expense) @if(auth()->user()->hasPermission('delete_expense')) @endif @empty @endforelse
Date Category Note Recorded by AmountDelete
{{ $expense->expense_date->format('d M Y') }} {{ $expense->category }} {{ $expense->description }} {{ $expense->user->name ?? '—' }} {{ formatCurrency($expense->amount) }}
@csrf @method('DELETE')
No expenses in this period.
@if($expenses->hasPages())
{{ $expenses->links() }}
@endif
@endsection