Handle orphaned documents when a taxed AP/AR Open Item is cancelled

Handle orphaned documents when a taxed AP/AR Open Item is cancelled.  Clear database entry.
I've just merged 4_5_x forward into 4_6_x and backwards into master.