@extends('layouts.app') @section('title', 'Customer Statement') @push('styles') @endpush @section('content') @can('view_customer_statement')

Customer Statement

Customer transaction & payment history

PDF
@include('reports.partials.branch-filter')
@if($customer)

{{ $customer->name }}

@if($customer->phone){{ $customer->phone }}@endif @if($customer->email){{ $customer->email }}@endif

Opening Balance

${{ number_format($openingBalance, 2) }}

Sales Total

${{ number_format($totalDebit, 2) }}

Payments Total

${{ number_format($totalPaid, 2) }}

Closing Balance

${{ number_format($closingBalance, 2) }}

Transaction History

{{ displayDate(\Carbon\Carbon::parse($dateFrom)) }} — {{ displayDate(\Carbon\Carbon::parse($dateTo)) }}

@php $runningBalance = $openingBalance; @endphp @forelse($transactions as $txn) @php $runningBalance += $txn['debit']; $runningBalance -= $txn['paid']; @endphp @if($txn['type'] === 'sale') @else @endif @empty @endforelse @if(count($transactions) > 0) @endif
Date Invoice Type / Method Sale Amount Paid Running Balance
Opening Balance ${{ number_format($runningBalance, 2) }}
{{ displayDate($txn['date']) }} {{ $txn['ref'] }} Sale @if(isset($txn['payment_method']) && $txn['payment_method']) ({{ $txn['payment_method'] }}) @endif Payment @if(isset($txn['payment_method']) && $txn['payment_method']) ({{ $txn['payment_method'] }}) @endif @if($txn['debit'] > 0)${{ number_format($txn['debit'], 2) }}@else - @endif @if($txn['paid'] > 0)${{ number_format($txn['paid'], 2) }}@else - @endif ${{ number_format($runningBalance, 2) }}

No transactions for selected period

Closing Balance ${{ number_format($totalDebit, 2) }} ${{ number_format($totalPaid, 2) }} ${{ number_format($closingBalance, 2) }}
@endif @endcan @endsection