I wrote an article on how to model a ledger with a DB. https://www.jaygoel.com/posts/building-a-scalable-accounting...
It addresses how to model dr/cr in a DB with positive and negative numbers, but still produce reports with positive numbers as expected