{{ $organisation['organisation_name'] }}

Budget Report

Fiscal Year: {{ $budget['fiscal_year']['financial_year'] ?? 'N/A' }} | Period: {{ isset($budget['fiscal_year']['start_date']) ? \Carbon\Carbon::parse($budget['fiscal_year']['start_date'])->format('M d, Y') : 'N/A' }} - {{ isset($budget['fiscal_year']['end_date']) ? \Carbon\Carbon::parse($budget['fiscal_year']['end_date'])->format('M d, Y') : 'N/A' }}

Budget Name: {{ $budget['name'] ?? 'N/A' }}
Budget Category: {{ $budget['budget_category'] ?? 'N/A' }}
Status: {{ str_replace('_', ' ', $budget['status'] ?? 'draft') }}
Currency: {{ $budget['currency']['code'] ?? 'TZS' }}
@if(!empty($budget['description']))
Description: {{ $budget['description'] }}
@endif

Budget Summary

Total Allocated Income
TZS {{ number_format($budget['total_allocated_income'] ?? 0, 2) }}
Total Allocated Expenses
TZS {{ number_format($budget['total_allocated_expenses'] ?? 0, 2) }}
Remaining Income
TZS {{ number_format($budget['remaining_income'] ?? 0, 2) }}
Remaining Expenses
TZS {{ number_format($budget['remaining_expenses'] ?? 0, 2) }}
@php $categoryTotals = [ 'allocated' => 0, 'committed' => 0, 'spent' => 0, 'remaining' => 0 ]; $grandTotals = [ 'allocated' => 0, 'committed' => 0, 'spent' => 0, 'remaining' => 0 ]; // Group allocations by account category $groupedAllocations = []; foreach ($budget['allocations'] ?? [] as $allocation) { $categoryName = $allocation['account_sub_category']['name'] ?? 'Uncategorized'; if (!isset($groupedAllocations[$categoryName])) { $groupedAllocations[$categoryName] = []; } $groupedAllocations[$categoryName][] = $allocation; } @endphp @foreach($groupedAllocations as $categoryName => $allocations) @php $categoryTotals = ['allocated' => 0, 'committed' => 0, 'spent' => 0, 'remaining' => 0]; @endphp @foreach($allocations as $allocation) @php $allocated = $allocation['allocated_amount'] ?? 0; $committed = $allocation['committed_amount'] ?? 0; $spent = $allocation['spent_amount'] ?? 0; $remaining = $allocation['remaining_amount'] ?? 0; $categoryTotals['allocated'] += $allocated; $categoryTotals['committed'] += $committed; $categoryTotals['spent'] += $spent; $categoryTotals['remaining'] += $remaining; $grandTotals['allocated'] += $allocated; $grandTotals['committed'] += $committed; $grandTotals['spent'] += $spent; $grandTotals['remaining'] += $remaining; @endphp @foreach($allocation['items'] ?? [] as $item) @php $itemType = $item['type'] ?? 'N/A'; $typeColor = $itemType === 'Revenue' ? '#27ae60' : '#e74c3c'; @endphp @endforeach @endforeach @endforeach
Code Account Type Allocated Amount Committed Amount Spent Amount Remaining Amount
{{ $categoryName }}
{{ $allocation['description'] ?? 'No description' }} @if(!empty($allocation['account_sub_category']['description'])) - {{ $allocation['account_sub_category']['description'] }} @endif
{{ $item['chart_of_account']['code'] ?? 'N/A' }} {{ $item['chart_of_account']['name'] ?? 'N/A' }} {{ $itemType }} TZS {{ number_format($item['amount'] ?? 0, 2) }} - TZS {{ number_format($item['spent_amount'] ?? 0, 2) }} TZS {{ number_format($item['remaining_amount'] ?? 0, 2) }}
Subtotal for {{ $allocation['description'] ?? 'Allocation' }} TZS {{ number_format($allocated, 2) }} TZS {{ number_format($committed, 2) }} TZS {{ number_format($spent, 2) }} TZS {{ number_format($remaining, 2) }}
Total {{ $categoryName }} TZS {{ number_format($categoryTotals['allocated'], 2) }} TZS {{ number_format($categoryTotals['committed'], 2) }} TZS {{ number_format($categoryTotals['spent'], 2) }} TZS {{ number_format($categoryTotals['remaining'], 2) }}
GRAND TOTAL TZS {{ number_format($grandTotals['allocated'], 2) }} TZS {{ number_format($grandTotals['committed'], 2) }} TZS {{ number_format($grandTotals['spent'], 2) }} TZS {{ number_format($grandTotals['remaining'], 2) }}

Overall Budget Position

Net Budget Position
TZS {{ number_format(($budget['total_allocated_income'] ?? 0) - ($budget['total_allocated_expenses'] ?? 0), 2) }}
{{ ($budget['total_allocated_income'] - $budget['total_allocated_expenses']) >= 0 ? 'Surplus' : 'Deficit' }}
Total Budget Utilization
@php $totalBudget = ($budget['total_allocated_income'] ?? 0) + ($budget['total_allocated_expenses'] ?? 0); $totalUsed = ($budget['total_spent_income'] ?? 0) + ($budget['total_spent_expenses'] ?? 0); $utilization = $totalBudget > 0 ? ($totalUsed / $totalBudget) * 100 : 0; @endphp {{ number_format($utilization, 1) }}%
Overall Usage