Changing an existing average cost on a product

Changing An Existing Average Cost On A Product

In regards to a product where the current cost is $10.40 and the Cost P1 is $8.72.
The problem is the concept of an average cost is a statistical entity.  It is really hard to understand it just from a common sense point of view.
It is really hard to describe average cost without referring to the Australian Accounting Standards and Basic Statistics Texts in respect to calculation of weighted averages.  You really have to have studied accounting and statistics to have come across it in the past.
In summary, average cost is a weighted average of the costs of existing stock with the costs of stock receipts.  When a receipt happens, Readysell takes into account the existing average cost. It also considers the quantity being invoiced and the cost of the receipt. It then averages stock on hand * existing average cost with price invoiced * quantity invoiced. In the case of this product there was no stock on hand, so old stock had no effect on the weighted average as a result the average cost should be the last cost.
The easiest way I can put this is if the stock on hand before the receipt is zero the average cost should be the same as the last cost.  It is in this case.
Let's look at couple of examples
Old weighted average = $10
Old cost 10 times old qty 8 = 80
Receipt cost 5 times receipt qty 2 = 10
New weighted average cost = 80 + 10 / 10 = $9
In the case of average cost is $10.40 and current cost is $8.72...
Old weighted average cost = 8
Old cost 8 times old qty 0 = 0
Receipt cost 10.40 times receipt qty 2 = 20.8
New weighted average cost = 20.8 / 2 = $10.4
Note how the contribution to the new average cost of the old average cost is zero in this case due to the old Stock On Hand being zero.