Invoice addition problem

We encountered a problem with the addition in an invoice. It looks like it's adding up $20 and $30, and getting $111.25. Tony mentioned that this had been seen before, but is difficult to trace. I just wanted to log this instance of it.

I've attached a screenshot of the database as well. The transaction (invoice) number is 25578 (as printed on the invoice).

Cheers, Paul

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.

Re: Invoice addition problem

Some questions:

1. What version of OpenVPMS are you running?

2. Were there previously items or amounts/rates in the invoice so that the total added up $111.25?

3. Are there error messages in openvpms-full.log at the time when the invoice was edited?

-Tim

Re: Invoice addition problem

Hi Tim,

  1. Running 1.5 beta 2
  2. Actually... it took some elementary school math skills to figure out, but it looks like there is a numerical basis for the number 111.25. I've attached the reconciliation report to see just the numbers. Recall that the number on 10/27 is not correct however... it should be $70. It looks like 111.25 = 289.25 - 24 - 36.45 - 11.1 - 36.45 - 70... but I had to write a program to figure it out. :) No idea why it's skipping over the 54 there...
  3. I don't see anything suspicious in the log... 

Cheers, Paul

AttachmentSize
reconciliation.png 102.67 KB

Re: Invoice addition problem

I have more information about this after digging a little. It looks like the system thought (incorrectly) that the customer had a balance of $41.25. The present invoice was for $70. Looking at the code for the invoice generation, it looks like it will add the outstanding balance to the running balance when calculating the total.

 

    /**
     * Invoked when a child act is created. This sets the total to the:
     * <ul>
     * <li>outstanding balance +/- the running total, if there is no expected
     * amount; or</li>
     * <li>expected amount - the running total</li>
     * </ul>
     *
     * @param act the act
     */
 
It seems a little strange to me that totalling an invoice would respect a running total.
 
After rebooting the system (restarting Tomcat), I notice that where it said the customer balance yesterday was $0, it now registers -$41.25 (=111.25-70 above). I had created a manual debit to adjust for the wierdness... and it's not taking after a reset. So, there may be some dependency on the state of the system/cache? ...
 
My memory's not perfect on this, but I think one of the past transaction amounts was correct ... making it look like there was a running total. If I recall correctly, one of the payments was too high.
 
Thanks, Paul

Re: Invoice addition problem

The code you reference above is actually for payments.

When you create a new payment item, its total defaults to that of the customer's balance minus the amounts of any other payment items.

Can you take a backup of the database and click the 'Check' button Customers -> Accounts workspace and report what it says?

I'd like to take a look at the backed up database if possible. I can develop some SQL to anonymize the data to avoid privacy concerns. Send a mail to tma at netspace dot net dot au and I'll get back to you.

Thanks,

Tim

Re: Invoice addition problem

Hi Tim,

Thanks. I clicked the check button, and it reported "Customer Account Balance OK". I'll send the database to that address in another email. 

Cheers,

Paul

Re: Invoice addition problem

I've had a minor epiphany and worked out whats going on.

If you are in a Check Out workflow and click the close button (little 'x' in the top right), it should cancel the current edit and the workflow. However it actually goes to the next workflow step which saves the current invoice, minus any of the new items you may have added. 

Net result is that the total on the invoice doesn't agree with that of the saved invoice items.

I'll fix this ASAP for 1.5-beta-3.

-Tim

Re: Invoice addition problem

Fantastic sleuthing Tim. Thanks!

-Paul

Re: Invoice addition problem

This has now been fixed. The fix will be available in the 1.5-beta-3 release.

Regards,

Tim

Syndicate content