@if (isset($report_data) && (is_countable($report_data) ? count($report_data) > 0 : !empty($report_data))) @php $allData = $report_data instanceof \Illuminate\Pagination\LengthAwarePaginator ? collect($report_data->items()) : collect($report_data); $totalSimpanan = isset($report_totals['total_simpanan']) ? $report_totals['total_simpanan'] : $allData->sum('simpanan_total'); $totalBunga = isset($report_totals['total_bunga']) ? $report_totals['total_bunga'] : $allData->sum('bunga_total'); $totalHasilSimpanan = isset($report_totals['total_hasil_simpanan']) ? $report_totals['total_hasil_simpanan'] : $allData->sum('hasil_persen_simpanan'); $totalHasilBunga = isset($report_totals['total_hasil_bunga']) ? $report_totals['total_hasil_bunga'] : $allData->sum('hasil_persen_bunga'); $totalShu = isset($report_totals['total_shu']) ? $report_totals['total_shu'] : $allData->sum('total_shu'); $totalCount = isset($report_totals['total_count']) ? $report_totals['total_count'] : $allData->count(); $currentPageData = $report_data instanceof \Illuminate\Pagination\LengthAwarePaginator ? $report_data->items() : $report_data; $currentPage = $report_data instanceof \Illuminate\Pagination\LengthAwarePaginator ? $report_data->currentPage() : 1; $perPage = $report_data instanceof \Illuminate\Pagination\LengthAwarePaginator ? $report_data->perPage() : count($currentPageData); $startIndex = ($currentPage - 1) * $perPage; @endphp
| No | @foreach ($table_header as $header){{ $header->alias }} | @endforeach||||
|---|---|---|---|---|---|
| {{ $startIndex + $index + 1 }} | @foreach ($table_header as $field) @php $fieldName = $field->field; $value = is_array($item) ? $item[$fieldName] ?? null : $item->$fieldName ?? null; @endphp @if ($field->type == 'currency'){{ $format->CurrencyFormat($value ?? 0, $field->decimals ?? 0, $field->sub ?: 'Rp.') }} | @elseif ($field->type == 'date'){{ $value ? date('d/m/Y', strtotime($value)) : '-' }} | @elseif ($field->type == 'datetime'){{ $value ? date('d/m/Y H:i', strtotime($value)) : '-' }} | @elseif ($field->type == 'number'){{ number_format($value ?? 0, $field->decimals ?? 0) }} | @else{{ $value ?? '-' }} | @endif @endforeach
| Total | @foreach ($table_header as $field) @php $fieldName = $field->field; $totalValue = null; if ($fieldName == 'nama_lengkap') { $totalValue = number_format($totalCount, 0, ',', '.') . ' Anggota'; } elseif ($fieldName == 'simpanan_total') { $totalValue = $format->CurrencyFormat($totalSimpanan); } elseif ($fieldName == 'bunga_total') { $totalValue = $format->CurrencyFormat($totalBunga); } elseif ($fieldName == 'hasil_persen_simpanan') { $totalValue = $format->CurrencyFormat($totalHasilSimpanan); } elseif ($fieldName == 'hasil_persen_bunga') { $totalValue = $format->CurrencyFormat($totalHasilBunga); } elseif ($fieldName == 'total_shu') { $totalValue = $format->CurrencyFormat($totalShu); } else { $totalValue = '-'; } @endphp{{ $totalValue }} | @endforeach