# easy-invoice/2.4.3/templates/admin/credit-note-page.php

Easy Invoice – Invoice Generator, PDF Quotes &amp; Payments, version 2.4.3. 178 lines.

- Page: https://pluginprobe.com/plugins/easy-invoice/2.4.3/code/templates/admin/credit-note-page.php
- Raw: https://pluginprobe.com/plugins/easy-invoice/2.4.3/raw/templates/admin/credit-note-page.php
- Modified: 2026-09-15T12:31:20+00:00

Line numbers below start at 1. Link to a line or a range by appending a fragment to the
page URL, for example `https://pluginprobe.com/plugins/easy-invoice/2.4.3/code/templates/admin/credit-note-page.php#L10-L20`.

```php
<?php
/**
 * Credit notes for one invoice.
 *
 * Receives from CreditNoteController::maybeRenderPage():
 *   $invoice, $invoice_id, $remaining, $credited, $notes, $notice
 *
 * @package Easy_Invoice
 */

use EasyInvoice\Controllers\CreditNoteController;

if ( ! defined( 'ABSPATH' ) ) {
    exit;
}

$total        = (float) $invoice->getTotal();
$ei_money     = new \EasyInvoice\Helpers\InvoiceFormatter( $invoice ); // the invoice's own currency
$invoices_url = admin_url( 'admin.php?page=easy-invoice-all' );
$fully        = $remaining <= 0.001;
?>

<div class="p-8">

    <div class="ei-app-page-header bg-white border-b border-gray-200 px-6 easy-invoice-admin-page-header">
        <div class="flex items-center justify-between flex-wrap gap-4">
            <div>
                <h1 class="text-2xl font-bold text-gray-900">
                    <?php
                    printf(
                        /* translators: %s: invoice number. */
                        esc_html__( 'Credit note for %s', 'easy-invoice' ),
                        esc_html( (string) $invoice->getNumber() )
                    );
                    ?>
                </h1>
                <p class="mt-1 text-sm text-gray-500">
                    <?php esc_html_e( 'An issued invoice cannot be edited or deleted — it is a tax record. A credit note leaves it standing and records the correction against it.', 'easy-invoice' ); ?>
                </p>
            </div>
            <a href="<?php echo esc_url( $invoices_url ); ?>" class="text-sm font-medium text-indigo-600 hover:text-indigo-800">
                <?php esc_html_e( 'Back to invoices', 'easy-invoice' ); ?>
            </a>
        </div>
    </div>

    <?php if ( '' !== $notice ) : ?>
        <div class="mt-6 rounded-md bg-blue-50 border border-blue-200 p-4">
            <p class="text-sm text-blue-900"><?php echo esc_html( $notice ); ?></p>
        </div>
    <?php endif; ?>

    <div class="mt-6 grid grid-cols-1 lg:grid-cols-3 gap-6 items-start">

        <!-- Position -->
        <div class="bg-white rounded-lg border border-gray-200 p-6">
            <h2 class="text-xs font-semibold uppercase tracking-wide text-gray-500"><?php esc_html_e( 'Position', 'easy-invoice' ); ?></h2>
            <dl class="mt-3 space-y-2 text-sm">
                <div class="flex justify-between">
                    <dt class="text-gray-500"><?php esc_html_e( 'Invoiced', 'easy-invoice' ); ?></dt>
                    <dd class="text-gray-900" style="font-variant-numeric: tabular-nums;"><?php echo esc_html( $ei_money->format( $total ) ); ?></dd>
                </div>
                <div class="flex justify-between">
                    <dt class="text-gray-500"><?php esc_html_e( 'Credited', 'easy-invoice' ); ?></dt>
                    <dd class="text-gray-900" style="font-variant-numeric: tabular-nums;"><?php echo esc_html( $ei_money->format( $credited ) ); ?></dd>
                </div>
                <div class="flex justify-between border-t border-gray-100 pt-2 font-semibold">
                    <dt class="text-gray-900"><?php esc_html_e( 'Still creditable', 'easy-invoice' ); ?></dt>
                    <dd class="text-gray-900" style="font-variant-numeric: tabular-nums;"><?php echo esc_html( $ei_money->format( max( 0, $remaining ) ) ); ?></dd>
                </div>
            </dl>
        </div>

        <!-- Issue -->
        <div class="bg-white rounded-lg border border-gray-200 p-6 lg:col-span-2">
            <h2 class="text-lg font-semibold text-gray-900"><?php esc_html_e( 'Issue a credit note', 'easy-invoice' ); ?></h2>

            <?php if ( $fully ) : ?>
                <p class="mt-2 text-sm text-gray-600">
                    <?php esc_html_e( 'This invoice has been credited in full. There is nothing left to credit.', 'easy-invoice' ); ?>
                </p>
            <?php elseif ( empty( $can_issue ) ) : ?>
                <p class="mt-2 text-sm text-gray-600">
                    <?php esc_html_e( 'Your role can view credit notes but not issue them.', 'easy-invoice' ); ?>
                </p>
            <?php else : ?>
                <form method="post" action="<?php echo esc_url( admin_url( 'admin-post.php' ) ); ?>" class="mt-4">
                    <input type="hidden" name="action" value="<?php echo esc_attr( CreditNoteController::ACTION_CREATE ); ?>">
                    <input type="hidden" name="invoice_id" value="<?php echo esc_attr( (string) $invoice_id ); ?>">
                    <?php wp_nonce_field( CreditNoteController::ACTION_CREATE ); ?>

                    <div class="grid grid-cols-1 sm:grid-cols-3 gap-4">
                        <div>
                            <label for="ei-cn-amount" class="block text-sm font-medium text-gray-700"><?php esc_html_e( 'Amount', 'easy-invoice' ); ?></label>
                            <input type="text" inputmode="decimal" id="ei-cn-amount" name="amount"
                                   placeholder="<?php echo esc_attr( number_format_i18n( max( 0, $remaining ), 2 ) ); ?>"
                                   class="mt-1 block w-full rounded-md border-gray-300 shadow-sm text-sm">
                            <p class="mt-1 text-xs text-gray-500">
                                <?php esc_html_e( 'Leave empty to credit the whole invoice.', 'easy-invoice' ); ?>
                            </p>
                        </div>
                        <div class="sm:col-span-2">
                            <label for="ei-cn-reason" class="block text-sm font-medium text-gray-700"><?php esc_html_e( 'Reason', 'easy-invoice' ); ?></label>
                            <input type="text" id="ei-cn-reason" name="reason"
                                   placeholder="<?php esc_attr_e( 'e.g. Item returned, billed in error', 'easy-invoice' ); ?>"
                                   class="mt-1 block w-full rounded-md border-gray-300 shadow-sm text-sm">
                            <p class="mt-1 text-xs text-gray-500">
                                <?php esc_html_e( 'Appears on the credit note. Worth writing — it is what your accountant reads a year from now.', 'easy-invoice' ); ?>
                            </p>
                        </div>
                    </div>

                    <button type="submit" class="mt-4 inline-flex items-center px-3 py-1.5 text-sm font-medium rounded-md bg-indigo-600 text-white hover:bg-indigo-700">
                        <?php esc_html_e( 'Issue credit note', 'easy-invoice' ); ?>
                    </button>
                </form>
            <?php endif; ?>
        </div>
    </div>

    <?php if ( ! empty( $notes ) ) : ?>
        <div class="mt-6 bg-white rounded-lg border border-gray-200 p-6">
            <h2 class="text-lg font-semibold text-gray-900"><?php esc_html_e( 'Credit notes against this invoice', 'easy-invoice' ); ?></h2>
            <div class="mt-4 overflow-x-auto">
                <table class="min-w-full divide-y divide-gray-200 text-sm">
                    <thead>
                        <tr class="text-left text-xs uppercase tracking-wide text-gray-500">
                            <th class="py-2 pr-4 font-semibold"><?php esc_html_e( 'Number', 'easy-invoice' ); ?></th>
                            <th class="py-2 px-4 font-semibold"><?php esc_html_e( 'Date', 'easy-invoice' ); ?></th>
                            <th class="py-2 px-4 font-semibold"><?php esc_html_e( 'Reason', 'easy-invoice' ); ?></th>
                            <th class="py-2 px-4 font-semibold text-right"><?php esc_html_e( 'Amount', 'easy-invoice' ); ?></th>
                            <th class="py-2 pl-4 font-semibold text-right"><?php esc_html_e( 'PDF', 'easy-invoice' ); ?></th>
                        </tr>
                    </thead>
                    <tbody class="divide-y divide-gray-100">
                        <?php foreach ( $notes as $credit_id ) : ?>
                            <?php $note = new \EasyInvoice\Models\Invoice( get_post( $credit_id ) ); ?>
                            <tr>
                                <td class="py-2.5 pr-4 font-medium text-gray-900"><?php echo esc_html( (string) $note->getNumber() ); ?></td>
                                <td class="py-2.5 px-4 text-gray-700"><?php echo esc_html( (string) $note->getIssueDate() ); ?></td>
                                <td class="py-2.5 px-4 text-gray-500">
                                    <?php echo esc_html( (string) get_post_meta( $credit_id, \EasyInvoice\Services\CreditNote::META_REASON, true ) ); ?>
                                </td>
                                <td class="py-2.5 px-4 text-right text-gray-900" style="font-variant-numeric: tabular-nums;">
                                    <?php echo esc_html( $ei_money->format( (float) $note->getTotal() ) ); ?>
                                </td>
                                <td class="py-2.5 pl-4 text-right">
                                    <a href="<?php echo esc_url( CreditNoteController::downloadUrl( (int) $credit_id ) ); ?>"
                                       class="text-indigo-600 hover:text-indigo-800 font-medium"><?php esc_html_e( 'Download', 'easy-invoice' ); ?></a>
                                    <?php
                                    /**
                                     * Extra actions for one credit note.
                                     *
                                     * The seam the E-Invoicing addon uses to offer the
                                     * structured formats here, the same way it adds them
                                     * to invoice rows. A credit note is a document under
                                     * EN 16931 in its own right (type code 381), so it
                                     * needs the same treatment as the invoice it corrects.
                                     *
                                     * @param array $actions   Rendered anchors, keyed.
                                     * @param int   $credit_id Credit note ID.
                                     */
                                    $cn_actions = (array) apply_filters( 'easy_invoice_credit_note_actions', [], (int) $credit_id );
                                    foreach ( $cn_actions as $cn_action ) {
                                        echo '<span class="ml-3">' . wp_kses_post( $cn_action ) . '</span>';
                                    }
                                    ?>
                                </td>
                            </tr>
                        <?php endforeach; ?>
                    </tbody>
                </table>
            </div>
        </div>
    <?php endif; ?>

</div>

```
