Maybe I'm missing something, but it seems like you could have an OR condition to eliminate the code duplication
if condition='ExcludeInactiveAllergiesAlerts="No" OR flag'="No"
I see where you are coming from with having a status code returned to notify a problem exists.
Personally, I'd calculate comissions in a seperate single responsibility class that extends an abstract class for interface segregation. That class implements three public methods: Calculate(), HasError(), GetError()
//calculate then commission:
Set tCommission = tUsedCarCommission.Calculate()
//log the error or do something with it
It's very similar to what you'd do with traditional status types but without having to deal with passing in references. Also, IMO, it's very clear what's going on if the commission has an error.
We use various methods and macros to log exceptions, it just depends on the situation.
Log in or create a new account to continue