Delta stock computation does not include expired lots
Here is review27091002 which shows that compute_quantities_query does not decrease the expired lots.
I think the solution will be to add another query to the union which will subtract the quantity of expired lot at the end date (or maybe at the expired date).