User Tools

Site Tools


wiki:project-x:bugs:188

#188 — The "Total" column on the invoice list prints the pre-tax subtotal, so every taxed invoice is understated by exactly its tax (Resolved)

← Back to bug list · View issue #188 in MantisBT


Reported by: Nour aboulhosn on 2026-08-08T08:28:43+01:00
Assigned to: Claude
Resolved by: Claude on 2026-08-08T10:47:53+01:00
Severity: major
Priority: high
Reproducibility: have not tried
Category: General

Description: A fresh `$250.00` invoice at 20% VAT opens as `Subtotal $250.00 · VAT 20% $50.00 · Total $300.00`, and the CSV export agrees at `300.00`. The invoice list, under a column headed Total, shows `$250.00`. Ten of the account's invoices are affected and the gap is always the tax to the cent.

The main invoice screen therefore understates what customers owe, and the list looks mis-sorted: sorting by Total is applied to the real figure, so a row showing `$200.00` is placed above one showing `$222.00` (its true total is `$240.00`).

The column is reading the subtotal field where it should read the same gross total the detail page and the export already use.

Steps to Reproduce: 1. Settings → Tax: tick “Charge tax on invoices”, rate `20`, leave “Prices already include tax” unticked. Save. 2. Create a sales invoice for `1 × $250.00`. 3. Open it. It reads `Subtotal $250.00 · VAT 20% $50.00 · Total $300.00`. 4. Invoices → Export: the CSV row reads `QA-FINAL-TAX,…,300.00,…`. 5. Go back to the invoice list. The row's Total column reads `$250.00`. 6. Sort by Total descending. The displayed figures are not in descending order, because the sort uses the true total while the column shows the subtotal.

Resolution: Fixed.

WHAT WAS WRONG `Invoice::listFor()` returns two money columns: `total`, which is the SUBTOTAL (the sum of line totals, before tax), and `gross_total`, which is what the customer owes. Under a column headed Total, the list view printed `total`. Every taxed invoice was therefore understated by exactly its tax.

WHY IT LOOKED MIS-SORTED `Invoice::SORTABLE` maps 'total' to `gross_total`, so the ORDER was correct all along while the printed figure was not — which is why a row showing $200.00 sat above one showing $222.00 whose real total is $240.00. The ordering was never broken; the number beside it was.

THE FIX app/views/invoices/index.php now prints `$invoice['gross_total']`. The detail page, the CSV export and Core\Search already used `gross_total` — this row was the only one out. VERIFIED Against the database, on a real $250 invoice at 20% exclusive tax: listFor()['total'] = 250.00 (the subtotal, unchanged) listFor()['gross_total'] = 300.00 (what the list now prints) ===== Activity / Notes ===== * 2026-08-08T10:47:50+01:00 - Claude: Fixed. WHAT WAS WRONG `Invoice::listFor()` returns two money columns: `total`, which is the SUBTOTAL (the sum of line totals, before tax), and `gross_total`, which is what the customer owes. Under a column headed Total, the list view printed `total`. Every taxed invoice was therefore understated by exactly its tax. WHY IT LOOKED MIS-SORTED `Invoice::SORTABLE` maps 'total' to `gross_total`, so the ORDER was correct all along while the printed figure was not — which is why a row showing $200.00 sat above one showing $222.00 whose real total is $240.00. The ordering was never broken; the number beside it was. THE FIX app/views/invoices/index.php now prints `$invoice['gross_total']`. The detail page, the CSV export and Core\Search already used `gross_total` — this row was the only one out.

VERIFIED Against the database, on a real $250 invoice at 20% exclusive tax:

listFor()['total']       = 250.00   (the subtotal, unchanged)
listFor()['gross_total'] = 300.00   (what the list now prints)

Full History

Date User Field Change
2026-08-08T08:28:43+01:00 Nour aboulhosn issue-new New Issue
2026-08-08T10:47:45+01:00 Claude Assigned To ⇒ Claudine
2026-08-08T10:47:48+01:00 Claude tag-added Tag Attached: done-by-claude
2026-08-08T10:47:50+01:00 Claude note-added Note Added: 0000144
2026-08-08T10:47:53+01:00 Claude Status new ⇒ resolved

Synced automatically from MantisBT issue #188.

wiki/project-x/bugs/188.txt · Last modified: by mantisbot