๐ Problem Statement
As a finance or operations manager, I experience issues when a payment applied to the wrong invoice must be unlinked and reapplied to another. Currently, unlinking a payment retroactively changes historical accounting reports (e.g., monthly payment totals), which leads to inaccurate historical reporting and reconciliation mismatches with payment processors or bank deposits.
This results in financial inconsistencies where previous monthsโ totals fluctuate over time, making it impossible to maintain accurate period-end reconciliations.
๐ก User Story
As a Pelcro admin, I want to reallocate a payment from one invoice to another without altering past reports, so that historical accounting data remains accurate.
As a finance user, I want invoices that were previously paid to become โunpaidโ only from the date of reallocation onward, so that AR and payment dashboards reflect the real-time state correctly.
As an accountant, I want to see a clear audit trail of reallocations, so that I can trace all payment movements for audit and reporting purposes.
๐ฏ Definition of Done (DoD)
โ๏ธ Given a payment that was previously applied to Invoice A,
When the user unlinks (reallocates) it to another invoice (Invoice B),
Then:
The original paid_at timestamp remains unchanged in historical data.
The invoice gains a new unpaid_at timestamp to indicate when it became unpaid.
The payment record gains an unlinked_at timestamp, preserving its history.
The reallocation does not modify or delete any existing event timestamps (paid_at, created_at, etc.).
The payment appears in Customer Balance until it is reapplied.
The invoice status dynamically reflects its state based on timestamps:
Paid if paid_at exists and unpaid_at is null or later than report cutoff.
Unpaid if unpaid_at exists and is before or equal to report cutoff.
Historical accounting reports (e.g., August) remain stable and unchanged.
The Accounting Dashboard adjusts AR based on the latest unpaid_at values.
โ๏ธ This change will impact:
API: invoice and payment models (add unpaid_at, unlinked_at, and reallocation metadata).
UI: Invoice detail view, Payment detail view, Customer Balance tab.
Reports: Accounting Dashboard and AR Aging Reports logic to use timestamp-based conditions.
โ๏ธ This solution will include the following limitations:
Reallocations cannot delete or overwrite historical timestamps.
Reporting consistency depends on using the new timestamp filters (paid_at vs. unpaid_at).
This does not introduce double-entry accounting โ it is timestamp-based only.

Implementation Notes
New fields to add:
{
"invoice": {
"paid_at": "datetime",
"unpaid_at": "datetime|null",
"previously_paid": true|false
},
"payment": {
"linked_at": "datetime",
"unlinked_at": "datetime|null",
"reallocated_to_invoice_id": "integer|null"
}
}Query logic for reporting:
Payments received by period:
WHERE linked_at <= period_end AND (unlinked_at IS NULL OR unlinked_at > period_end)Invoices considered paid:
WHERE paid_at <= period_end AND (unpaid_at IS NULL OR unpaid_at > period_end)Current AR (live):
WHERE unpaid_at IS NOT NULL OR paid_at IS NULLPlease authenticate to join the conversation.
Backlog
Pelcro Product
Accounting
5 months ago

Rana Haleem
Get notified by email when there are changes.
Backlog
Pelcro Product
Accounting
5 months ago

Rana Haleem
Get notified by email when there are changes.