Fwd: gnucash monthly report

Chris Shoemaker c.shoemaker at cox.net
Fri Mar 4 16:14:42 EST 2005


Hi Merlin,
        I'd like to understand this report a bit better.  I ask some
questions and make some comments inline:

On Wed, Mar 02, 2005 at 06:59:03PM -0500, merlin hughes wrote:
<snip>
> 
> Changes:
> 
> . I had to rearrange a lot of the code to do what I wanted,
>   so there are a bunch of utility defines at the start
>   and then everything is much more broken out. My style
>   may stink; I don't know scheme. It strikes me that the
>   reports could do with another common utility file that
>   contains the code that a lot of them duplicate.
> 
> . I changed the definition of incoming and outgoing money
>   (see below). I can undo this if necessary.
> 
> . The layout has had to change slightly to cope with
>   multi-period reports.
> 
> . New option 'Report Period' which lets you generate
>   weekly/monthly/quarterly/yearly reports, in addition to
>   the standard single report over the entire period.

This is nice.

> 
> . New option 'Sort Accounts By' which lets you sort
>   accounts by the monetary amount in addition to their name.

nice.

> 
> . New option 'List Accounts Selected' which allows you
>   to suppress the listing of accounts at the top.

very nice.

> 
> . New option 'Report Only Income and Expenses' which
>   toggles between strict cash flow and income vs expenses
>   (explained later).
> 
> . New tab 'Escrow Accounts', used only in income vs
>   expense mode (explained later).
> 
> . New tab 'Summary Accounts' which is a set of accounts
>   to summarize at the end of each period. Before and after
>   balance is listed, along with the % change and, for accounts
>   containing stocks and mutual funds, the % change discounting
>   contributions (e.g., so you can see how an underlying 401-K
>   is doing, ignoring contributions).

also nice.

> 
> . New report titled 'Monthly Cash Flow' which is a monthly
>   instance of the report.
> 
> In the old code, incoming and outgoing splits were (if I
> read the code right) identified as (excuse the pseudocode):
> 
>   foreach split S
>     if S.account in accounts
>       foreach split S' in S.transaction.splits
>         if not S'.account in accounts
>           if S'.value < 0
>             incoming-split-p S'
>           else
>             outgoing-split-p S'
> 
> The problem with this is that I have:
>   Transaction[payroll]
>     Split[gross salary]: income: $12.00
>     Split[checking]: charge: $9.00
>     Split[fed tax]: charge: $2.00
>     Split[state tax]: charge: $1.00
> 
> Under the old logic this gets reported as incoming: 12,
> outgoing: 1+2. The tax splits (which never touch a selected
> account) get listed as cash flow, which doesn't seem right
> to me.. Although I admit I have no idea of any formal meaning
> of cash flow.

In the above example, I assume "checking" is an asset account (the
only asset account in the transaction) and your cash-flow report is
w.r.t only asset accounts (including "checking").  If that's the case,
then I don't see the problem with the given output.  You have $12
incoming and $3 outgoing for a net income of $9.


> 
> To fit this into my logic, I changed the algorithm to:
> 
>   foreach split S
>     if S.account in accounts and not S.corr-account in accounts
>       if S.value > 0
>         incoming-split-p S
>       else if S.value < 0
>         outgoing-split-p S
> 
> My transaction above is now just reported as incoming: 9.

I'm not sure what is meant by S.corr-account.  Splits only have one
Account, and Transactions can have Splits for more than only two
Accounts, so... ?

[I look at the code a bit...]

Ok, I think I see what S.corr-account means, but I don't think this
algorithm is correct.  It's not right to ignore n:m transactions.

Wouldn't the original cash-flow report have reported "9" as the
"difference" between "money in" and "money out"?

> 
> If this is horribly broken, I can try and resurrect the
> original algorithm.
> 
> The alternative income vs expense mode uses the following
> algorithm:
> 
>   foreach split S
>     if S.account in accounts and S.corr-account.type = 'income
>       incoming-split-p S
>     if S.account.type = 'expense and S.corr-account in accounts
>       outgoing-split-p S
> 
> This algorithm ignores balance transfers among accounts,
> and if you include your credit cards among the accounts, it
> correctly categorizes how you spend your money, whether from
> cash, checking account or credit cards, so you can accurately
> see how much you spend on wine, women, song, how much goes on
> credit card interest, etc. The distinction is somewhat subtle,
> I just find that i vs e gives a better representation of what
> an individual is spending day to day.

"ignores transfers among account"?  Aren't all transactions transfers
between accounts.  It seems that perhaps what you mean is that it
ignores transfers between accounts, except when one of those accounts
is an income or an expense account.  For example, if you run a
cash-flow report on your savings account (asset) you will see your
payroll deposit (income:salary) but not the check you wrote and
deposited to yourself (from asset:checking).  IOW, you're not
reporting cash-flow -- you're reporting income and expenses.  However,
if you run a cash-flow report on all your asset accounts, doesn't that
show what you want?

> 
> The escrow account handling is then added on top of the
> income vs expense mode; this is useful for TransitChecks,
> Flex Spending Accounts, Property Tax Escrow, etc: The report
> considers income payments into escrow accounts as expenses, and
> it ignores payments from these accounts. Thus, escrow payments
> that are paid in regularly and withdrawn from sporadically look
> like regular expenses which is easier to mentally reconcile.
> For example, every month part of my mortgage payment is placed
> in a property tax escrow account. Every quarter property tax
> is paid out of this account. I'm kinda pedantic so I have
> this account split out as an asset of mine, with monthly
> transfers into it and quarterly expenses out of it. Ditto,
> my FSA gets fed into monthly but I only get doctor bills
> occasionally. Similarly, TransitCheck payments are made
> monthly, but I only get and spend the cheques in bulk every
> few months. In this report, I see regular monthly expenses
> rather than sporadic large expenses.

Your escrow accounts are asset accounts, right?  If so, then a
cash-flow report including escrow accounts will show payments to escrow
accounts as "incoming" (regular) and payments from the escrow accounts as
"outgoing" (sporadic).

If you want to only consider the regular transactions (like monthly
property tax escrow deposit), then exclude those escrow accounts from
the cash-flow report.  Then, regular deposits to escrow accounts will
reported as "outgoing" (This is correct, even though they are
"income".)  And payments from escrow accounts won't show up at all,
since they won't touch the accounts on which the report is run.

I haven't followed your code completely, but I ran your report, and I
haven't figured out what the benefit is to treating escrow accounts
specially.  Can you elaborate?

>From my initial look, it seems like you've made some real enhancements
to the cash-flow report.  But I question the usefulness of the
re-definition of cash-flow.  And I can't see the benefit of a special
treatment for "escrow" and "salary" accounts.  It seems like
particular account selections in the original formulation would report
what you want.  But if not, then I don't think you want "cash-flow".
In that case, perhaps this should become a new report by itself.

-chris



More information about the gnucash-devel mailing list