@foreach($units as $key => $unit) @endforeach @foreach($units as $key => $unit) @php $total_units[$key] = 0; if (!empty($formated_report[$key])) { foreach ($formated_report[$key] as $value) { $total_units[$key] += $value->units; } } @endphp @endforeach @foreach($units as $key => $unit) @php $total_token_units[$key] = 0; if (!empty($formated_token[$key])) { foreach ($formated_token[$key] as $value) { $total_token_units[$key] += $value->credits; } } @endphp @endforeach @foreach($units as $key => $unit) @php $total_piped_units[$key] = 0; if (!empty($formated_report[$key])) { foreach ($formated_report[$key] as $value) { $total_piped_units[$key] += $value->units; } } if (!empty($formated_token[$key])) { foreach ($formated_token[$key] as $value) { $total_piped_units[$key] += $value->credits; } } @endphp @endforeach @foreach($units as $key => $unit) @php $total_piped_units[$key] = 0; if (!empty($formated_report[$key])) { foreach ($formated_report[$key] as $value) { $total_piped_units[$key] += $value->units; } } if (!empty($formated_token[$key])) { foreach ($formated_token[$key] as $value) { $total_piped_units[$key] += $value->credits; } } @endphp @endforeach {{-- @foreach($units as $key => $unit) @php $total_shop_sales[$key] = 0; if (!empty($formated_shop_sale[$key])) { foreach ($formated_shop_sale[$key] as $value) { $total_shop_sales[$key] += $value->liters; } } @endphp @endforeach @foreach($units as $key => $unit) @php $total_litres_used[$key] = 0; // Shop sales in liters if (!empty($formated_shop_sale[$key])) { foreach ($formated_shop_sale[$key] as $value) { $total_litres_used[$key] += $value->liters; } } // Meter readings and token units converted to liters if (!empty($formated_report[$key])) { foreach ($formated_report[$key] as $value) { $total_litres_used[$key] += $value->units * $unit_to_liters; } } if (!empty($formated_token[$key])) { foreach ($formated_token[$key] as $value) { $total_litres_used[$key] += $value->units * $unit_to_liters; } } @endphp @endforeach --}} @foreach($units as $key => $unit) @php $total_till_amount[$key] = 0; if (!empty($formated_transaction[$key])) { foreach ($formated_transaction[$key] as $value) { $total_till_amount[$key] += $value->amount; // Adjust field as needed (e.g., total, payment, etc.) } } @endphp @endforeach @foreach($units as $key => $unit) @php $total_debts[$key] = 0; if (!empty($formated_invoice[$key])) { foreach ($formated_invoice[$key] as $value) { $total_debts[$key] += ($value->amount - $value->paid); // Adjust field as needed (e.g., balance, total) } } @endphp @endforeach @foreach($units as $key => $unit) @endforeach @foreach($units as $key => $unit) @endforeach @foreach($units as $key => $unit) @endforeach @foreach($units as $key => $unit) @endforeach @foreach($units as $key => $unit) @endforeach
 {{ $unit }}
{{ __('Meter Readings Units') }}{{ $total_units[$key] }}
{{ __('Total Token Units') }}{{ $total_token_units[$key] }}
{{ __('Total Piped Water Used (Units)') }}{{ $total_piped_units[$key] }}
{{ __('Total Piped Water Used (Liters)') }}{{ $total_piped_units[$key] * 1000 }}
{{ __('Total Shop Sales (Liters)') }}{{ $total_shop_sales[$key] }}
{{ __('Total Litres Used') }}{{ $total_litres_used[$key] }}
{{ __('Total till amount corrected') }}{{ $total_till_amount[$key] }}
{{ __('Total Debts') }}{{ $total_debts[$key] }}
{{ __('Total customers') }}{{ !empty($formated_customer[$key]) ? count($formated_customer[$key]) : 0 }}
{{ __('Total leads') }}{{ !empty($formated_lead[$key]) ? count($formated_lead[$key]) : 0 }}
{{ __('Number of products') }}{{ !empty($formated_expense[$key]) ? count($formated_expense[$key]) : 0 }}
{{ __('Number of Installations') }}{{ !empty($formated_instalation[$key]) ? count($formated_instalation[$key]) : 0 }}
{{ __('Number of Agents') }}{{ !empty($formated_agent[$key]) ? count($formated_agent[$key]) : 0 }}