@extends('layouts.app') @section('title', __('messages.statement_for') . ' ' . $account->name) @section('content')

{{ __('messages.account_statement') }}

{{ __('messages.account_code') }}: {{ $account->code }} | {{ __('messages.type') }}: {{ __('messages.' . strtolower($account->type_name)) }}

@php $runningBalance = $openingBalance; @endphp @forelse($entries as $entry) @php $runningBalance += ($entry->debit - $entry->credit); $url = null; if($entry->reference_type === 'production') $url = route('productions.show', $entry->reference_id); elseif($entry->reference_type === 'voucher') $url = route('vouchers.show', $entry->reference_id); elseif($entry->reference_type === 'purchase_invoice') $url = route('purchase_invoices.show', $entry->reference_id); elseif($entry->reference_type === 'expense') $url = route('expenses.show', $entry->reference_id); @endphp @empty @endforelse
{{ __('messages.date') }} {{ __('messages.description') }} {{ __('messages.debit') }} {{ __('messages.credit') }} {{ __('messages.net_balance') }}
--- {{ __('messages.opening_balance') }} ({{ __('messages.date_to') }} {{ $startDate }}) --- --- {{ number_format($openingBalance, 2) }}
{{ $entry->created_at->format('Y-m-d H:i') }}
{{ $entry->description ?? 'Transaction Record' }}
@if($entry->reference_type === 'production') {{ __('messages.production_accounting') }}: #{{ $entry->reference_id }} @elseif($entry->reference_type === 'voucher') {{ __('messages.vouchers') }}: #{{ $entry->reference_id }} @elseif($entry->reference_type === 'purchase_invoice') {{ __('messages.merchant_bill_debit') }}: #{{ $entry->reference_id }} @elseif($entry->reference_type === 'expense') {{ __('messages.expense_type') }}: #{{ $entry->reference_id }} @endif
{{ $entry->debit > 0 ? '+' . number_format($entry->debit, 2) : '-' }} {{ $entry->credit > 0 ? '-' . number_format($entry->credit, 2) : '-' }} {{ number_format($runningBalance, 2) }}

{{ __('messages.no_transactions') }}

{{ __('messages.net_change_final_balance') }} +{{ number_format($entries->sum('debit'), 2) }} -{{ number_format($entries->sum('credit'), 2) }} {{ number_format($runningBalance, 2) }}
@endsection