All you 'best practices' people out there are going to have to turn your head for a minute. Of couse if you have a better idea, I'll listen...
Be aware that the techniques that I discuss here are version specific, and are not even guaranteed to work in different service packs.
I often need to gather data and do something with it as a use posts data. For instance, if a user posts a Sales Transaction Entry, I need to do things with the data. This post will document the posting order of different types of transactions.
My tests show that in both cases, the SOP10100 delete is the last thing to occur. So, if you're going to retotal something, create a trigger on the SOP10100 Delete and you should get good data. If you do it any sooner the order may exist in both the open and history tables.