Source: http://gabsi2.free.fr/Jamil/Gestion des flux/exercicedecalculdestocks.pdf