@if($leadsMonthly != []) @php $leadsMonthly = collect($leadsMonthly)->groupBy('month'); @endphp
Total Quoted: {{ number_format($yearTotal['total_cost'], 2) }}
Total Paid: {{ number_format($yearTotal['total_paid'], 2) }}
Total Due: {{ number_format($yearTotal['total_due'], 2) }}
@foreach($leadsMonthly as $date => $entries) @php $monthName = \Carbon\Carbon::create()->month($date)->format('F'); $totalCost = collect($entries)->sum('total_cost'); $totalPaid = collect($entries)->sum('total_paid'); $totalDue = collect($entries)->sum('total_due'); $isCurrentMonth = ($date == now()->month); // check if same as current month @endphp
{{ $monthName }}
Total Quoted {{ number_format($totalCost, 2) }}
Total Paid {{ number_format($totalPaid, 2) }}
Total Due {{ number_format($totalDue, 2) }}
@endforeach
@elseif($leadsWiseData != []) @php $leadsWiseData = collect($leadsWiseData)->groupBy('date'); @endphp @foreach($leadsWiseData as $date => $entries) @php $formattedDate = \Carbon\Carbon::parse($date)->format('j F'); $totalCost = collect($entries)->sum('total_cost'); $totalPaid = collect($entries)->sum('total_paid'); $totalDue = collect($entries)->sum('total_due'); @endphp
{{ $formattedDate }}
Total Quoted {{ number_format($totalCost, 2) }}
Total Paid {{ number_format($totalPaid, 2) }}
Total Due {{ number_format($totalDue, 2) }}
@endforeach @else No Data Found @endif