Ocean West Posted February 3 Share Posted February 3 Trying to calculate the estimated arrival date of a shipment. I believe I am overcomplicating it We ship same day before 3 pm otherwise, it ships on the next business day if it's Friday then Monday unless priority Saturday delivery is elected. Would like to make this more reliable. Grateful for a better approach. Let ( [ id = Method ; shipOn = Case( status = 0 ; Get(CurrentDate) ; INVOICES::Invoice_Date) ; w = DayOfWeek ( shipOn ) ; cutoff = Case ( Hour ( Get(CurrentHostTimestamp )) > 15 and w = 6 ; 2 ; 0 ) ]; shipOn + cutoff + Case ( //3Day id = 118 or id = 119; 3 + Case ( w ≥ 4 ; 2 ) ; //2Day id = 106 ; 2 + Case ( w ≥ 5 ; 2 ) ; //Std Overnight id = 116 ; 1 + Case ( w = 6 ; 1 ) ; //Priority id = 112 ; 1 + Case ( w = 6 ; 2 ) ; //SaturdayPriority id = 114 ; 1 ) ) Link to comment Share on other sites More sharing options...
comment Posted February 3 Share Posted February 3 (edited) I am not sure I follow your business rules. I think (!) it might be easier to calculate the target shipping date first, without considering the weekend. Then, if it falls on a weekend, delay it until Monday, unless it has a higher priority. Edited February 3 by comment Link to comment Share on other sites More sharing options...
Ocean West Posted February 3 Author Share Posted February 3 if the invoice is paid in full before 3pm we will ship same date M-F and based on service add 3 day / 2 days / 1 day (morning or afternoon) / and today is Friday they can elect Saturday delivery. Anytime after 3pm we will ship it out the next day plus days in transit. But if it's after 3pm on Friday it won't ship until Monday, almost seems to need to be recorusive a bit? Link to comment Share on other sites More sharing options...
comment Posted February 3 Share Posted February 3 I am sorry, I missed the fact that the 1/2/3 days are days in transit, not days until shipment. Still, I think you should start with the day of shipment, then add the days in transit. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now