FIFO: each sale costed at the price of the layers it used
A sale takes stock from the oldest layer first. Its cost is the actual price of the layers it used, so the first stock bought is the first stock expensed.
Layers are kept for each location, so a sale uses the layers at the location the goods leave from. For a batch-tracked item, it uses the layers of the batch it takes, which by default is the batch that expires first.