@extends('layouts.app') @section('content')

Report: Profit and Loss

Page for Profit and Loss

@csrf
Reset
Date range: {{ request('start_date', date('Y-m-01')) }} to {{ request('end_date', date('Y-m-t')) }}
Printed at: {{ now()->format('l, d F Y, H:i:s') }}
@if (count($data) < 1) @else @if (count($data) < 1) @else {{-- Inisialisasi Grand Total --}} @php $grandTotalOpeningBalance = 0; $grandTotalDebit = 0; $grandTotalCredit = 0; $grandTotalEndingBalance = 0; @endphp @foreach ($data as $group => $categories) {{-- Inisialisasi Total Group --}} @php $groupTotalOpeningBalance = 0; $groupTotalDebit = 0; $groupTotalCredit = 0; $groupTotalEndingBalance = 0; @endphp @foreach ($categories as $category => $subCategories) @foreach ($subCategories as $subCategory => $accounts) @foreach ($accounts as $item) @php // Tambahkan ke total group $groupTotalOpeningBalance += $item['opening_balance']; $groupTotalDebit += $item['debit']; $groupTotalCredit += $item['credit']; $groupTotalEndingBalance += $item['ending_balance']; @endphp @endforeach @endforeach @endforeach {{-- Baris untuk Total Group --}} @php // Tambahkan ke Grand Total $grandTotalOpeningBalance += $groupTotalOpeningBalance; $grandTotalDebit += $groupTotalDebit; $grandTotalCredit += $groupTotalCredit; $grandTotalEndingBalance += $groupTotalEndingBalance; @endphp @endforeach {{-- Baris untuk Grand Total --}} @endif @endif
Account Code Account Name Total Debit Total Credit
No data available in table for the selected date range
No data available in table for the selected date range
Group - {{ $group }}
    Category - {{ $category }}
        Sub Category - {{ $subCategory }}
            {{ $item['account_code'] }} {{ $item['account_name'] }} {{ number_format($item['debit'], 2) }} {{ number_format($item['credit'], 2) }}
Total - {{ $group }}: {{ number_format($groupTotalDebit, 2) }} {{ number_format($groupTotalCredit, 2) }}
Profit Loss :
{{ number_format($grandTotalDebit, 2) }}
{{ number_format($grandTotalCredit, 2) }}
@if ($grandTotalDebit > $grandTotalCredit)
Loss :
@else
Profit :
@endif
@if ($grandTotalDebit > $grandTotalCredit)
{{ number_format($grandTotalCredit - $grandTotalDebit, 2) }}
@endif
@if ($grandTotalDebit < $grandTotalCredit)
{{ number_format($grandTotalCredit - $grandTotalDebit, 2) }}
@endif
@endsection @section('js') @endsection