@extends('layouts.app') @section('title', 'Financial Report - ' . $project->name) @section('content')
Back to Project

Financial Report

{{ $project->name }}

@php $budget = $project->budget; $budgetUtilization = $budget > 0 ? min(($totalExpense / $budget) * 100, 100) : 0; $budgetRemaining = $budget > 0 ? max($budget - $totalExpense, 0) : 0; $profitMargin = $totalIncome > 0 ? (($totalIncome - $totalExpense) / $totalIncome) * 100 : 0; @endphp

{{ $project->name }}

{{ $project->description ?? 'No description' }}

Report generated: {{ now()->format('M d, Y H:i') }}

Status

{{ str_replace('_', ' ', ucfirst($project->status)) }}

Priority

{{ ucfirst($project->priority) }}

Timeline

@if($project->start_date) {{ $project->start_date->format('M d, Y') }} @if($project->end_date) — {{ $project->end_date->format('M d, Y') }} @endif @else Not set @endif

Assigned To

{{ $project->assignedUser->name ?? 'Unassigned' }}

Budget

{{ $budget ? '$' . number_format($budget, 2) : 'Not set' }}

Total Income

${{ number_format($totalIncome, 2) }}

Total Expenses

${{ number_format($totalExpense, 2) }}

Net Balance

${{ number_format($netBalance, 2) }}

@if($budget > 0)

Budget Utilization

${{ number_format($totalExpense, 2) }} of ${{ number_format($budget, 2) }} used {{ number_format($budgetUtilization, 1) }}%

@if($budgetRemaining > 0) ${{ number_format($budgetRemaining, 2) }} remaining ({{ number_format(100 - $budgetUtilization, 1) }}%) @else Budget fully utilized @endif

@endif

Category Breakdown

@if($categorySummary->count() > 0)
@foreach($categorySummary as $cat)
{{ $cat['category'] }} {{ $cat['count'] }} txns
+${{ number_format($cat['income'], 2) }} -${{ number_format($cat['expense'], 2) }}
@endforeach
@else

No transactions categorized

@endif

Financial KPIs

Profit Margin

{{ number_format($profitMargin, 1) }}%

{{ $profitMargin >= 0 ? 'Profitable' : 'Loss-making' }} @if($totalIncome == 0 && $totalExpense == 0)(no transactions)@elseif($totalIncome == 0)(no income)@endif

@if($budget > 0)

Budget Remaining

${{ number_format($budgetRemaining, 2) }}

{{ number_format(100 - $budgetUtilization, 1) }}% remaining

@endif

Income vs Expenses Ratio

{{ $totalExpense > 0 ? number_format($totalIncome / $totalExpense, 2) : ($totalIncome > 0 ? 'N/A (no expenses)' : 'N/A') }}

Average Transaction

${{ number_format($transactions->count() > 0 ? ($totalIncome + $totalExpense) / $transactions->count() : 0, 2) }}

Financial Summary

Total Income +${{ number_format($totalIncome, 2) }}
Total Expenses -${{ number_format($totalExpense, 2) }}
Net Balance ${{ number_format($netBalance, 2) }}
Total Transactions {{ $transactions->count() }}
Created By {{ $project->creator->name ?? 'N/A' }}

Transaction History

{{ $transactions->count() }}
@forelse($transactions as $txn) @empty @endforelse @if($transactions->count() > 0) @endif
Date Type Description Category Amount
{{ $txn->date->format('M d, Y') }} @if($txn->type === 'income') Income @else Expense @endif {{ $txn->description }} {{ $txn->category ?? '-' }} {{ $txn->type === 'income' ? '+' : '-' }}${{ number_format($txn->amount, 2) }}
No transactions recorded
Total +${{ number_format($totalIncome, 2) }} -${{ number_format($totalExpense, 2) }}
@endsection