@extends('admin.layouts.app') @section('title', 'Budget vs Actual') @section('content')
Set and track expense budgets
| Month | @foreach($categories as $cat){{ $cat }} | @endforeachTotal Budget | Total Actual | Variance |
|---|---|---|---|---|
| {{ Carbon\Carbon::create($year, $m, 1)->format('F') }} | @foreach($categories as $cat)@php $budget = $budgets->get($m)?->firstWhere('category', $cat); $actual = $monthlyActuals->get($m)?->get($cat, 0); @endphp ₦{{ number_format($budget?->budgeted_amount ?? 0, 0) }} | @endforeach₦{{ number_format($budgets->get($m)?->sum('budgeted_amount') ?? 0, 0) }} | ₦{{ number_format($monthlyActuals->get($m)?->sum() ?? 0, 0) }} | @php $totalBudget = $budgets->get($m)?->sum('budgeted_amount') ?? 0; $totalActual = $monthlyActuals->get($m)?->sum() ?? 0; $variance = $totalBudget - $totalActual; @endphp ₦{{ number_format(abs($variance), 0) }} |