Lots in Account screen : Value sign

Linas Vepstas linasvepstas at gmail.com
Thu Aug 25 00:12:54 EDT 2016


Wow... you're asking me to remember something from 12 years ago ...

Here's my best guess: for a "lot", I had the mental model of starting with
100 of something ... e.g. 100 cans of paint, and then selling them off in
dribs and drabs. Thus, the first entry, that opens the lot, has a sign that
differs from all the others.  By definition, there can be only one such
entry in the lot, -- by definition, all of the other entries must have the
opposite sign. Lots can only shrink and get smaller.

So -- I buy 100 cans of paint at $10 per can, then sell 20 at $15 a can,
then sell 35 at $17 a can, then sell 45 at $12 a can, closing out the lot
(forever, since all the paint in that lot is now gone).

Lots could be shares of stock, could be cans of paint, cartons of milk
marked by expiration date -- anything that is naturally counted in
non-monetary units, and come in lots (i.e. you want to sell/use/drink the
oldest milk first, so you really do want to track the date/lot-number).
More abstractly, lots could be shipments to a customer, unfilled or
partially filed orders, whatever --

With this concept of a lot, its impossible to add more to the lot -- once
opened, it can only be depleted.  Thus, the split that opens the lot is
"special". By assumption, its the very first split; it doesn't really make
sense for it to be any other. That is, I can't sell cans of paint that I
don't yet have.  At least, that was the initial conception of how lots work.

Now, we all have read the news about corporations that sell things before
the customer takes delivery, leading to various accounting scandals. I
suppose there are other legitimate uses of lots, which somehow get
overdrawn before they are stocked up.  Or something.  But that got
confusing to think about, and was not a part of the design.

I'm not at all clear as to why payments or invoices are going through the
lot system, other than maybe you bill someone $100 and they pay you in
installments?  Ans so you want to match up the installments with the
original invoice, until its paid off?  I guess that's a valid use of
lots... If the sign is wrong for that special, first entry, then that's the
fault of whomever opened that lot.

--linas



On Wed, Aug 24, 2016 at 11:07 AM, Frank H. Ellenberger <
frank.h.ellenberger at gmail.com> wrote:

> Hi Linas,
>
> do you remember the reason?
>
> Regards
> Frank
>
> -------- Weitergeleitete Nachricht --------
> Betreff: Re: Lots in Account screen : Value sign
> Datum: Tue, 23 Aug 2016 17:51:30 +0200
> Von: Geert Janssens <geert.gnucash at kobaltwit.be>
> Organisation: Kobalt W.I.T.
> An: gnucash-devel at gnucash.org
>
> On Thursday 18 August 2016 10:31:54 Chris Good wrote:
> > Hi,
> >
> >
> >
> > I'm documenting using lots to calculate investments capital gains.
> >
> >
> >
> > Please see the attached screenshot.
> >
> >
> >
> > The sign of the Value in the 'Splits free' panel seems inconsistent.
> >
> > Why is the sign of the initial acquisition +ve, but -ve for the
> > following 2 reinvested dividends?
> >
> > The program contains the following:
> >
> > gnucash/src/gnome/dialog-lot-viewer.c line 523:
> >
> >
> >
> >         /* Value. Invert the sign on the first, opening entry. */
> >
> >         currency = xaccTransGetCurrency (trans);
> >
> >         valu = xaccSplitGetValue (split);
> >
> >         if (node != split_list)
> >
> >         {
> >
> >             valu = gnc_numeric_neg (valu);
> >
> >         }
> >
> >
> >
> > I'd like to explain why this is done?
> >
> > Perhaps something to do with the Business scrubbing?
> >
> >
> >
> > Regards,
> >
> > Chris Good
>
> Hi Chris,
>
> I can only speak about the business features. I have 0 experience with
> investments capital gains.
>
> From that business perspective, I believe you have found a bug in the
> code. It seemed to have slipped by when I merged a patch in 2011 which
> introduces the pane with unassigned splits.
>
> The code that inverts the first split was originally introduced by Linas
> in 2003 (in commit https://github.com/Gnucash/gnucash/commit/1a997993 )
> for the other pane, the one displaying the splits *in* a selected lot. I
> don't know why he introduced this behavior. There is no additional
> explanation with the commit.
>
> It was later reused for displaying splits in the free splits pane.
> However I don't think it makes sense there to revert the first free
> split. That's just some arbitrary split. So I believe that's wrong.
>
> And to be honest, I don't understand the motivation either to revert the
> sign on the first split in the lots either. For the current (business)
> code the result is rather arbitrary. Sometimes the first split is a
> payment, sometimes it's an invoice. Whichever is first gets its value
> reversed. So sometimes all values are negative, sometimes they're all
> positive. And the amounts alter negative/positive to properly balance
> the lot.
>
> So from a business perspective, this implementation doesn't make sense
> at all. I don't know whether it does for capital gains in lots. Perhaps
> someone else knows ?
>
> Geert
> _______________________________________________
> gnucash-devel mailing list
> gnucash-devel at gnucash.org
> https://lists.gnucash.org/mailman/listinfo/gnucash-devel
>


More information about the gnucash-devel mailing list