reverse intercompany transaction

Hi,

A vendor payment was processed for an intercompany transaction. Commission was collected for Company B on behalf of compnay A. Company A has now paid the commission collected to company B through a cheque payment.

The cheque payment was deposited in Company B bank account. However the intercompnay account needs to be cleared as Company B did the following journal entry.

Dr:Bank

Cr:Other Income

Is there any way to clear the intercompany acount in compnay B without reversing the Accounts Payable transactions?

Company A should not have posted payment to the intercompany account in the first place.

Thanks