splitting account (with child account) balances
Michael McKay
michael.mckay at sympatico.ca
Wed Jun 3 23:58:06 EDT 2009
The income statement (income-statement.scm) summarizes accounts and
calculates the net income.
The calculations look like this:
;; sum revenues and expenses
(set! revenue-closing
(gnc:account-get-trans-type-balance-interval
revenue-accounts closing-pattern
start-date-tp end-date-tp)
) ;; this is norm positive (debit)
(set! expense-closing
(gnc:account-get-trans-type-balance-interval
expense-accounts closing-pattern
start-date-tp end-date-tp)
) ;; this is norm negative (credit)
(set! expense-total
(gnc:accountlist-get-comm-balance-interval
expense-accounts
start-date-tp end-date-tp))
(expense-total 'minusmerge expense-closing #f)
(set! neg-revenue-total
(gnc:accountlist-get-comm-balance-interval
revenue-accounts
start-date-tp end-date-tp))
(neg-revenue-total 'minusmerge revenue-closing #f)
(set! revenue-total (gnc:make-commodity-collector))
(revenue-total 'minusmerge neg-revenue-total #f)
;; calculate net income
(set! net-income (gnc:make-commodity-collector))
(net-income 'merge revenue-total #f)
(net-income 'minusmerge expense-total #f)
I'm not sure what the divide by 2 function is but this snippet shows how to
take a set of user-defined accounts and perform some math on them.
The revenue_accounts and expense_accounts are defined by the user in the
reports options. You could set up several options with a mix of account
types for the various accounts you need to define.
Yours,
Michael McKay
MJM Consulting
613.724.8169
-----Original Message-----
From: gnucash-user-bounces at gnucash.org
[mailto:gnucash-user-bounces at gnucash.org] On Behalf Of chris
Sent: June-03-09 10:39 PM
To: Derek Atkins
Cc: gnucash-user at gnucash.org
Subject: Re: splitting account (with child account) balances
--- On Wed, 6/3/09, Derek Atkins <warlord at MIT.EDU> wrote:
> ruppie30 at yahoo.com
> writes:
>
> > hi,
> >
> > i am a long time gnucash user. i would like to take
> a few specific accounts and split the balance of them
> (simple divide by 2 and round up to the nearest penny).
> then i'd like to add and/or subtract other account balances
> and see the result. for all of the accounts are parents
> with child accounts, i need to perform the above math on the
> parent + all child accounts.
> >
> > is this best done in a report? can it be done any
> other way inside gnucash?
>
> Yes, this would best be done in a report.
> There's no other way I can think of to do it inside
> gnucash.
>
> > thanks,
> > chris
>
> > Please remember to CC this list on all your replies.
> > You can do this by using Reply-To-List or Reply-All.
>
> -derek
are there any simple examples of a report that collects account balances? i
have had a quick look at some of the reports included with gnucash but they
are rather large and not easy for me to understand. i would be happy with a
report that has hard coded accounts as opposed to allowing a user to select
accounts.
any help is greatly appreciated!
thanks,
chris
_______________________________________________
gnucash-user mailing list
gnucash-user at gnucash.org
https://lists.gnucash.org/mailman/listinfo/gnucash-user
-----
Please remember to CC this list on all your replies.
You can do this by using Reply-To-List or Reply-All.
More information about the gnucash-user
mailing list