0, 'total_amount' => 0, 'completed_payments' => 0, 'pending_payments' => 0, 'failed_payments' => 0 ], $stats); // Initialize amounts_by_currency array $amounts_by_currency = []; // Calculate stats from the payments array foreach ($payments as $payment) { $amount = floatval($payment->getAmount()); $status = $payment->getStatus(); $stats['total_amount'] += $amount; switch ($status) { case 'completed': $stats['completed_payments']++; break; case 'pending': $stats['pending_payments']++; break; case 'failed': $stats['failed_payments']++; break; } // Calculate currency breakdown $payment_currency = $payment->getCurrency(); // If currency is empty or "global", get the actual currency that was used if (empty($payment_currency) || $payment_currency === 'global') { $actual_currency = get_post_meta($payment->getId(), '_currency', true); $payment_currency = !empty($actual_currency) ? $actual_currency : get_option('easy_invoice_currency_code', 'USD'); } // If currency is still "global", use the global setting if ($payment_currency === 'global') { $payment_currency = get_option('easy_invoice_currency_code', 'USD'); } $payment_currency_symbol = $payment->getCurrencySymbol() ?: \EasyInvoice\Helpers\CurrencyHelper::getCurrencySymbol($payment_currency); // Normalize currency code to uppercase for consistent grouping $payment_currency = strtoupper($payment_currency); // Group amounts by currency if (!isset($amounts_by_currency[$payment_currency])) { $amounts_by_currency[$payment_currency] = [ 'amount' => 0, 'symbol' => $payment_currency_symbol ]; } $amounts_by_currency[$payment_currency]['amount'] += $amount; } // Check for bulk action notifications $notification = false; if (isset($_GET['bulk_trashed']) && $_GET['bulk_trashed'] > 0) { $count = intval($_GET['bulk_trashed']); easy_invoice_display_notification('success', sprintf(_n('%s payment moved to trash.', '%s payments moved to trash.', $count, 'easy-invoice'), $count)); $notification = true; } if (isset($_GET['bulk_restored']) && $_GET['bulk_restored'] > 0) { $count = intval($_GET['bulk_restored']); easy_invoice_display_notification('success', sprintf(_n('%s payment restored from trash.', '%s payments restored from trash.', $count, 'easy-invoice'), $count)); $notification = true; } if (isset($_GET['bulk_deleted']) && $_GET['bulk_deleted'] > 0) { $count = intval($_GET['bulk_deleted']); easy_invoice_display_notification('success', sprintf(_n('%s payment permanently deleted.', '%s payments permanently deleted.', $count, 'easy-invoice'), $count)); $notification = true; } if (isset($_GET['bulk_error'])) { $error = sanitize_text_field($_GET['bulk_error']); $error_message = 'An error occurred while processing the bulk action.'; if ($error === 'no_selection') { $error_message = 'Please select at least one payment to perform this action.'; } elseif ($error === 'invalid_action') { $error_message = 'Please select a valid bulk action.'; } easy_invoice_display_notification('error', $error_message); $notification = true; } ?>

Total Payments

Total Amount

$data): ?>

Completed Payments

Pending Payments

0): ?>
Showing to of results
1): ?>
Page of add_query_arg('paged', '%#%'), 'format' => '', 'current' => $current_page, 'total' => $total_pages, 'prev_text' => '‹ Previous', 'next_text' => 'Next ›', 'type' => 'array', 'end_size' => 1, 'mid_size' => 2, 'add_args' => array( 'page' => 'easy-invoice-payments', 'view' => $current_view, 'status' => $status_filter ) ); $top_pagination_links = paginate_links($top_pagination_args); if ($top_pagination_links) { echo '
'; foreach ($top_pagination_links as $link) { // Add null check to prevent passing null to easy_invoice_str_replace if ($link === null) { continue; } // Convert WordPress pagination to our styling $link = easy_invoice_str_replace('page-numbers', 'px-3 py-2 text-sm font-medium border border-gray-300 rounded-md', $link); $link = easy_invoice_str_replace('current', 'bg-indigo-50 border-indigo-500 text-indigo-600', $link); $link = easy_invoice_str_replace('prev', 'bg-white text-gray-500 hover:bg-gray-50', $link); $link = easy_invoice_str_replace('next', 'bg-white text-gray-500 hover:bg-gray-50', $link); $link = easy_invoice_str_replace('dots', 'bg-white text-gray-700', $link); // Add default styling for regular page numbers if ($link && strpos($link, 'bg-indigo-50') === false && strpos($link, 'bg-white') === false) { $link = easy_invoice_str_replace('border-gray-300', 'border-gray-300 bg-white text-gray-500 hover:bg-gray-50', $link); } echo $link; } echo '
'; } ?>
0 payments selected
getInvoiceId(); // Temporarily show all payments regardless of invoice ?>
Payment ID
Invoice
Amount
Method
Status
Date
Actions
#getId(); ?> post_type === 'easy_invoice'): $invoice = new \EasyInvoice\Models\Invoice($invoice_id); ?>
getNumber(); ?>
getTitle() ?: __('Untitled Invoice', 'easy-invoice')); ?>

ID: (Type: post_type : 'null'; ?>)
getCurrencySymbol() . number_format($payment->getAmount(), 2); ?> getPaymentMethod(); $gateway_manager = \EasyInvoice\EasyInvoice::getInstance()->getGatewayManager(); $gateways = $gateway_manager->getGateways(); // Try to get the gateway title from registered gateways $method_label = ucfirst(easy_invoice_str_replace('_', ' ', $payment_method)); // Default fallback foreach ($gateways as $gateway) { if ($gateway->getName() === $payment_method) { $method_label = $gateway_manager->getGatewayDisplayName($gateway->getName()); break; } } // Special case for manual payments if ($payment_method === 'manual') { $method_label = __('Manual', 'easy-invoice'); } echo esc_html($method_label); ?> getStatus(); $status_class = ''; $status_text = ''; switch ($status) { case 'completed': $status_class = 'bg-green-100 text-green-800'; $status_text = __('Completed', 'easy-invoice'); break; case 'pending': $status_class = 'bg-yellow-100 text-yellow-800'; $status_text = __('Pending', 'easy-invoice'); break; case 'failed': $status_class = 'bg-red-100 text-red-800'; $status_text = __('Failed', 'easy-invoice'); break; default: $status_class = 'bg-gray-100 text-gray-800'; $status_text = ucfirst($status); } ?> getPaymentDate() ? date('M j, Y', strtotime($payment->getPaymentDate())) : date('M j, Y', strtotime($payment->getPost()->post_date)); ?>
0): ?>
Showing to of results
1): ?>
Page of add_query_arg('paged', '%#%'), 'format' => '', 'current' => $current_page, 'total' => $total_pages, 'prev_text' => '‹ Previous', 'next_text' => 'Next ›', 'type' => 'array', 'end_size' => 1, 'mid_size' => 2, 'add_args' => array( 'page' => 'easy-invoice-payments', 'view' => $current_view, 'status' => $status_filter ) ); $bottom_pagination_links = paginate_links($bottom_pagination_args); if ($bottom_pagination_links) { echo '
'; foreach ($bottom_pagination_links as $link) { // Add null check to prevent passing null to easy_invoice_str_replace if ($link === null) { continue; } // Convert WordPress pagination to our styling $link = easy_invoice_str_replace('page-numbers', 'px-3 py-2 text-sm font-medium border border-gray-300 rounded-md', $link); $link = easy_invoice_str_replace('current', 'bg-indigo-50 border-indigo-500 text-indigo-600', $link); $link = easy_invoice_str_replace('prev', 'bg-white text-gray-500 hover:bg-gray-50', $link); $link = easy_invoice_str_replace('next', 'bg-white text-gray-500 hover:bg-gray-50', $link); $link = easy_invoice_str_replace('dots', 'bg-white text-gray-700', $link); // Add default styling for regular page numbers if ($link && strpos($link, 'bg-indigo-50') === false && strpos($link, 'bg-white') === false) { $link = easy_invoice_str_replace('border-gray-300', 'border-gray-300 bg-white text-gray-500 hover:bg-gray-50', $link); } echo $link; } echo '
'; } ?>