Hi..
If you use moving average price, you can meet this problem.
You should reverse all transactions which are occurred after goods receipt in reverse order to avoid this problem.
Despite of reversing documents, the case that the balance isnon-zero is sometimes.