@extends('layouts.master') @section('title', 'Customer Statement Report') @section('content')
Back to Dashboard
Customer Statement Report
@if(session('success'))
{{ session('success') }}
@endif @if($errors->any())
    @foreach($errors->all() as $error)
  • {{ $error }}
  • @endforeach
@endif
@csrf
@if(isset($allStatements) && count($allStatements) > 0)
@csrf
@foreach($allStatements as $customerStatement)
{{ $customerStatement['customer']->customer_account }} ({{ $customerStatement['customer']->customer_code }})
@php $balance = $customerStatement['openingBalance']; $grandBalance = $balance; @endphp @foreach($customerStatement['statementData'] as $row) @php $balance += ($row['dr'] - $row['cr']); $grandBalance = $balance; @endphp @endforeach
Date Description Reference DR CR Balance
{{ $dateFrom }} Opening Balance {{ number_format($balance > 0 ? $balance : 0, 2) }} {{ number_format($balance < 0 ? abs($balance) : 0, 2) }} {{ number_format($balance, 2) }}
{{ $row['date'] }} {{ $row['description'] }} {{ $row['reference'] }} {{ number_format($row['dr'], 2) }} {{ number_format($row['cr'], 2) }} {{ number_format($balance, 2) }}
Grand Total : {{ number_format($grandBalance, 2) }}
@endforeach

Copyright © Melsoft (Private) Limited

@elseif(isset($statementData) && count($statementData) > 0)
Customer Statement
@csrf
@php $grandBalance = 0; @endphp @foreach($statementData as $row) @php $grandBalance += $row['balance']; @endphp @endforeach
Date Description Reference DR CR Balance
{{ $row['date'] }} {{ $row['description'] }} {{ $row['reference'] }} {{ number_format($row['dr'], 2) }} {{ number_format($row['cr'], 2) }} {{ number_format($row['balance'], 2) }}
Grand Total : {{ number_format($grandBalance, 2) }}

Copyright © Melsoft (Private) Limited

@elseif(isset($statementData) && count($statementData) == 0)
No transactions found for the selected criteria.
@endif
@endsection @section('styles') @endsection @section('scripts') @endsection