How to do Dual Entry to credit and debit the balance?

How to do Dual Entry to credit and debit the balance?

Hey there,
How to do Dual Entry to credit and debit the balance. I have field called deposit / withdraw (Currency) and account from and account to with their balances which are been fetched by fetch record. Now whenever I save the record it should reflect both the accounts resulting in credit and debit of the accounts.

Any help would be appreciated.

Thanks in advance!