How AX calculated account balance

Dear

I would like to know how dynamics AX calculated the account balance, I thought it calculates using ledgerTrans table but I think it uses another tables.

I really want to understand how the system get the account balance.

Thanks

Ayoub