Issue with gifting item from reopened ticket with custom rules/queries

Backstory: I’ve automated posting cigar commission sales to their respective account on settle (working just fine).

Were a ticket to be reopened, rules automatically deduct the commission from needed accounts (working just fine, too).

I don’t want someone to be able to reopen a ticket, comp a cigar, and then resettle with the commission intact (hence the removal rule). There may be genuine reasons to reopen and comp a cigar so I don’t want to disallow it.

My issue arises when settling the reopened ticket. It seems that gstatus is not updated prior to the rule calculating.

How can I set things up so that orders are updated prior to the commission rule firing?

Below are some screen shots if it helps:

Samba.Presentation_04_20_13_10_56
Two cigars whose commission should total 100

Samba.Presentation_04_20_13_11_04
Paid in full, ticket closed, proper amount displayed for commission and entered into proper accounts.

Samba.Presentation_04_20_13_11_44

Reopened ticket, one cigar comped

Ssms_04_20_13_1156

Product comped and before settling, DB still shows two cigars for that order. The view used for cigar commissions eliminates any order with a comp or void.

Samba.Presentation_04_20_13_12_06

When settling reopened ticket, commission for both is calculated as DB still shows two cigars.

Ssms_04_20_13_1232

After everything is done, DB shows just one cigar that is not comped or voided.

This leaves too much in the commission account.

Rule for calculating commission.

Thanks for any guidance one can give.

Found that After Ticket Closing still has Ticked ID set. Using that event everything seems to work well.

This is like rubber duck debugging; I love it!