I have a table of transactions of equipment between the shops, that looks like this:

It is supposed to be updated – the new transactions would be added below, with more different shops.
I am trying to make some sort of a pivot table, which would take both Source shops and Recipient Shops and count the balance of transferred items – if a shop was a source in a transaction, the amount should be subtracted from the total, if a shop was recipient, amount should be added. Also the type of equipment should be distinguished.
I imagine it like this:
