AW: Closing books: reference date
Mike Alexander
mta at umich.edu
Mon Jan 11 22:35:56 EST 2010
--On January 11, 2010 8:11:04 PM +0100 Jannick Asmus
<jannick.news at gmail.com> wrote:
> Derek Atkins wrote:
>
>>> It seems to me that the reference date for picking txns in the
>>> closing
>>> book module is "date-entered". I suspect it should be "date-posted"
>>> to
>>> have revenues and expenses appropriately attributed to the closed
>>> period.
>>>
>>> Working with GC 2.2.9 on Win Vista.
>>
>> Um, the code in question just calls xaccAccountGetBalanceAsOfDate()
>> which should use the Post date of the transactions. In other words,
>> it shouldn't matter *when* you enter a transaction, but rather
>> whatever
>> date you put into the register.
>
> This concerns manual inputs only. GnuCash does not behave like this
> with HBCI txns.
>
>> And indeed, looking at the code it DOES use DatePosted, so it's
>> behaving
>> correctly.
>
> Actually I cannot follow you here. Please see the following HBCI
> transaction which is EXCLUDED from the book closing as at 31.12.2009:
>
> <gnc:transaction version="2.0.0">
> <trn:id type="guid">2cc57ec0384495a6f2626aebf844728c</trn:id>
> <trn:currency>
> <cmdty:space>ISO4217</cmdty:space>
> <cmdty:id>EUR</cmdty:id>
> </trn:currency>
> <trn:date-posted>
> <ts:date>2009-12-31 13:00:00 +0100</ts:date>
> </trn:date-posted>
> <trn:date-entered>
> <ts:date>2010-01-08 23:51:11 +0100</ts:date>
> </trn:date-entered>
> [snip]
> </gnc:transaction>
>
> I think what is happening here is a transaction is entered (via HBCI)
> at t1 with value date t0 BEFORE t1. And this is not just an acedamic
> situation.
I think you're both right. It's using the time posted as Derek says,
but this transaction is excluded because it's posted time is after noon
on December 31. The code in dialog-close-book.c adjusts the closing
date to noon on the date given:
cbw->close_date =
gnc_date_edit_get_date(GNC_DATE_EDIT(cbw->close_date_widget));
cbw->close_date += (3600 * 12); /* Add 12 hours to the timestamp */
It would seem better to set it to the last second on that day by adding
3600*24-1.
Mike
More information about the gnucash-devel
mailing list