Yudel – you didn’t ask me to do a remote session you asked Michael to do a remote session. There shouldn’t be a need for a remote session – the fix should be fairly simple.
THE PROBLEM
It seems like whenever we send estimates or invoices to QuickBooks the line items send completely out of order of how they were inserted into the MySQL table. When we send estimates/invoices we: delete all previous line items, enter all of the new items one at a time in order from 1st to last and set the SeqNum also for each of them in incremental order from 1-whatever the last one is.
When they go to QB it appears like some of them are in order but then some are out of order. For instance, for simplicity sake I entered lines 1-18 and they came back in this order: 18, 17, 15, 16, 14, 13, 12, 2, 3, 5, 6, 7, 8, 9, 10, 11, 4, 1
I thought maybe it had something to do with it being reversed because it goes 18-12 but then it goes in the correct order again skipping 1 and 4 and then tacking those onto the end. There was bout 30 line items in this estimate and it keeps going like that, in and out of order.
THE REASON & SOLUTION
After hours of testing I have figured out what the problem is and, unfortunately, there is nothing we can do on our end as users – it’s a problem with how OpenSync queries the database.
OpenSync, when pulling estimatelinedetail, invoicelinedetail, etc is not using any ORDER BY in the query. When not using an ORDER BY it is pulling it in the exact order the MySQL returns (“SELECT * FROM estimatelinedetail WHERE IDKEY=’12345′”)… The problem with this is that MySQL does not return the results in the same order that they’re inserted into the DB. You can never rely on the order of something without having an ORDER BY in the query.
I tested dozens of times and every single time, no matter what I put in SeqNum or TxnLineID columns it ALWAYS came back in the order that is returned when you query the lines without an ORDER BY clause.I have tested and every time I query the estimatelinedetail/invoicelinedetail table without the ‘ORDER BY’ it comes in the exact order that OpenSync collects it as – so it’s definitely missing the ORDER BY in OpenSync’s code when it queries the database.
This should, hopefully, be an easy fix for you. Just have it order by one of those and let us know what which one we should be using.