We found that is necessary to separate the final cost calculations from the actual gathering of statistics since the cost calculations can, and will, vary depending on many things that you don't want to hardcode into the pre processing solution.
Besides, we found out that we really wanted to have the meta data ENVELOPE_TRIGGER, and not rely on the document trigger. There are a number of good reasons for it. Consider it.
Postal base cost vary typically on envelope size (S65, C5, C4, Small Box, Large Box or whatever), weight (in grams), mail class (economy, international, express, …), destination (domestic, international, ...) and postal company. Then you of course have the sorting and optimization that might yield in different rebates, but those tend to be calculated very late in the process, sometimes not until the postal company calculates the invoices.
So, what can you keep track of in the post processor?
-The destination. A comment on this one. We found out that it is important that you keep track of where the stuff is printed and delivered to the postal company, since that will ultimately decide what is domestic. We had a case with the Norwegian branch of the company having customers actually living in Sweden, and the Norwegian branch invoices was printed in Norway, so the customers living in Sweden got international mail delivered by the Norwegian post. We considered splitting jobs on destination so as much as possible would be printed locally, but it turned out to be too complex given physical inserts, pre printed papers and envelopes.
-The weight (including inserts, and only counting inserts once when co-enveloping)
-The envelope size
-The mail class
-The postal company
-The number of pages
-The number of sheets
-The number of envelopes
The final rating of the cost per customer is done in the economy system.