Actually, that is not the sorting process. Receivables and payables are first sorted by currency of the associated customers/suppliers. Within currencies, they are in subaccount balance order. I do not believe there is a third active sort criteria, leaving zero-value customers/suppliers to display in the order of either their creation or last position in the list.
Moving inactive customers/suppliers to the bottom would interfere with this scheme, which attaches priority to subaccount balance. Inactive customers/suppliers can still have receivable/payable balances.
It is unlikely that a inactive customer etc could have a balance. However it is still possible to program it that balances other than zero are at the top. Inactive customers/suppliers can still be shown at the bottom whilst still allowing currency and subaccount order. It’s not a question of one or the other.
You just simply create filter rules that are applied in a certain order - balance other than zero at top, then inactive suppliers below active suppliers and for active suppliers, do it in order of currency and sub account. It’s not that difficult to do programmatically.