One payment can cover costs that belong in different accounts. Use one line per category, each with its own amount; the lines add up to what was paid.
The Profit and Loss shows each category's total for a period. Run it for the months you need; the From and To dates decide what is in it.
When a past cost sits in the wrong account, open the transaction and change the line's category. The payment and its date stay as they were, so the bank still matches, and the cost moves to where it belongs.