modified credit/debit in ledger.sql