Tab listing sort order

Previously, Sales Invoices and Purchases Invoices tabs were sorted, by default, in the order of attention required. Overpaid invoices were listed first, overdue invoices next, coming due third, and paid in full last. Within the overdue groups, longest overdue were listed first. Within the coming due groups, invoices were ordered by days until due.

Now, the order is scrambled. The default lists show:

Sales Invoices:

Purchase Invoices:

For Sales Invoices, Overpaid comes first, as it did before. But the Overdue group is a text sort rather than numerical. And Due in… invoices seem to be inserted randomly. For Purchase Invoices, the Overdue invoices are sorted numerically (all 1340 of them) except for one invoice overdue by 551 days, which is inserted for some reason between 1161 and 1169 days overdue (second from the bottom in the right-hand illustration).

Things get more confusing when sorting on the Status column heading. On the first click (arrow pointing downwards), the results for both tabs are straight, reverse-order textual sorts. Within the Within the groups containing numbers, this removes numerical context. But the stray purchase invoice that is 551 days overdue resumes its place in the reverse text scheme, despite the scheme’s lack of logic:

Sales Invoices:

Purchase Invoices: 1st Click Status Sort Purchase Invoices

After the second click on the Status column heading (arrow pointing upwards), the results are straight, forward-order text sorts. Again, there is no numerical context:

Sales Invoices: 2nd Click Status Sort Sales Invoices Purchase Invoices:2nd Click Status Sort Purchase Invoices

Actually, the sorting of unpaid invoices is by issue date. Not by due date.

Here is the sorting algorithm:

  • Overpaid invoices first as this is a bookkeeping error
  • Then unpaid invoices sorted by issue date
  • Then paid invoices

When you click Status column, it is simply sorting alphabetically as if it’s plain text.

Well, @lubos, now that you have explained the sorting algorithm, I can see that is how the program behaves. Two things combined to make my earlier explanation seem like what “previously” happened:

  • I did not understand that you were treating both the overdue and coming due invoices as part of the same sorting step (based on issue date). In every display in every real or test business I had looked at, they were always grouped, as though those were two distinct groups. I see now that they are simply “unpaid,” not “overdue” and “due in X days.”
  • All my real-world invoices have approximately equal gaps between issue dates and due dates. This reinforced the clustering into apparent groups, even though those groups were not real. And the number of days overdue or until due almost always tracked with issue dates.

I didn’t notice any of this until deliberately forcing unusual conditions in a test business. This was an interesting illustration of how a conclusion can be drawn that is wrong, even though completely consistent with observations. Correlation is not causation, eh?

1 Like

@lubos is there any possibility that both Sales Invoices and Purchase Invoices can be listed according to the due date when one clicks on Status? Like overpaid first, overdue by the most to the least days, due in the least to most days, paid in full?