@extends('layouts.app', ['class' => 'g-sidenav-show bg-gray-100']) {{-- section content --}} @section('content') @include('layouts.navbars.auth.topnav', ['title' => ''])
Result {{ $title_menu }}

@forelse ($table_result as $detail) {{-- DESKRIPSI --}} @endforeach
No Tanggal Aktual ID Transaksi User Menu Aksi Deskripsi
{{ $loop->iteration }} {{ \Carbon\Carbon::parse($detail->created_at)->translatedFormat('d F Y H:i:s') }} {{ $detail->id_transaksi }} {{ $detail->username }} {{ $detail->menu }} {{ $detail->halaman }} @php $deskripsi = $detail->deskripsi ?? ''; $deskripsiUtama = $deskripsi; $decodedSebelum = null; $decodedSesudah = null; $decodedSingle = null; $judulSingle = 'Detail'; if ( str_contains($deskripsi, 'Detail Sebelum:') && str_contains($deskripsi, 'Detail Sesudah:') ) { [$deskripsiUtama, $sisaDetail] = explode( 'Detail Sebelum:', $deskripsi, 2, ); [$jsonSebelum, $jsonSesudah] = explode( 'Detail Sesudah:', $sisaDetail, 2, ); $decodedSebelum = json_decode(trim($jsonSebelum), true); $decodedSesudah = json_decode(trim($jsonSesudah), true); } elseif (str_contains($deskripsi, 'Detail Dihapus:')) { [$deskripsiUtama, $jsonSingle] = explode( 'Detail Dihapus:', $deskripsi, 2, ); $decodedSingle = json_decode(trim($jsonSingle), true); $judulSingle = 'Detail Dihapus'; } elseif (str_contains($deskripsi, 'Detail:')) { [$deskripsiUtama, $jsonSingle] = explode( 'Detail:', $deskripsi, 2, ); $decodedSingle = json_decode(trim($jsonSingle), true); $judulSingle = 'Detail'; } $tableGroups = []; if ( is_array($decodedSebelum) && count($decodedSebelum) > 0 ) { $tableGroups[] = [ 'judul' => 'Detail Sebelum', 'data' => $decodedSebelum, ]; } if ( is_array($decodedSesudah) && count($decodedSesudah) > 0 ) { $tableGroups[] = [ 'judul' => 'Detail Sesudah', 'data' => $decodedSesudah, ]; } if (is_array($decodedSingle) && count($decodedSingle) > 0) { $tableGroups[] = [ 'judul' => $judulSingle, 'data' => $decodedSingle, ]; } $mataUang = 'IDR'; if ( preg_match( '/Mata Uang:\s*([A-Za-z]{3})/i', $deskripsiUtama, $matchesMataUang, ) ) { $mataUang = strtoupper($matchesMataUang[1]); } @endphp {{-- DESKRIPSI UTAMA --}}
{{ trim($deskripsiUtama) }}
{{-- DETAIL TABLE --}} @foreach ($tableGroups as $tableGroup) @php $sortedData = collect($tableGroup['data']) ->sortBy(function ($row) { if ((float) ($row['debit'] ?? 0) > 0) { return 0; } if ((float) ($row['kredit'] ?? 0) > 0) { return 1; } return 2; }) ->values(); @endphp
Lihat {{ $tableGroup['judul'] }}
@foreach ($sortedData as $index => $row) @endforeach @php $totalDebit = collect( $tableGroup['data'], )->sum( fn($item) => (float) ($item['debit'] ?? 0), ); $totalKredit = collect( $tableGroup['data'], )->sum( fn($item) => (float) ($item['kredit'] ?? 0), ); $totalDebitValas = collect( $tableGroup['data'], )->sum( fn($item) => (float) ($item[ 'debit_valas' ] ?? 0), ); $totalKreditValas = collect( $tableGroup['data'], )->sum( fn($item) => (float) ($item[ 'kredit_valas' ] ?? 0), ); @endphp
No Keterangan COA - Nama COA Debit Kredit
{{ $index + 1 }} {{ $row['keterangan'] ?? '-' }} {{ $row['id_coa'] ?? '-' }} - {{ $row['nama_coa'] ?? '-' }} @if (!empty($row['debit']))
Rp {{ number_format((float) $row['debit'], 2, ',', '.') }}
@if (!empty($row['debit_valas'])) {{ $mataUang ?? 'USD' }} {{ number_format((float) $row['debit_valas'], 2, ',', '.') }} @endif @else - @endif
@if (!empty($row['kredit']))
Rp {{ number_format((float) $row['kredit'], 2, ',', '.') }}
@if (!empty($row['kredit_valas'])) {{ $mataUang ?? 'USD' }} {{ number_format((float) $row['kredit_valas'], 2, ',', '.') }} @endif @else - @endif
Total
Rp {{ number_format($totalDebit, 2, ',', '.') }}
@if ($totalDebitValas != 0) {{ $mataUang ?? 'USD' }} {{ number_format($totalDebitValas, 2, ',', '.') }} @endif
Rp {{ number_format($totalKredit, 2, ',', '.') }}
@if ($totalKreditValas != 0) {{ $mataUang ?? 'USD' }} {{ number_format($totalKreditValas, 2, ',', '.') }} @endif
@endforeach
{{-- check flag js on dmenu --}} @if ($jsmenu == '1') @if (view()->exists("js.{$dmenu}")) @push('addjs') {{-- file js in folder (resources/views/js) --}} @include('js.' . $dmenu); @endpush @else @push('addjs') @endpush @endif @endif @endsection @push('js') @endpush