hledger icon indicating copy to clipboard operation
hledger copied to clipboard

report debits and credits separately

Open simonmichael opened this issue 12 years ago • 13 comments

Original author: [email protected] (October 11, 2011 19:32:21)

Noted by bkuhn: it's currently quite difficult with ledger and impossible with hledger to make a report showing the debit and credit totals separately (ie the totals of positive postings and negative postings). Should be easier.

Original issue: http://code.google.com/p/hledger/issues/detail?id=71

simonmichael avatar Apr 08 '13 16:04 simonmichael

Just curious, why is this useful? I've been wondering about it, but I unable to convince myself there's great meaning in having these separated in my report. I use a single "change" column. Would love to hear arguments for.

blais avatar Jun 02 '13 05:06 blais

That would be helpful to generate register output for the administration. For example in France, you have to use a debit and a credit column, and can't use the positive/negative notation.

legrostdg avatar Jul 22 '18 16:07 legrostdg

See ledger's --dc flag.

simonmichael avatar Feb 09 '19 18:02 simonmichael

I think this could be a really useful addition to hledger. To get a better understanding of how the balance changed (what was credited / debited to each account). E.g. for accounts receivable

entropitor avatar May 21 '20 11:05 entropitor

For the record, it’s easy to get this as two separate reports, using amt:’<0’ and amt:’>0’. Mockups/PRs welcome for a single report with separate columns.

simonmichael avatar May 21 '20 17:05 simonmichael

Examples from Ledger's manual:

--dc
Display register or balance in debit/credit format If you use --dc with either the register (reg) or balance (bal) commands, you will now get extra columns. The register goes from this:

12-Mar-10 Employer           Assets:Cash                $100        $100
                             Income:Employer           $-100           0
12-Mar-10 KFC                Expenses:Food               $20         $20
                             Assets:Cash                $-20           0
12-Mar-10 KFC - Rebate       Assets:Cash                  $5          $5
                             Expenses:Food               $-5           0
12-Mar-10 KFC - Food & Reb.. Expenses:Food               $20         $20
                             Expenses:Food               $-5         $15
                             Assets:Cash                $-15           0
To this:

12-Mar-10 Employer       Assets:Cash        $100           0        $100
                         In:Employer           0        $100           0
12-Mar-10 KFC            Expens:Food         $20           0         $20
                         Assets:Cash           0         $20           0
12-Mar-10 KFC - Rebate   Assets:Cash          $5           0          $5
                         Expens:Food           0          $5           0
12-Mar-10 KFC - Food &.. Expens:Food         $20           0         $20
                         Expens:Food           0          $5         $15
                         Assets:Cash           0         $15           0
Where the first column is debits, the second is credits, and the third is the running total. Only the running total may contain negative values.

For the balance report without --dc:

                 $70  Assets:Cash
                 $30  Expenses:Food
               $-100  Income:Employer
--------------------
                   0
And with --dc it becomes this:

          $105            $35            $70  Assets:Cash
           $40            $10            $30  Expenses:Food
             0           $100          $-100  Income:Employer
--------------------------------------------
          $145           $145              0

This shows debits as the left column; I think the accounting convention is credits on the left. So we'd have to choose ledger compatibility or accounting convention. The register and balance commands are the place to add this feature, I guess. Column headings would be helpful.

simonmichael avatar Nov 14 '20 17:11 simonmichael

I don't know for other countries, but, in France, the accounting convention is credits on the right.

legrostdg avatar Nov 14 '20 17:11 legrostdg

You're right, I misspoke. Credits on the right it is.

simonmichael avatar Nov 14 '20 19:11 simonmichael

One thing to consider, if implementing this feature in hledger, is to perhaps have the data in the following order for the register:

| Date | Code | Account | Description | Credit | Debit | Balance |

or (perhaps, even better):

| Date | Account 1   | Code | Credit |       |
|      | Account 2   | Code |        | Debit |
|      | Description |      |        |       |
|      |             |      | Total  | Total |

and for the trial balance:

| Account | Credit | Debit | Balance |

or (perhaps, even better):

| Account | Credit | Debit |
|         | Total  | Total | 

The second alternatives in both case would make the output resemble ledger and trial balance formats that seem common from an online web search.

the-solipsist avatar Jan 02 '21 17:01 the-solipsist

If https://github.com/simonmichael/hledger/issues/1155 is eventually implemented, this could become just a custom report, since the framework that would provide could potentially allow for columns with conditions like liabilities income equity amt:'<0' OR assets expenses amt:'>=0' for debits, and liabilities income equity amt:'>=0' OR assets expenses amt:'<0' for credits, or something with a different syntax. The core point being that if you can design your own reports, then using amt:'<0' and conditional statements to create debit/credit entries ought to be possible as well.

the-solipsist avatar Nov 22 '21 22:11 the-solipsist