calculate balance on transaction page