Total Value Difference (Out - In) - Stock Entry transaction for production Order

I found a solution to one of the problems (the difference in In and Out values):
You should "update rate and availability"before submitting the stock entry, this will recalculate costs (I found the solution in the following discussion).

The bigger problem (the accounting problem) remains. Please help.