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


On Mon, Nov 8, 2010 at 11:49 PM, Peter Ross <[email protected]> wrote:
> 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