Yet Another Balance Sheet and Profit/Loss Statement Question

686 views
Skip to first unread message

Rick F

unread,
Mar 20, 2014, 2:52:19 PM3/20/14
to ledge...@googlegroups.com
Well, now that I'm dealing with a real accountant to get my taxes done, I have to produce these accounting reports.  How to produce these reports has been covered already on this list, but to summarize (assuming you have the standard five accounting categories):

Profit and Loss: ledger bal '/^Revenues|^Expenses/'
Balance sheet: ledger bal '!/^Revenues|^Expenses/'

Here's where having a real accountant comes in.  The above produces a balance sheet that doesn't balance.  He expects there to be an Equity:Retained Earnings account where this year's profits end up in order to make the whole thing balance.  I tried adding an entry:

12/31  Year End
    Revenues =$0
    Expenses =$0
    Equity:Retained Earnings

But that fails if Revenues and Expenses have subcategories, and frankly they're not useful if they don't.  Even if I get rid of subcategories just to force this, it balances the balance sheet, but it also balances the P&L, making it look like I made no money last year.

How do others get this to work?

Martin Blais

unread,
Mar 21, 2014, 8:49:56 AM3/21/14
to ledger-cli
In the Beancount implementation, what I call "previous earnings" (the sum total of all income and expense accounts from the beginning of time to the START of the reporting period) are moved from income/expense accounts by automatically-created transactions to an Equity:Earnings:Previous account, and retained earnings / net income (the sum total of all income and expense accounts from the start of the reporting period to the end of the reporting period) are moved - for the balance sheet only - by automatically-created transactions to an Equity:Earnings:Current account.

For currency conversions, in order to ensure a 0 balance, there are Equity:Conversions:Previous and Equity:Conversions:Currenty accounts which reestablish per-currency balances.

You can click on trial balance  - the sum of all accounts in the ledger - and the sum is 0.

Paul Lathrop

unread,
Mar 21, 2014, 3:18:27 PM3/21/14
to ledge...@googlegroups.com
This is exactly what I use closing entries for. So I do:

ledger equity Expenses

I copy the output into my ledger file, change the signs, and change the balancing account to "Income Summary." Next:

(I call "Revenues" "Income")
ledger equity Income

Same exact process for that one. Finally, I add an entry like:

12/31 Year End
  Income Summary =$0
  Equity:Retained Earnings

That balances it all out.


--

---
You received this message because you are subscribed to the Google Groups "Ledger" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ledger-cli+...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Harshad RJ

unread,
Mar 22, 2014, 12:07:57 AM3/22/14
to ledger-cli
In abandon, I want to make this automated and configurable.

Here is my idea:
https://github.com/hrj/abandon/issues/11

The reason I want to implement this as part of the 'equity' report is the option to "split the closure" as explained in the link.

Splitting the closure as a separate transaction helps when I generate the final  report in PDF format. (I have developed a tool for generating these reports. Will be open-sourcing it soon after sanitizing the code.)


--

Antonio Martinez

unread,
Apr 6, 2014, 12:18:46 PM4/6/14
to ledge...@googlegroups.com
I'm new to ledger and have thought on this same problem. I wrote a dirty shell script to invert the ledger equity report: https://gist.github.com/amarjen/10008046 

#!bin/bash
# Arguments: $1 --> Ledger source file
# $2 --> Year Period, eg '2013'
#
# Example: bash ledger_close_year.sh mybooks.ledger 2013
 
# Equity report from ledger
ledger -f $1 equity ^Income ^Expenses -p $2 > pl.tmp
 
# Invert equity report
cat pl.tmp | awk 'NR==1 {print '"$2"' "/12/31 Year End Closing Entry"} NR>1 {$1=" "$1; $(NF-1)=" "$(NF-1);$NF=$NF*-1; print}' > closed.tmp
 
# Change the account name
sed -i 's/Opening Balances/Retained Earnings/' closed.tmp
 
# Concatenate output with books in a new file
cat $1 closed.tmp > $1.closed
 
# Clean temporal files
rm pl.tmp closed.tmp

Rick F

unread,
Apr 7, 2014, 2:19:06 PM4/7/14
to ledge...@googlegroups.com
The script looks good.  Would it make sense to add assertions for every account so closed that the balance is now zero?

Also, for the ledger experts, does the equity report "Opening Balances" account adequately replace the prior years' operations?  So for example, if you bought an equity last year on April 1 for $100, and just used the equity report to open this year's account, would that information be preserved if you sold the stock this year?
Reply all
Reply to author
Forward
0 new messages