@extends('layouts.app') @section('title', 'Incoming Payments') @section('content')

Incoming payments

M-Pesa, bank and other channel credits waiting to be matched to learner invoices. The account reference is the student ID (Account Number); older admission-number references still match.
Export payments
@include('finance._nav') @php $sumFor = fn ($status) => $summary->firstWhere('status', $status); $pending = $sumFor('Pending') ?? $sumFor('pending'); $reconciled = $sumFor('Reconciled') ?? $sumFor('reconciled'); $rejected = $sumFor('Rejected') ?? $sumFor('rejected'); $matchFor = fn ($tx) => $students[(string) $tx->account_ref] ?? ($tx->student_id ? ($students[(string) $tx->student_id] ?? \App\Models\Student::find($tx->student_id)) : null); @endphp

Transaction feed

{{ num($transactions->total()) }} records matched to filters.
@forelse($transactions as $tx) @php($matchedStudent = $matchFor($tx)) @empty @endforelse
CodeSourcePayerAmount Account refLearnerTransactedStatusReceiptActions
{{ $tx->trans_code }}
{{ $tx->phone ?: '—' }}
{{ $tx->source }} {{ $tx->payer_name ?: '—' }} {{ money($tx->amount) }} {{ $tx->account_ref ?: '—' }}@if($tx->type)
{{ $tx->type }}
@endif
@if($matchedStudent){{ $matchedStudent->full_name }}
ID {{ $matchedStudent->id }}
@elseNo match@endif
{{ $tx->transacted_at ? \Carbon\Carbon::parse($tx->transacted_at)->format('d M Y H:i') : '—' }} {{ $tx->receipt_no ?: '—' }}
@if($tx->status !== 'Reconciled') @if($mpesaDemo && $tx->type === 'STK')
@csrf
@endif
@csrf
@else
@csrf
@php($receiptPayment = \App\Models\Payment::where('receipt_no', $tx->receipt_no)->first()) @if($receiptPayment) @endif @endif
@include('shared.pager', ['paginator' => $transactions])
@foreach($transactions as $tx) @if($tx->status !== 'Reconciled')
@csrf

The learner is matched on the student ID in the account reference, with admission number kept as a fallback for older records. A receipt is generated and the invoice updated.

@endif @endforeach @endsection