Rule 1: Product Type Minimum Transit Override

Interpretation => If product type is 3 → minimum transit time must be at least 1 day.
Condition:

KeyIndexProductType == "3"


Example =>
if (KeyIndexProductType == "3")

{

Session[this.OrderNumber + facilityCode + "MinTransitDays"] = 1;

}

Rule 2: Shipping Date Edit Restriction
Interpretation => If the delivery date is today or in the past → the user cannot modify the shipping date.
Condition:

Today ≥ Delivery Date



Rule 3: Minimum Shipping Date (MinDate) – With Transit Days
Interpretation => If transit days are defined → shipping must occur early enough to meet delivery.
Condition:

facilityCode is not empty
AND Session[TransitDays] exists
AND Session[TransitDays] != "0"


Example =>
MinDate = DeliveryDate - TransitDays


Rule 4: MinDate Adjustment Based on Selected Shipping Date
Interpretation => If the selected shipping date is earlier than allowed → adjust MinDate to maintain consistency.
Condition:

Shipping Date is already selected
AND Selected Shipping Date < Calculated MinDate


Example =>
days = MinDate - SelectedShippingDate

If (days > 0)
MinDate = MinDate - days
Else
MinDate = MinDate

Rule 5: Minimum Shipping Date (MinDate) – Default

Condition:

TransitDays not available

Interpretation:

If no transit days are defined → shipping cannot be in the past.

System Behavior:

MinDate = Today

Rule 6: Maximum Shipping Date (MaxDate) – With Minimum Transit Days

Condition:

facilityCode is not empty
AND Session[MinTransitDays] exists
AND Session[MinTransitDays] != "0"

Interpretation:

Shipping must occur early enough to satisfy minimum transit time before delivery.

System Behavior:

CandidateMaxDate = DeliveryDate - MinTransitDays

If (MinDate ≥ CandidateMaxDate)
    MaxDate = MinDate
Else
    MaxDate = CandidateMaxDate

Rule 7: Maximum Shipping Date (MaxDate) – Default

Condition:

MinTransitDays not available

Interpretation:

If no minimum transit restriction exists → shipping can be scheduled up to delivery date.

System Behavior:

MaxDate = DeliveryDate

Rule 8: Shipping Date Enablement Based on Override

Condition:

_isShippingOverride == true

Interpretation:

Shipping date can only be edited if override is allowed.

System Behavior:

_wtbShippingDate.Enabled = true

Else:

_wtbShippingDate.Enabled = false

Final Consolidated Rule

Interpretation:

Shipping date must always fall within the allowed range and respect delivery and transit constraints.

System Behavior:

MinDate ≤ Shipping Date ≤ MaxDate