Thank you for your feedbacks.

One specific comment: In lines 577-584, you should replace the current construction (if (a&&!b) {} else if (a&&b) {} else {}) with nested ifs (i.e. if (a) { if (b) {} else {}} else {}).
One thing that I do notice when testing, however, is that, in "wealth (detail)" and "destination (detail)" modes, when passengers/mail/goods are going to a destination that is not in a town, an empty pair of brackets are displayed where the town name would usually go.
Thank you for pointing it out. I think they were the same issue. I think now I fixed it.
I wonder whether you would agree that sorting by "Via (amount)" which currently gives results like:
30 via A
25 to B
20 to C
15 via B
5 via C
would be more useful if it told us how many passengers wanted to travel either to or via, like this:
40 via B (25 to, 15 via)
30 via A
25 via C (20 to, 5 via)
especially as that is far more useful in determining where to add service. Listing the "to" and "via" separately seems quite confusing, don't you think?
I'm not sure whether that would be simple or complex to change.
I think it would be relatively complicated to combine them while still showing the separate numbers, but relatively simple to combine them with just a single total.
I agree with wlindley's idea.

I have integrated these based on the second proposal from ACarlotti.
Please check the following comparison picture.

It is very useful to know where convoy passengers get off and where passengers waiting at the station are getting off.
IMO, I don't think it's necessary to divide this into via and to in this case. If player want to distinguish between "via" and "to", via (detail) will let you know, so I don't think there is any problem with integrating them in via (amount).