jaizendra-netizen / invoice-aging-report
PHP CLI and library: bucket the open invoices in a CSV by days past due as of a date you give, and show per bucket the count, amount and share.
Package info
github.com/jaizendra-netizen/invoice-aging-report
Type:project
pkg:composer/jaizendra-netizen/invoice-aging-report
Requires
- php: >=8.1
Requires (Dev)
None
Suggests
None
Provides
None
Conflicts
None
Replaces
None
This package is not auto-updated.
Last update: 2026-11-30 04:52:23 UTC
README
PHP command line tool and library. Give it a CSV of invoices that still carry an open amount, with a due date, and a date to measure from. It counts how many invoices are not yet due or fall into each band of days past due, adds up the open amount in each band, shows each band's share of the total open amount, names the customers with the most overdue money, and lists every invoice more than N days past due. It only does arithmetic on the figures you give: it reads no accounting system, adds no currency, sets no payment terms and says nothing about whether an invoice will be paid. Days past due is the as-of date minus the due date in whole calendar days. The bands are fixed: not yet due (the invoice is due on or after the as-of date, so 0 days or less past due), 1 to 30, 31 to 60, 61 to 90 and over 90 days past due. Rows whose amount_open is 0 are counted as paid and skipped and left out of everything else. Customers are matched without regard to case and the first spelling seen in the file is shown. The overdue list counts only invoices at least 1 day past due, shows the 10 customers with the most overdue amount (ties by name) and for each the overdue amount, the number of invoices overdue and the oldest days past due. Money is shown with 2 decimals and shares with 1 decimal. The clock is never read: --as-of is required, so the same file and date always print the same report.
Part of the OneGTMLab free GTM tools. Background on the idea: Zoho CRM.
Install
composer require jaizendra-netizen/invoice-aging-report
Use
Input is a CSV with the columns invoice_id, customer, due_on (yyyy-mm-dd) and amount_open (a non-negative decimal in your own currency; the tool adds none). Column names are matched without regard to case and may be in any order. Option --as-of yyyy-mm-dd is required. Option --list-over N (a whole number of 0 or more, default 60, set by you) lists every invoice more than N days past due, oldest first, as invoice id, customer, days and amount. A duplicate invoice_id, a bad date such as 2026-02-30, a bad or negative amount, an empty customer, a missing column, a row with the wrong number of cells, a file with no rows, a bad --as-of or a bad --list-over exits 1 with a message that names the row where there is one. An unreadable file, an unknown option or a missing --as-of exits 2. When every row is paid the report says no open invoices and exits 0.
$ php bin/invoice-aging-report sample.csv --as-of 2026-01-15 --list-over 60
rows read: 12, paid and skipped: 2, open invoices: 10, total open: 6675.75, as of 2026-01-15
days past due:
not yet due: invoices 2, amount 750.00, share of open amount 11.2%
1 to 30: invoices 2, amount 1300.50, share of open amount 19.5%
31 to 60: invoices 2, amount 1600.00, share of open amount 24.0%
61 to 90: invoices 2, amount 950.25, share of open amount 14.2%
over 90: invoices 2, amount 2075.00, share of open amount 31.1%
customers with the most overdue amount:
Delta: overdue 3200.00, invoices overdue 2, oldest 91 days past due
Alpha: overdue 1150.25, invoices overdue 2, oldest 90 days past due
Gamma: overdue 1100.50, invoices overdue 2, oldest 61 days past due
Beta: overdue 400.00, invoices overdue 1, oldest 31 days past due
Epsilon: overdue 75.00, invoices overdue 1, oldest 228 days past due
invoices more than 60 days past due (set by you):
INV-010, Epsilon, 228 days, 75.00
INV-009, Delta, 91 days, 2000.00
INV-008, Alpha, 90 days, 150.25
INV-007, Gamma, 61 days, 800.00
Test
php tests/run.php
Offline, no network calls, no dependencies beyond the language runtime. MIT licensed.