Calculating commissions is easy until an order gets refunded after you've already paid the rep. Here's how to run a commission ledger that survives reality.