On Tue, Nov 9, 2010 at 6:57 AM, Roel Vanhout <[email protected]> wrote:
> 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.
>
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'

Reply via email to