You actually cannot link them. However you can make compensations between customer and supplier through journal entries.
Keep in mind that by law you cannot make an automatic compensation between debits and credits without a written contract with the counterpart listing the invoices and with the exact amounts to be compensated.