I would use what you have done at the top of your ...
# suitescript
k
I would use what you have done at the top of your module where you would have an if cashsale or if sales order.