Could you write something to run before invoicing to populate the misc charges, based on qty shipped - qty invoiced?
We calculate the surcharge at shipping and stuff it in the misc charges automatically. Standard invoicing picks it up there. You need 4gl, but not Syteline source code. It's running under sl5.02.10.
I wrote some code to fire with the standard ship transaction. Our program does lots of stuff, but you only need to calculate the surcharge and add it to the Misc charge on the order header.
Assuming you have a mods directory in your propath. I copied the standard co\co-t-p.r, renaming it, mods\co\Sco-t-p.r, (notice the S in the new name) then the new program is named mods\co\co-t-p.p
The first thing the new program does is run the standard code as co\Sco-t-p.r. If the return code from the Sco-t-p is good, it calculates the surcharge, and adds it to the misc charge on the Order header. Invoicing will then pick it up and put it at the bottom of the invoice.
It could be really simple, BUT OF COURSE there were customers and items that we were exempt or a special rate. So then we needed to build that information into the customers and items, and check that before calculating the charge.