simonmichael / hledger

Robust, fast, intuitive plain text accounting tool with CLI, TUI and web interfaces.
https://hledger.org
GNU General Public License v3.0
2.91k stars 315 forks source link

report debits and credits separately #71

Open simonmichael opened 11 years ago

simonmichael commented 11 years ago

Original author: simon@joyful.com (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

--- Want to back this issue? **[Post a bounty on it!](https://www.bountysource.com/issues/5973301-report-debits-and-credits-separately?utm_campaign=plugin&utm_content=tracker%2F536505&utm_medium=issues&utm_source=github)** We accept bounties via [Bountysource](https://www.bountysource.com/?utm_campaign=plugin&utm_content=tracker%2F536505&utm_medium=issues&utm_source=github).
blais commented 11 years ago

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.

legrostdg commented 6 years ago

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.

simonmichael commented 5 years ago

See ledger's --dc flag.

entropitor commented 4 years ago

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

simonmichael commented 4 years ago

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 commented 3 years ago

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.

legrostdg commented 3 years ago

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

simonmichael commented 3 years ago

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

the-solipsist commented 3 years ago

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 commented 2 years ago

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.

devbanana commented 3 months ago

I'd like to bump this up and add my vote for this feature. I'm taking a financial accounting class and having to prepare trial balances, which requires getting the totals for debits and credits.

I tried the amt:>0 and amt:<0 filter but that didn't work, because it filtered the actual transactions. I need to just get a list of accounts with a debit balance and accounts with a credit balance, and the totals of each.

simonmichael commented 3 months ago

I tried the amt:>0 and amt:<0 filter but that didn't work, because it filtered the actual transactions. I need to just get a list of accounts with a debit balance and accounts with a credit balance, and the totals of each.

Hi Brandon,

"list of accounts with a debit balance and accounts with a credit balance" sounds different from "list of debits and list of credits". Wouldn't the former be (assuming no contrabalances) just a list of your assets and a list of your liabilities.

devbanana commented 3 months ago

Hi Brandon, "list of accounts with a debit balance and accounts with a credit balance" sounds different from "list of debits and list of credits". Wouldn't the former be (assuming no contrabalances) just a list of your assets and a list of your liabilities.

No it's not just assets and liabilities. A trial balance is a listing of all accounts in the chart of accounts, including revenue and expense accounts, where you verify the total of debit balances and the total of credit balances are equal (reference).