How does expiry date get set for an item?

Suggestion:
If the value in Track Shelf Life field in item master is selected as ‘Yes’, then it will allocate the approved and non-expired materials on first expiry first issue else it will allocate the approved material on first receipt first issue basis.
Shelf life type selected as ‘expiry’. Users have to enter the Shelf life and minimum shelf life which is defined in months. e.g if shelf life is 3 years then it should be mentioned 12. And if minimum shelf life is 6 months, then system will not allow the user to any transaction if 6 months are remaining for expiry.
If Track Shelf Life has been defined as No, then system will issue Inventory on first receipt first issue basis.