One of our customers reported an issue with the job Calculate Inventory (report 790). They began noticing that some of the items listed were listed two times in the journal instead of just one. At first you'd think this would be because one of the entries in the item ledger might have location code A and the other B, but this is not the case. All entries have the same location code. It gets even weirder when you filter the job to only include the one item with a double entry. If you do this, then only one line will be posted. ](*,) I can't understand why a simple filter could cause the change in behaviour.
I also can't make sense of the quantity that is calculated on the extra line. In our case, the item has two entries in item ledger entry. The first is an initial purchase of 5 quantities on location A. Then, later, 1 quantity is sold from location A. The first line in the item journal will read a calculated inventory of 3, which is wrong, and the second line will read a calculated inventory of 4, which is correct.
I noticed this post, which appear to be the same problem, but no solution was given there.
http://www.mibuso.com/forum/viewtopic.php?f=23&t=32997&hilit=calculate+inventory
Can anybody tell me the reason for this behaviour? I'm really at a loss here. I've tried debugging, but I just can tell why or where the second line is created. :-k
//BEGIN EDIT//
This is NAV 4.0 SP2..
//END EDIT//
Comments
I did try to merge the report with version 5.0 SP1, because a few changes have been made in the later version, but the result is still the same.
When debugging, I have now noticed that the call to function InsertItemJnlLine only happens once for the item in question, even so we are still left with two lines in the journal once the job has finished. ](*,) ](*,) ](*,) That makes no sense to me :-k