Applying various income/expense accounts to different equity accounts?

61 views
Skip to first unread message

Phil! Gold

unread,
Oct 8, 2019, 11:28:59 AM10/8/19
to Beancount
I'm the treasurer for a very small nonprofit organization.  I'm looking at using beancount for my bookkeeping[0], but I'm not sure how to track some of our finances within beancount's assumptions about account structure.

The specific problem is that I have a few different funds I need to keep separate from each other.  We periodically have projects in collaboration with other organizations where the funding for those projects has to remain separate from our general funds.  I manage this in Ledger by having separate income and expense accounts for these projects.  So our transactions might look like this (in Ledger):

    2019-10-08 Donor A
        Assets:Cash:Bank Account 1    $50
        Income:Project 1:Donation    $-50
   
    2019-10-08 Project 2 Expense
        Expenses:Project 2:Catering  $300
        Assets:Cash:Bank Account 1  $-300
   
    2019-10-08 Member C
        Assets:Cash:Bank Account 1   $125
        Income:General:Annual Dues

When I close our books, the income and expense accounts get closed into different net asset (equity) accounts, depending on the funding stream.  The above transactions would result in the following balances:

    Net Assets:General = $-125
    Net Assets:Project 1 = $-50
    Net Assets:Project 2 = $300

beancount wants to put everything into a single account, though.  (If I understand things correctly, when running a report over a period of time, all income and expense transactions before the period start date are closed into Equity:Earnings:Previous by default, and income and expense transactions during the period are closed into Equity:Earnings:Current.)  Is there a way to define my own rules about which equity accounts receive the money from each income and expense account?

[0] I currently use Ledger, but I've been growing increasingly frustrated at the difficulty of programmatic access to transaction data.

Martin Blais

unread,
Oct 9, 2019, 10:24:19 PM10/9/19
to Beancount
There's no such rule system (I don't recall coming across it in Ledger
either, how does it work?), but what I'd recommend you do is write a
little script that creates the EOY transactions and insert those into
your file. I'll admit that the general idea for Beancount is for
itself to always automate those things on reporting, it would indeed
be nice if it were able to invoke your own custom transaction
insertion code to "close" a year automatically. There's nothing
built-in like that at the moment.




>
> [0] I currently use Ledger, but I've been growing increasingly frustrated at the difficulty of programmatic access to transaction data.
>
> --
> You received this message because you are subscribed to the Google Groups "Beancount" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to beancount+...@googlegroups.com.
> To view this discussion on the web visit https://groups.google.com/d/msgid/beancount/f15c9ed5-c29c-47b8-a466-b08318a4b5d6%40googlegroups.com.

Phil! Gold

unread,
Oct 10, 2019, 1:05:32 PM10/10/19
to Beancount
* Martin Blais <bl...@furius.ca> [2019-10-09 22:24 -0400]:
> On Tue, Oct 8, 2019 at 11:29 AM Phil! Gold <phi...@pobox.com> wrote:
> > The specific problem is that I have a few different funds I need to
> > keep separate from each other. We periodically have projects in
> > collaboration with other organizations where the funding for those
> > projects has to remain separate from our general funds. I manage this
> > in Ledger by having separate income and expense accounts for these
> > projects.
>
> There's no such rule system (I don't recall coming across it in Ledger
> either, how does it work?),

Well, for Ledger I wrote my own scripts that process the Income and
Expense accounts and sort them into appropriate Net Asset accounts. For
year-to-date reports, the sums just get printed in the reports, but at the
end of the year I write the sums into that year's journal file as new
Ledger transactions.

The net result is that I can use Ledger's built-in querying tools to get
either an income statement or a complete balance sheet for a fiscal year
by querying either the last day of the FY or the first day of the next FY,
respectively. For year-to-date stuff (which is almost always current
year-to-date), if I use the built-in querying tools I have to mentally
combine the income and expense accounts myself.

Since beancount has a richer query language, I'd hoped to be able to do
all of the income/expense -> net asset stuff dynamically without fixing
the account closing stuff at the end of the fiscal year. I guess that's
not possible.

> but what I'd recommend you do is write a little script that creates the
> EOY transactions and insert those into your file.

That's what I ended up doing. In case it's useful to anyone else, I'm
attaching it here. (But its rules--encoded in the get_account_target()
function--depend heavily on the particular account structure I've set up.)

--
...computer contrarian of the first order... / http://aperiodic.net/phil/
PGP: 026A27F2 print: D200 5BDB FC4B B24A 9248 9F7A 4322 2D22 026A 27F2
--- --
do {
:
} until (HELL_FREEZES_OVER);
---- --- --
clear_net_assets.py
Reply all
Reply to author
Forward
0 new messages