@extends('layouts.app') @section('content')
Laporan Aging
@if(empty($aging))
Tiada data dijumpai untuk tarikh {{ $endDate }}.
@else
@foreach ($aging[0]['summary_by_tempoh'] as $summary) @endforeach @foreach ($aging[0]['summary_by_tempoh'] as $summary) @endforeach @php $counter = 1; // Initialize counter $totalGrandCountByTempoh = array_fill(0, count($aging[0]['summary_by_tempoh']), 0); $totalGrandBakipjmByTempoh = array_fill(0, count($aging[0]['summary_by_tempoh']), 0); @endphp @foreach ($aging as $branch) @php $totalCount = 0; $totalBakipjm = 0; @endphp @foreach ($branch['summary_by_tempoh'] as $index => $summary) @php $totalCount += $summary['count']; // Summing up the count $totalBakipjm += $summary['sum_bakipjm']; // Summing up the Bakipjm // Adding values to grand totals for each tempoh $totalGrandCountByTempoh[$index] += $summary['count']; $totalGrandBakipjmByTempoh[$index] += $summary['sum_bakipjm']; @endphp @endforeach @endforeach @foreach ($totalGrandCountByTempoh as $index => $grandCount) @endforeach
Bil. Cawangan{{ $summary['label'] }} Keseluruhan
Bil RM Bil RM
{{ $counter++ }} {{ $branch['cawangan'] }}{{ $summary['count'] }} {{ number_format($summary['sum_bakipjm'], 2) }} {{ $totalCount }} {{ number_format($totalBakipjm , 2) }}
Total{{ $grandCount }} {{ number_format($totalGrandBakipjmByTempoh[$index], 2) }} {{ array_sum($totalGrandCountByTempoh) }} {{ number_format(array_sum($totalGrandBakipjmByTempoh), 2) }}
@endif
@include('layouts.footer')
@endsection