Order Restrictions based on Expiry Date
For products with a limited shelf life, it is not enough to know how much product the store needs. It is also important to check how much it will actually have time to sell before the end of the shelf life.
Therefore, all orders in MySales are calculated taking into account Shelf-Life Limit — a shelf-life restriction.
Its purpose is to prevent a situation where the system generates an order after which part of the stock will not be sold in time and will be written off.
Thus, MySales balances between two risks:
OOS — there is not enough product;
Overstock / Write-offs — more product has been ordered than can be sold.
How Shelf-Life Limit Works
MySales determines the forecast sales volume during the available shelf life and uses it as a limit for the order.
In simplified form:
Shelf life
↓
Available sales period
↓
Forecast for this period
↓
Shelf-Life Limit
↓
Checking and, if necessary, reducing the order
If the initially calculated order exceeds the permissible quantity, the system adjusts it.
Simple Example
Suppose:
the store sells
1 unit per day;the shelf life is
5 days;1 dayis subtracted according to the default parameter;the limit coefficient is
80%.
Calculation:
5 − 1 = 4 days
4 × 0,8 = 3,2
Therefore:
Shelf-Life Limit = 3,2
This is the maximum calculated quantity before applying rounding rules, pack multiples, and the minimum order.
If the order is generated in the morning, the delivery day is counted as the first day of the shelf life.
How Shelf-Life Limit Is Calculated
Let us consider a more detailed example.
Input Data
the number of days between D1 and D2 is
3;the shelf life is
4 days;Stock —
4;Presentation Stock —
5;multiple —
3;minimum order —
10;Forecast D1D2 —
3;Safety Stock D1D2 —
4;the order initially generated by the system —
15.
To determine the limit, MySales sums the Forecast for the period during which the product can be sold.
For example:
Forecast Tue + Forecast Wed + Forecast Thu + Forecast Fri
0,8 + 1,2 + 1 + 0,95 = 3,95
Therefore:
Shelf-Life Limit = 3,95
This means that within the corresponding shelf life, the store is forecast to sell 3.95 units before applying rounding rules.
Two Ways of Applying Shelf-Life Limit
In MySales, the limit can be applied in two ways.
By default, the second option is used, where both limits are taken into account.
1. Standard Option
The system determines the maximum number of packs that can be ordered, taking shelf life into account.
After calculating Shelf-Life Limit, the following are applied:
pack multiple;
rounding threshold;
minimum order.
The rounding threshold determines when an incomplete pack should be rounded up and when it should be rounded down.
The user sees the calculated result in the “Shelf-Life Limit” field.
If the initial order exceeds this limit, MySales automatically reduces it to the permissible value.
2. Option Taking Stock D1 into Account
The second option additionally takes into account:
Stock D1 — stock at the time of D1;
Write-offs D1D2 — forecast write-offs.
First, the following is checked:
Order + Stock D1 − MIN(Stock D1; Write-offs D1D2 або 0) > Shelf-Life Limit
If the condition is met, the order is recalculated:
Order = ROUND(MAX(0; Shelf-Life Limit − Stock D1 + MIN(Stock D1; Write-offs D1D2 або 0)))
Why Take Stock D1 into Account
Shelf-Life Limit must control not only the new order, but also the total quantity of product that will be available after delivery.
Therefore, the system takes existing Stock D1 into account.
At the same time, forecast Write-offs are also important: product that will be written off should not fully reduce the need for new replenishment.
How Rounding to a Multiple Works
Shelf-Life Limit can be fractional, but the actual order must comply with the packaging rules.
Let us consider a separate example:
Shelf-Life Limit =
3,95;pack multiple =
5;rounding threshold =
60%.
1. Determine the Remainder
MOD(3,95; 5) = 3,95
2. Determine the Fraction of a Pack
3,95 / 5 = 0,79 = 79%
3. Compare It with the Threshold
79% > 60%
Therefore, Shelf-Life Limit is rounded up to a full pack:
3,95 → 5
If the fraction were below the set threshold, the value would be rounded down.
How the Minimum Order Is Taken into Account
After rounding to a multiple, the system checks the minimum order.
Let us continue the previous example:
Shelf-Life Limit after rounding =
5;minimum order =
10;rounding threshold =
60%.
We calculate:
5 / 10 = 0,5 = 50%
Since:
50% < 60%
the value is rounded down.
Therefore:
Final Order = 0
This means that a need for the product may exist, but generating a minimum order of 10 units would create stock that exceeds the permissible level based on shelf life.
Therefore, the system does not generate an order.
Rules After Rounding to a Multiple
After determining the rounded Shelf-Life Limit, three scenarios are possible:
Shelf-Life Limit = 0
→ the new order equals 0.
Shelf-Life Limit is not equal to 0 and is not less than the minimum order
→ the order is generated according to the rounded Shelf-Life Limit.
Shelf-Life Limit is greater than 0 but less than the minimum order
→ the system additionally checks what fraction of the minimum order the available limit represents.
If this fraction reaches the set threshold, the value may be rounded to the minimum order. If not, it is rounded down to 0.
Complete Calculation Logic
The process can be presented as follows:
Initially calculated order
↓
Shelf life
↓
Forecast for the available sales period
↓
Shelf-Life Limit
↓
Stock D1 + Write-offs D1D2 — for the corresponding option
↓
Checking the pack multiple
↓
Rounding threshold
↓
Checking the minimum order
↓
Final order
What the User Sees
The calculation result is displayed in the order in the “Shelf-Life Limit” field.
This helps understand:
how much product can be ordered, taking shelf life into account;
why the initially calculated order was reduced;
how the pack multiple affected the result;
how the minimum order is taken into account;
why, in certain cases, the system may reduce the order to 0.
Example of a Complete Scenario
Suppose MySales calculated a need: Order = 15
But forecast sales during the permissible shelf life amount to only: Life Limit = 3,95
After rounding to a multiple of 5: 3,95 → 5
Next, the system checks the minimum order: Min Order = 10
5 / 10 = 50%
With a threshold of 5 / 10 = 50%
Therefore: Final Order = 0
This means that the system does not order 15 units solely because this need was initially calculated. It additionally checks whether this product will actually be sold before the end of its shelf life.
Result
Shelf-Life Limit allows MySales to combine the need for replenishment with the actual ability to sell the product before it is written off.
The calculation may take into account:
shelf life;
Forecast for the corresponding period;
Stock D1;
Write-offs D1D2;
pack multiple;
rounding threshold;
minimum order.
As a result, MySales answers not only the question:
“How much product needs to be ordered?”
but also checks:
“How much product can be ordered now so that the store will actually have time to sell it before the end of its shelf life?”
This helps maintain product availability while simultaneously reducing the risk of overstock and future write-offs.