In your Map/Reduce script on the the reduce phase ...
# accounting
e
In your Map/Reduce script on the the reduce phase process those records you retrieved from getInputData phase to transform the sales orders into invoices.