DUE REPORT

@if ($clientCompany == 'all') @foreach ($months as $month) @endforeach @foreach ($months as $month) @endforeach @foreach ($data['billingClients'] as $key => $billingClient) @php $productName = implode(', ', array_column($billingClient->billingProduct, 'name')); $yearlyTotalService = 0; $yearlyTotalRecovered = 0; @endphp @foreach ($months as $month) @php $monthlyService = $billingClient->monthlyData[$month]['totalService'] ?? 0; $monthlyRecovered = $billingClient->monthlyData[$month]['totalRecovered'] ?? 0; $yearlyTotalService += $monthlyService; $yearlyTotalRecovered += $monthlyRecovered; $grandYearlyTotalService += $monthlyService; // Accumulate grand total here $grandYearlyTotalRecovered += $monthlyRecovered; // Accumulate grand total here @endphp @endforeach @php $dueTillEndDate = $billingClient->openingDue + $yearlyTotalService - $yearlyTotalRecovered; $grandTotalDueTill += $dueTillEndDate; // Accumulate total for "Due till 30th" @endphp @endforeach @foreach ($months as $month) @endforeach
SL No Org Name Product Opening Due{{ $month }} Current Year Due till 30th of {{ date('F', strtotime($endDate ?? 'now')) }}
Bill Col. Bill Col.
{{ $key + 1 }} {{ $billingClient->clientCompanyName }} {{ $productName }} {{ $billingClient->openingDue > 0 ? $billingClient->openingDue : '-' }}{{ $monthlyService > 0 ? $monthlyService : '-' }} {{ $monthlyRecovered > 0 ? $monthlyRecovered : '-' }} {{ $yearlyTotalService > 0 ? $yearlyTotalService : '-' }} {{ $yearlyTotalRecovered > 0 ? $yearlyTotalRecovered : '-' }} {{ $dueTillEndDate > 0 ? $dueTillEndDate : '-' }}
Grand Total {{ $totalDueAmount > 0 ? $totalDueAmount : '-' }}{{ $grandTotalServicePerMonth[$month] > 0 ? $grandTotalServicePerMonth[$month] : '-' }} {{ $grandTotalRecoveredPerMonth[$month] > 0 ? $grandTotalRecoveredPerMonth[$month] : '-' }} {{ $grandYearlyTotalService > 0 ? $grandYearlyTotalService : '-' }} {{ $grandYearlyTotalRecovered > 0 ? $grandYearlyTotalRecovered : '-' }} {{ $grandTotalDueTill > 0 ? $grandTotalDueTill : '-' }}
@endif