@push('header') @endpush {{-- Status Messages --}} @if (session('success'))
{{ session('success') }}
@endif @if (session('error'))
{{ session('error') }}
@endif {{-- Validation Errors --}} @if ($errors->any())
    @foreach ($errors->all() as $error)
  • {{ $error }}
  • @endforeach
@endif {{-- Filter Section --}}
{{-- Summary Cards --}}
Total Online Amount
{{ number_format($totals->total_online ?? 0, 2) }}
Total Invoice Amount
{{ number_format($totals->total_invoice ?? 0, 2) }}
Total Expenses
{{ number_format($totals->total_expenses ?? 0, 2) }}
Current Balance
{{ number_format($currentBalance, 2) }}
{{-- Main Report --}}
{{-- Opening Balance Setting (only shows when suppliers without opening balance exist) --}} @can('report-audit-ledger-register-manage') @if ($suppliersWithoutOpeningBalance->count() > 0)

Set Supplier Opening Balance

{{ $suppliersWithoutOpeningBalance->count() }} remaining
@csrf @method('PUT')

+ve = supplier owes you, -ve = you owe supplier. An entry will be created in the table below — post it to GL from the Actions column.

@endif @endcan
{{-- Report Header (Excel-style) --}}
LEDGER TO THE COMPANY {{ \Carbon\Carbon::parse($dateFrom)->format('Y') }} SAP CODE MONTH @if ($selectedSupplier)
{{ $selectedSupplier->short_name ?? $selectedSupplier->supplier_name }}
@endif
{{ $selectedSupplier?->supplier_name ?? 'All Suppliers' }} {{ $entries->first()?->sap_code ?? '-' }} - {{ \Carbon\Carbon::parse($dateFrom)->format('F') }}
{{ number_format($totals->total_online ?? 0, 2) }} {{ number_format($totals->total_invoice ?? 0, 2) }} {{ number_format($totals->total_expenses ?? 0, 2) }} {{ number_format($totals->total_za ?? 0, 2) }}
Printed by: {{ auth()->user()->name }} | {{ now()->format('d-M-Y h:i A') }}
{{-- Data Table --}}
{{-- Opening Balance Row --}} @if ($openingBalance != 0) @endif @forelse ($entries as $index => $entry) @php $entryOpeningBalance = (float) $entry->opening_balance; if ($entry->document_type === \App\Enums\DocumentType::Ob && $entryOpeningBalance === 0.0) { $entryOpeningBalance = (float) $entry->online_amount - (float) $entry->invoice_amount; } @endphp @empty @endforelse {{-- Inline Add Form Row --}} @can('report-audit-ledger-register-manage') @endcan {{-- Footer Totals --}} @php $pageOpeningBalanceTotal = $entries->sum(function ($entry) { $openingBalance = (float) $entry->opening_balance; if ($openingBalance !== 0.0) { return $openingBalance; } if ($entry->document_type === \App\Enums\DocumentType::Ob) { return (float) $entry->online_amount - (float) $entry->invoice_amount; } return 0; }); @endphp
Sr# Date Type Document # Online Amount Opening Balance Invoice Amount Expenses ZA(0.5%) Claim Adjust Balance Actions
Opening Balance (Before {{ \Carbon\Carbon::parse($dateFrom)->format('d-M-Y') }}) - - - - - - {{ number_format($openingBalance, 2) }}
{{ $entries->firstItem() + $index }} {{ $entry->transaction_date->format('d.m.Y') }} @if ($entry->document_type) {{ $entry->document_type->value }} @else - @endif {{ $entry->document_number ?? '-' }} {{ $entry->document_type !== \App\Enums\DocumentType::Ob && $entry->online_amount > 0 ? number_format($entry->online_amount, 2) : '-' }} {{ $entryOpeningBalance != 0 ? number_format($entryOpeningBalance, 2) : '-' }} {{ $entry->document_type !== \App\Enums\DocumentType::Ob && $entry->invoice_amount > 0 ? number_format($entry->invoice_amount, 2) : '-' }} {{ $entry->document_type !== \App\Enums\DocumentType::Ob && $entry->expenses_amount > 0 ? number_format($entry->expenses_amount, 2) : '-' }} {{ $entry->document_type !== \App\Enums\DocumentType::Ob && $entry->za_point_five_percent_amount > 0 ? number_format($entry->za_point_five_percent_amount, 2) : '-' }} {{ $entry->document_type !== \App\Enums\DocumentType::Ob && $entry->claim_adjust_amount > 0 ? number_format($entry->claim_adjust_amount, 2) : '-' }} {{ number_format($entry->running_balance, 2) }} @canany(['report-audit-ledger-register-post', 'report-audit-ledger-register-manage'])
@if ($entry->isPosted()) @else @can('report-audit-ledger-register-post') @endcan @can('report-audit-ledger-register-manage')
@csrf @method('DELETE')
@endcan @endif
@endcanany
No ledger entries found for the selected filters.
@csrf
+ Use OB button Auto
Page Total ({{ $entries->count() }} entries) {{ number_format($entries->sum('online_amount'), 2) }} {{ number_format($pageOpeningBalanceTotal, 2) }} {{ number_format($entries->sum('invoice_amount'), 2) }} {{ number_format($entries->sum('expenses_amount'), 2) }} {{ number_format($entries->sum('za_point_five_percent_amount'), 2) }} {{ number_format($entries->sum('claim_adjust_amount'), 2) }} {{ $entries->count() > 0 ? number_format($entries->last()->running_balance, 2) : '0.00' }}
{{-- Add Entry Toggle Button --}} @can('report-audit-ledger-register-manage')
@endcan
{{-- Company Ledger Detail Summary --}} @if ($selectedSupplier)
Company Ledger Detail
Online:- {{ number_format($totals->total_online ?? 0, 2) }}
Invoicing:- {{ number_format($totals->total_invoice ?? 0, 2) }}
Balance:- {{ number_format($currentBalance, 2) }}
@endif {{-- Document Type Legend --}}
Document Types:
@foreach ($documentTypes as $type) {{ $type->value }} = {{ $type->label() }} @endforeach
{{-- Pagination --}} @if ($entries->hasPages())
{{ $entries->links() }}
@endif
{{-- Edit Modal with Backdrop Blur --}} @can('report-audit-ledger-register-manage') @endcan @can('report-audit-ledger-register-post')

Are you sure you want to post this entry to the General Ledger? This action cannot be reversed.

@endcan @push('scripts') @endpush