{{-- Partial: Laba / Rugi Tab (Template-Driven) --}}
{{-- Filter Section --}}
Dari: Sampai:

Laporan Laba Rugi

@if (!empty($selected_kurs) && $selected_kurs !== 'IDR')

Kurs Konversi: 1 {{ $selected_kurs }} = {{ number_format($kurs_rate ?? 1, 2, ',', '.') }} IDR

@endif
{{ session('nama_perusahaan', 'PT MULTI SPUNINDO JAYA Tbk') }}

Untuk Periode Yang Berakhir Pada
{{ $curr_periode_name ?? '...' }} @if (!empty($prev_periode_name) && $prev_periode_name !== '-') dan {{ $prev_periode_name }} @endif

@if (!empty($is_yearly)) @foreach ($months as $m) @endforeach @else @endif @if (!empty($lr_fields) && count($lr_fields) > 0) @foreach ($lr_fields as $field) @php // Determine styling based on field characteristics $isSubtotal = $field->tipe === 'Total' && !$loop->last; $isFinal = $loop->last; $hasDetails = $field->has_details ?? false; $textColor = 'text-dark'; if ($isFinal) { $has_negative = false; if (!empty($is_yearly)) { $has_negative = array_sum($field->totals_monthly) < 0; } else { $has_negative = $field->total_curr < 0; } if ($has_negative) { $bgColor = '#fceaea'; // light red background for loss (rugi) } else { $bgColor = '#eafceaff'; // vibrant green background for profit (laba) } $fontWeight = 'font-weight-bolder'; $fontSize = 'text-sm'; } elseif ($isSubtotal) { $bgColor = '#eafceaff'; // Vibrant green for subtotals $fontWeight = 'font-weight-bold'; $fontSize = 'text-sm'; } elseif ($hasDetails) { $bgColor = '#eff3f8ff'; // Light gray for group headers $fontWeight = 'font-weight-bold'; $fontSize = 'text-sm'; } else { $bgColor = '#ffffff'; $fontWeight = 'normal'; $fontSize = 'text-sm'; } $fieldIsBeban = false; if ($hasDetails) { $firstItem = null; if (!empty($is_yearly)) { if (!empty($field->items_monthly)) { $firstItem = $field->items_monthly[0]; } } else { if (!empty($field->items_curr)) { $firstItem = $field->items_curr[0]; } elseif (!empty($field->items_prev)) { $firstItem = $field->items_prev[0]; } } if ($firstItem) { $firstChar = substr((string) $firstItem->id_coa, 0, 1); $fieldIsBeban = in_array($firstChar, ['5', '6', '8']); } } if (!empty($is_yearly)) { $display_totals = []; $total_year = 0.0; foreach ($months as $m) { $val = $field->totals_monthly[$m] ?? 0.0; $display_val = $fieldIsBeban ? -$val : $val; $display_totals[$m] = $display_val; $total_year += $display_val; } $cell_month_colors = []; $cell_total_year_color = $textColor; foreach ($months as $m) { $cell_month_colors[$m] = $textColor; if ($isSubtotal || $isFinal) { if (($field->totals_monthly[$m] ?? 0.0) < 0) { $cell_month_colors[$m] = 'text-danger'; } } } if ($isSubtotal || $isFinal) { $actual_total_year = array_sum($field->totals_monthly); if ($actual_total_year < 0) { $cell_total_year_color = 'text-danger'; } } } else { $total_curr_display = $fieldIsBeban ? -$field->total_curr : $field->total_curr; $total_prev_display = $fieldIsBeban ? -$field->total_prev : $field->total_prev; $cell_curr_color = $textColor; $cell_prev_color = $textColor; if ($isSubtotal || $isFinal) { if ($field->total_curr < 0) { $cell_curr_color = 'text-danger'; } if ($field->total_prev < 0) { $cell_prev_color = 'text-danger'; } } } @endphp {{-- Main row (Group Header) --}} @if (!empty($is_yearly)) @foreach ($months as $m) @php $val = $display_totals[$m] ?? 0.0; @endphp @endforeach @else @endif {{-- Detail items (expandable children) --}} @if ($hasDetails) @if (!empty($is_yearly)) @if (!empty($field->items_monthly)) @include('report.rptlpr.partials.laba_rugi_rows_yearly', [ 'items' => $field->items_monthly, 'depth' => 0, 'parent_id' => 'lr-field-' . $field->id_field, 'months' => $months, ]) @endif @else @if (!empty($field->items_curr)) @include('report.rptlpr.partials.laba_rugi_rows', [ 'items' => $field->items_curr, 'items_prev' => $field->items_prev ?? [], 'depth' => 0, 'parent_id' => 'lr-field-' . $field->id_field, ]) @endif @endif @endif @if ($isSubtotal) @endif @endforeach @elseif($lr_start_period && ($selected_template ?? '')) @else @endif
No. COA Keterangan / Description {{ \Carbon\Carbon::createFromFormat('Y-m-d', $m . '-01')->translatedFormat('M y') }} Total {{ $selected_periode }} No. COA Keterangan / Description {{ $curr_periode_name ?? 'Bulan Berjalan' }} {{ $prev_periode_name ?? 'Bulan Sebelumnya' }}
@if ($hasDetails) @endif {{ $field->nama }} @if ($val < 0) ({{ number_format(abs($val), 2, ',', '.') }}) @else {{ number_format($val, 2, ',', '.') }} @endif @if ($total_year < 0) ({{ number_format(abs($total_year), 2, ',', '.') }}) @else {{ number_format($total_year, 2, ',', '.') }} @endif @if ($total_curr_display < 0) ({{ number_format(abs($total_curr_display), 2, ',', '.') }}) @else {{ number_format($total_curr_display, 2, ',', '.') }} @endif @if ($total_prev_display < 0) ({{ number_format(abs($total_prev_display), 2, ',', '.') }}) @else {{ number_format($total_prev_display, 2, ',', '.') }} @endif
Tidak ada data template untuk ditampilkan
Silakan pilih template, periode dan kurs, lalu klik Execute untuk melihat data Laba Rugi