Calculate in Custom Print Format (Calculate in Jinja)

Hi Everyone,

I have been created a custom print format for “Journal Ledger”,
what I want is how to calculate debit and credit accounts for each currency as the photo below!

Thank you in advance!

Check below