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