balance sheet & profit and loss statement

704 views
Skip to first unread message

Roel Vanhout

unread,
Nov 8, 2010, 2:57:38 PM11/8/10
to ledge...@googlegroups.com
Hi,

Is there a way to make ledger produce a balance sheet and profit and
loss statement? Anyone made a script to do that? I guess it would
require a script because you'd need a way to distinguish between
balance & p&l entries in the ledger. Thanks.

cheers,

roel

Peter Ross

unread,
Nov 8, 2010, 5:49:08 PM11/8/10
to ledger-cli
This is the script that I use for my company to give a P&L and balance
sheet to give to the accountants. It works on the australian
financial year, and converts all of my outstanding currency
transactions into AUD by using currency trading accounts (see
https://github.com/jwiegley/ledger/wiki/Multiple-currencies)

#!/bin/sh

if [ $# != 1 ]; then
echo $0 '<year>'
echo Please specify the year
exit 1
fi

YEAR=$1
SHORT_YEAR=`expr $YEAR - 2000`
PREVIOUS_YEAR=`expr $YEAR - 1`

CURRENCY="-X AUD"

LEDGER=ledger
DATA=mcoz.dat
echo Balance sheet as of $PREVIOUS_YEAR/06/30
$LEDGER -f $DATA $CURRENCY -e $PREVIOUS_YEAR/07/01 bal '^assets'
'^liabilities' '^equity'

echo
echo Income for $PREVIOUS_YEAR/$SHORT_YEAR financial year
$LEDGER -f $DATA $CURRENCY -b $PREVIOUS_YEAR/07/01 -e $YEAR/07/01 bal
'^income' '^expenses' '^currency'

echo
echo Balance sheet as of $YEAR/06/30
$LEDGER -f $DATA $CURRENCY -e $YEAR/07/01 bal '^assets' '^liabilities' '^equity'

Roel Vanhout

unread,
Nov 9, 2010, 11:22:57 AM11/9/10
to ledge...@googlegroups.com
Ah yes this is a good approximation, I was too focused on details like
formatting, ordering etc. which lead me to believe I needed a complete
new program to format these accounts. But I think that with something
like this, judicious account naming and maybe some xml output and
transformations into xsl:fo I can fully automate a complete set of
financial statements. Thanks.

cheers,

roel

Reply all
Reply to author
Forward
0 new messages