Ocean West Posted February 3, 2023 Posted February 3, 2023 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 ) )
comment Posted February 3, 2023 Posted February 3, 2023 (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, 2023 by comment
Ocean West Posted February 3, 2023 Author Posted February 3, 2023 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?
comment Posted February 3, 2023 Posted February 3, 2023 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.
Recommended Posts
This topic is 749 days old. Please don't post here. Open a new topic instead.
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