@extends('layouts.hirbnd') @section('title', 'Room ' . $room . ' - ' . $roomType) @section('page-title', 'Room Matrix: ' . $room) @push('styles') @endpush @section('content')

Room {{ $room }}

{{ $roomType }} - Revenue Matrix

2025
12 Months Data
@foreach(['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'] as $month) @endforeach @php $monthNames = ['january', 'february', 'march', 'april', 'may', 'june', 'july', 'august', 'september', 'october', 'november', 'december']; $daysInMonth = [31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31]; // Process data per day $dailyRevenue = []; $monthlyTotals = array_fill(0, 12, 0); $monthlyCounts = array_fill(0, 12, 0); foreach($monthNames as $idx => $monthName) { $monthData = $monthlyData[$monthName] ?? collect(); // Group by day $grouped = $monthData->groupBy(function($item) { return (int) date('d', strtotime($item->Posting_Date)); }); foreach($grouped as $day => $records) { $dailyTotal = $records->sum('Amount_1'); $dailyRevenue[$day][$idx] = $dailyTotal; $monthlyTotals[$idx] += $dailyTotal; if($dailyTotal > 0) $monthlyCounts[$idx]++; } } @endphp {{-- Day rows --}} @for($day = 1; $day <= 31; $day++) @for($monthIdx = 0; $monthIdx < 12; $monthIdx++) @if($day <= $daysInMonth[$monthIdx]) @php $amount = $dailyRevenue[$day][$monthIdx] ?? 0; @endphp @if($amount > 0) @else @endif @else @endif @endfor @endfor {{-- Total Row --}} @foreach($monthlyTotals as $total) @endforeach {{-- Average Row --}} @foreach($monthlyTotals as $idx => $total) @php $avg = $monthlyCounts[$idx] > 0 ? $total / $monthlyCounts[$idx] : 0; @endphp @endforeach
Day/Month{{ $month }}
{{ $day }}{{ number_format($amount, 0, ',', '.') }}--
TOTAL{{ number_format($total, 0, ',', '.') }}
AVERAGE{{ number_format($avg, 0, ',', '.') }}
@endsection @push('scripts') @endpush