debit and credit accounts

111 views
Skip to first unread message

Christopher

unread,
Oct 7, 2008, 12:24:11 PM10/7/08
to Ledger
Is there a way to let ledger output its reports showing the accounts
in the
more conventional way as debit and credit accounts, instead of having
a positive or negative saldo?

The reason I am asking is that I have to do the accounting for a small
non-profit organization and the people here expect to see the reports
in
that way.

Thank you for this very nice program!

Christopher

John Wiegley

unread,
Oct 7, 2008, 6:24:24 PM10/7/08
to ledge...@googlegroups.com
On Oct 7, 2008, at 12:24 PM, Christopher wrote:

> Is there a way to let ledger output its reports showing the accounts
> in the
> more conventional way as debit and credit accounts, instead of having
> a positive or negative saldo?
>
> The reason I am asking is that I have to do the accounting for a small
> non-profit organization and the people here expect to see the reports
> in
> that way.

Can you show me an example of what that kind of report would look like?

John

Mike Bishop

unread,
Oct 7, 2008, 8:22:15 PM10/7/08
to ledge...@googlegroups.com

I too, do all the reporting for a small non profit. I end up
processing ledger selections (custom format) through a simple
flip-sign script prior to report formatting. Perhaps you could
adapt the bash script below for your own use.

Note that it's probably that one of ledgers output options
could multiply by negative 1, but I find flip-sign to be a
little more usefull.

==================================================================
#!/bin/bash
# flip-sign: generic sign flipper/paren adder for w1 style reports
# Account string specific though

reverse() {
# reverse negative signs (cannot do math with commas and periods)
value=-$value # add a minus
value=${value/--/} # replace a *double* minus with nothing (eg: a +)
}

paren() {
# if first char neg sign, sub open_paren for neg_sign, append close_paren
[[ ${value:0:1} = '-' ]] && value=${value/#-/(}')'
}

IFS="|"
while read account type value
do
# strip leading blank
value=${value## } # strip leading blank

# change sign of Income and Liability amounts
[[ ${account%%:*} = Income ]] && reverse && paren
[[ ${account%%:*} = Expense ]] && paren
[[ $account = 'Total Income' ]] && reverse && paren
[[ $account = 'Profit/(Loss)' ]] && reverse && paren
[[ $account = Liability* ]] && paren
[[ $account = 'Change' ]] && paren
[[ $account = 'Bank:Change' ]] && paren

echo $account"|"$type"|"$value

done
# end
==================================================================

You can see part of one report under "Ways & Means" at
http://www.waco-ak.org.

Rgds,
--
Mike Bishop
Willow, Alaska

John Wiegley

unread,
Oct 7, 2008, 6:24:24 PM10/7/08
to ledge...@googlegroups.com
On Oct 7, 2008, at 12:24 PM, Christopher wrote:

> Is there a way to let ledger output its reports showing the accounts
> in the
> more conventional way as debit and credit accounts, instead of having
> a positive or negative saldo?
>
> The reason I am asking is that I have to do the accounting for a small
> non-profit organization and the people here expect to see the reports
> in
> that way.

Can you show me an example of what that kind of report would look like?

John

John Wiegley

unread,
Oct 7, 2008, 9:13:19 PM10/7/08
to ledge...@googlegroups.com
On Oct 7, 2008, at 8:22 PM, Mike Bishop wrote:

> Note that it's probably that one of ledgers output options
> could multiply by negative 1, but I find flip-sign to be a
> little more usefull.

For a balance report, the figure displayed is controlled by the -T
option. If you want negative totals, for example, you would use "-T -
O".

Although 2.6.1 cannot display negative values surrounded by
parentheses, it will be possible in 3.0 using a construction like this:

--format '%20(total_expr < 0 ? "(" + -total_expr + ")" :
total_expr) %(depth_spacer)%-(partial_account)\n'

This modifies the regular balance report to display negative totals in
parentheses, rather than as negative numbers.

The options are basically unlimited. Plus, with the upcoming tight
Python integration support, you can just write your balance reporting
code in Python, or export it to a script via csv or xml.

John

Christopher

unread,
Oct 8, 2008, 2:58:53 AM10/8/08
to Ledger
On Oct 8, 12:24 am, John Wiegley <jo...@newartisans.com> wrote:
> On Oct 7, 2008, at 12:24 PM, Christopher wrote:
>
> > Is there a way to let ledger output its reports showing the accounts
> > in the
> > more conventional way as debit and credit accounts, instead of having
> > a positive or negative saldo?
[...]
> Can you show me an example of what that kind of report would look like?

Here is one example:

Assets:Bank
Tr.# date Text debit credit saldo
1 2008-01-01 Mr. Sponsor 500 500
2 2008-01-02 Bill 100 400

Income:Donations
Tr.# date Text debit credit saldo
1 2008-01-01 Mr. Sponsor 500 -500

Expenses:Electricity
Tr.# date Text debit credit saldo
2 2008-01-02 Bill 100 100

There should be a way of distinguishing between debit accounts, as
assets and expenses,
and credit accounts, as Income and liabilities. It is of course
possible to processs
ledger's output to achieve this, but it would be nice if it could be
done in
ledger directly.

A second point: We need to keep the documents for all the transactions
and the entries
in the ledger should refer back to them. This is done by numbering all
the transactions,
here called Tr.#. Is this was the (CODE) entry is to be used for?

Last question: Living in Sweden and having special characters, how is
it with UTF-8
support? I saw a small note about it on your webpage that it is not
quite there yet.

Christopher

John Wiegley

unread,
Oct 9, 2008, 1:04:50 AM10/9/08
to ledge...@googlegroups.com
On Oct 8, 2008, at 12:58 AM, Christopher wrote:

> Here is one example:

This kind of report will make an excellent example script to
demonstrate the Python extensibility.

> A second point: We need to keep the documents for all the transactions
> and the entries
> in the ledger should refer back to them. This is done by numbering all
> the transactions,
> here called Tr.#. Is this was the (CODE) entry is to be used for?

It's what I use CODE for, yes. We're also going to be supporting
metadata in 3.0.

> Last question: Living in Sweden and having special characters, how is
> it with UTF-8
> support? I saw a small note about it on your webpage that it is not
> quite there yet.

There is an "icu" branch which aims at full Unicode support, but it's
just beginning and does not function yet. There are many
considerations involved.

John

Christopher

unread,
Oct 9, 2008, 3:06:55 AM10/9/08
to Ledger


On Oct 8, 2:22 am, Mike Bishop <mbis...@mtaonline.net> wrote:
> On Tue, Oct 07, 2008 at 09:24:11AM -0700, Christopher wrote:
>
> > Is there a way to let ledger output its reports showing the accounts
> > in the
> > more conventional way as debit and credit accounts, instead of having
> > a positive or negative saldo?
> I too, do all the reporting for a small non profit. I end up
> processing ledger selections (custom format) through a simple
> flip-sign script prior to report formatting. Perhaps you could
> adapt the bash script below for your own use.
> Willow, Alask

Thanks, it is a good idea to do some processing of ledger output.
I will use the same approach for now to create the reports.

Christopher

Christopher

unread,
Oct 9, 2008, 3:10:11 AM10/9/08
to Ledger
Thanks! It is good to see the direction ledger is taking.

Christopher


On Oct 9, 7:04 am, John Wiegley <jo...@newartisans.com> wrote:
> This kind of report will make an excellent example script to
> demonstrate the Python extensibility.
[...]
Reply all
Reply to author
Forward
0 new messages