Lead Time Calculation System
Overview
The lead time calculation system determines production and delivery timelines based on order specifications, customization complexity, and delivery method selection.
Core Delivery Types
Regular Delivery
Total Time: 15 working days
Base Production: 7 days (Blank caps)
+ Regular Shipping: 8 days
= 15 working days total
Characteristics:
- Standard UPS delivery
- 6-10 calendar days shipping
- Most economical option
- Default selection
Priority Delivery
Total Time: 11 working days
Base Production: 7 days (Blank caps)
+ Priority Shipping: 4 days
= 11 working days total
Characteristics:
- Express FedEx delivery
- 4-6 calendar days shipping
- Additional cost
- Faster turnaround
Pick a Date
Custom date selection with dynamic calculation.
Requirements:
- Minimum 7 working days from order date
- System calculates working days between today and selected date
- Automatically maps to closest standard delivery type
Lead Time Components
Base Production Time
Blank Caps: 7 working days
Decorated Caps: 7 working days + customization time
Customization Additions
Logo setup complexity adds time:
| Logo Setup | Additional Days |
|---|---|
| Two Logo Positions | +1 day |
| Three Logo Positions | +1 day |
| Four Logo Positions | +2 days |
Quantity-Based Additions
Large orders require additional time:
Additional Days = floor(totalQuantity / 1000) * 2
Examples:
- 500 units: 0 additional days
- 1,000 units: 2 additional days
- 2,500 units: 4 additional days
- 5,000 units: 10 additional days
Color Complexity
Multiple color variations add processing time:
Additional Days = floor(numberOfColorVariants / 2)
Examples:
- 1-2 colors: 0 additional days
- 3-4 colors: 1 additional day
- 5-6 colors: 2 additional days
Accessories & Special Options
Accessories and special cap setup options:
Additional Days = floor((AccessoriesCount + SpecialOptionsCount) / 2)
Accessories Include:
- Hang Tags
- Stickers
- B-Tape Print
- Brand Labels
- Custom packaging
Special Options Include:
- Premium fabrics
- Premium closures
- Special constructions
Delivery Method Adjustments
Blank Caps
| Method | Adjustment |
|---|---|
| Regular | +8 days |
| Priority | +4 days |
Decorated Caps
| Method | Adjustment |
|---|---|
| Regular | +5 days |
| Priority | +3 days |
Freight Options (3,168+ units)
Air Freight: +10 to +20 days Sea Freight: +45 to +60 days
Calculation Algorithm
Step 1: Determine Base Time
if (logoSetup === "Blank") {
baseTime = 7; // Blank base
} else {
baseTime = 7; // Decorated base
}
Step 2: Add Logo Complexity
if (logoSetup === "TwoLogo" || logoSetup === "ThreeLogo") {
logoTime = 1;
} else if (logoSetup === "FourLogo") {
logoTime = 2;
} else {
logoTime = 0;
}
Step 3: Add Delivery Method
if (logoSetup === "Blank") {
if (deliveryType === "Regular") deliveryTime = 8;
else if (deliveryType === "Priority") deliveryTime = 4;
} else {
if (deliveryType === "Regular") deliveryTime = 5;
else if (deliveryType === "Priority") deliveryTime = 3;
}
Step 4: Add Quantity Factor
quantityDays = Math.floor(totalQuantity / 1000) * 2;
Step 5: Add Color Complexity
colorDays = Math.floor(numberOfColors / 2);
Step 6: Add Accessories & Options
accessoryDays = Math.floor((accessories + specialOptions) / 2);
Step 7: Calculate Total
totalLeadTime = baseTime + logoTime + deliveryTime +
quantityDays + colorDays + accessoryDays;
Step 8: Calculate Delivery Date
deliveryDate = addWorkingDays(today, totalLeadTime);
Working Days Calculation
Exclusions
- Saturdays
- Sundays
- Major holidays
Algorithm
function addWorkingDays(startDate: Date, days: number): Date {
let currentDate = new Date(startDate);
let addedDays = 0;
while (addedDays < days) {
currentDate.setDate(currentDate.getDate() + 1);
// Skip weekends
if (currentDate.getDay() !== 0 && currentDate.getDay() !== 6) {
addedDays++;
}
}
return currentDate;
}
Example Calculations
Example 1: Simple Order
Specifications:
- Blank caps
- 100 units
- Regular delivery
- 1 color
Calculation:
Base: 7 days
+ Delivery (Regular, Blank): 8 days
+ Quantity: 0 days (100 < 1000)
+ Colors: 0 days (1 color)
= 15 days total
Delivery Date: Today + 15 working days
Example 2: Complex Order
Specifications:
- Decorated caps (3 logo positions)
- 2,500 units
- Priority delivery
- 5 color variants
- 3 accessories
Calculation:
Base: 7 days
+ Logo (Three positions): 1 day
+ Delivery (Priority, Decorated): 3 days
+ Quantity: 4 days (floor(2500/1000) * 2)
+ Colors: 2 days (floor(5/2))
+ Accessories: 1 day (floor(3/2))
= 18 days total
Delivery Date: Today + 18 working days
Example 3: Large Enterprise Order
Specifications:
- Decorated caps (4 logo positions)
- 5,000 units
- Air Freight
- 8 color variants
- 5 accessories + 2 special options
Calculation:
Base: 7 days
+ Logo (Four positions): 2 days
+ Delivery (Air Freight): 15 days (average)
+ Quantity: 10 days (floor(5000/1000) * 2)
+ Colors: 4 days (floor(8/2))
+ Accessories/Options: 3 days (floor(7/2))
= 41 days total
Delivery Date: Today + 41 working days
Pick a Date Mapping
When customer selects specific delivery date:
- Calculate Days Required: Difference between today and selected date (working days only)
- Validate Minimum: Must be at least 7 working days
- Map to Delivery Type:
- If calculated days ≈ 15: Map to Regular
- If calculated days ≈ 11: Map to Priority
- Otherwise: Custom calculation
Integration Points
With Cost Calculation
Lead time affects delivery costs:
- Priority adds express shipping fee
- Freight options reduce per-unit shipping cost
With Order Management
Lead time determines:
- Production schedule
- Material procurement timing
- Customer communication timeline
With Customer Communication
System provides:
- Estimated delivery date
- Timeline breakdown
- Notification schedule
API Response Format
{
"leadTime": {
"totalDays": 15,
"deliveryDate": "2025-02-17",
"details": [
"Base Production: 7 days",
"Regular Delivery (Blank): +8 days"
],
"breakdown": {
"base": 7,
"logo": 0,
"delivery": 8,
"quantity": 0,
"colors": 0,
"accessories": 0
}
}
}
Error Handling
Validation Rules
- Minimum Time: At least 7 working days
- Maximum Time: System calculates, no hard limit
- Date Validation: Selected date must be in future
Fallback Logic
If calculation fails:
- Default to Regular delivery (15 days)
- Log error for review
- Notify customer of default selection
Technical Support: tech@customcapbd.com API Documentation: API Reference