[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Invoice Calculation Weirdness in 1.21

Corrections and update below:

On Wed, 13 Jul 2011, Luke wrote:

I am running LSMB 1.21 for this installation.

I have an invoice with a line item as follows:

Qty: 11
Price: 12.90
Disc: 25%
Total: 106.48

Now, that total is wrong.  It should be, assuming banker's rounding,

I.E. rounding the discount of 3.225 up to 3.23 off of each 12.90 (9.67).

However, it is consistent with the way LSMB usually does discount

Which is to ignore decimal places which the price doesn't include. So 25% of 12.90 is 3.22 off (9.68).

It did the same thing with another line item.

Okay, so I know why that is happening, and how to deal with it.

Here's the weird bit.

On the printed version of the invoice, it appears to be doing the correct
precision three math, and is coming to the correct result.

No, actually. It is doing the correct banker's rounding. The correct precision three math, is to get to a final price of 106.425, and then round that to 106.43. I can get the on screen invoice to do that by making the price 12.900.

However when I do so, the printed invoice still gives 106.37 for that line item, which is the problem in all this.

The customer pre-paid based upon my review of the total on screen, which
was 152.26.  The total on the page, however, is 152.05.
I didn't look at the line item totals and manually calculate them, until
after I hung up from taking the payment.

Since the customer prepaid, the printed version of the invoice now shows a
balance due, of -0.21.

My question is: why is this happening differently on the two versions of
the invoice?  The on screen version, while not the correct method of
handling the math, is the way the program usually does it.  The printed
version, while preferable to the customer, and the correct 3-precision
handling, is abnormal.

Correct rounding, not correct precision.

Can this be reproduced, or is it local to my installation?