This right here.
Here we're loading the customer record and updating their discount %
Here we're loading the broker record and updating their commision %
They will have 99% identical code.
It's possible but exceedingly unlikely we have found 2 things that should be a load_record_and_update_percent(file,id,field,val)
Tomorrow the business logic behind one of those will no longer be a simple % and now you have a real mess.