Andreas,

Andreas Köhler <[EMAIL PROTECTED]> writes:

> Derek, in the currently active code we walk through the splits from the
> head of the list, searching for the first split (A) with a posted date
>>= the given one, and then return the balance of the split preceding A.
> In the book closing code you used cacb->cbw->close_date+1, so I wonder
> whether you worked around a bug or I fundamentally misunderstand
> something here.

The +1 was there for a reason, to make sure that it included previous
instances of the book closing transaction.  This is because the
AsOfDate uses <, not <=, so when the closing transaction is
posted at time T, if you run it again on the same date (which will
give you the same T) it didn't see the existing transaction,
so you'd get a second one.

So, for example, if on Dec 31 you had a balance in an account of $100
and you close it then, the closing transaction would put -$100 to get
a balance of zero.  If you ran the book closing again, you'd get a SECOND
transaction of -$100.  The "+1" worked around this problem.

-derek

-- 
       Derek Atkins, SB '93 MIT EE, SM '95 MIT Media Laboratory
       Member, MIT Student Information Processing Board  (SIPB)
       URL: http://web.mit.edu/warlord/    PP-ASEL-IA     N1NWH
       [EMAIL PROTECTED]                        PGP key available
_______________________________________________
gnucash-devel mailing list
gnucash-devel@gnucash.org
https://lists.gnucash.org/mailman/listinfo/gnucash-devel

Reply via email to