@extends('layouts.finance')
@section('title', 'PayFast Credits')
@section('subtitle', 'PayFast store-credit top-ups from the Examism v3 database')
@section('content')
@php
$filters = $filters ?? ['mode' => 'month', 'month' => now()->format('Y-m'), 'from' => now()->startOfMonth()->toDateString(), 'to' => now()->endOfMonth()->toDateString(), 'q' => ''];
$rows = $rows ?? collect();
$total = (float) ($total ?? 0);
$feeTotal = (float) ($feeTotal ?? 0);
$todayTotal = (float) ($todayTotal ?? 0);
$todayFee = (float) ($todayFee ?? 0);
$todayNet = (float) ($todayNet ?? max(0.0, $todayTotal - $todayFee));
$slabs = $slabs ?? \App\Support\FinanceSuiteMetrics::KUICKPAY_FEE_SLABS;
$isPaginated = $rows instanceof \Illuminate\Contracts\Pagination\LengthAwarePaginator;
@endphp
{{-- FILTERS --}}
Filters
{{ $filters['mode'] === 'date' ? 'Date wise' : 'Monthly' }}
{{-- SUMMARY KPI --}}
Total Credits (Filtered)
{{ $metrics->money(max(0, $total - $feeTotal), 'PKR') }}
Before fee: {{ $metrics->money($total, 'PKR') }}
{{ \Illuminate\Support\Carbon::parse($filters['from'])->format('M d, Y') }}
–
{{ \Illuminate\Support\Carbon::parse($filters['to'])->format('M d, Y') }}
Total Fee (Filtered)
{{ $metrics->money($feeTotal, 'PKR') }}
Net after fee: {{ $metrics->money(max(0, $total - $feeTotal), 'PKR') }}
Today Credits
{{ $metrics->money($todayTotal, 'PKR') }}
{{ now()->format('M d, Y') }}
Today Fee
{{ $metrics->money($todayFee, 'PKR') }}
Net after fee: {{ $metrics->money($todayNet, 'PKR') }}
@if($isPaginated)
Total Rows
{{ number_format($rows->total()) }}
Across all pages
@endif
{{-- FEE STRUCTURE REFERENCE --}}
Fee Structure
Per single transaction · same as KuickPay
| Transaction Amount |
Fee (PKR) |
@foreach($slabs as $slab)
| {{ $slab['label'] }} |
{{ number_format($slab['fee']) }} |
@endforeach
{{-- TRANSACTIONS TABLE --}}
PayFast Transactions
store_credit_transactions · linked bank
| # |
Reference |
Agent ID |
Order |
Amount (PKR) |
Fee (PKR) |
Date |
@forelse($rows as $i => $row)
@php
$offset = $isPaginated ? (($rows->currentPage() - 1) * $rows->perPage()) : 0;
$rowNum = $offset + $i + 1;
$reference = $row->TransactionId ?? '-';
$agentId = $row->agent_id ?? '-';
$orderId = $row->order_id ?? '-';
$amount = (float) ($row->amount ?? 0);
$fee = $metrics->kuickpayFee($amount);
$txDate = $row->created_at ?? '-';
@endphp
| {{ $rowNum }} |
{{ \Illuminate\Support\Str::limit($reference, 20) }} |
#{{ $agentId }} |
{{ $orderId }} |
{{ $metrics->money($amount, 'PKR') }} |
{{ $metrics->money($fee, 'PKR') }} |
{{ $txDate }} |
@empty
|
No PayFast transactions found for the selected filters.
|
@endforelse
@if($isPaginated && $rows->hasPages())
{{ $rows->appends(request()->query())->links() }}
@endif
@endsection