Thanks Everyone for the great feedback -
Qing:
"Is the inner loop for query qryGetShipCosts really necessary?"
No - it wasn't - thanks for the catch!
" I always include SELECT TOP 1..."
I can't do that (MySQL) - but I can do Maxrows="1" - and I usually do.
Thanks for that catch as well.
And you are right - I should improve upon my variable scoping practices...
Note Taken.
Leigh:
You are right - there are some tricky Date things here. I am not sure I have
a full grasp on your method... But you did hit on something I didn't think
about so I am glad I asked. I DO have dates that cannot allow shipping.
Xmas, New Years, Labor Day, Memorial Day, etc... (Although there is strange
crossover between the UPS, FedEx and Florists..)
In your method - do you propose making a DB Table of ALL Dates - and a
Second Table of Dates you Cannot ship on - or one master table of only
possible ship dates. The later seems difficult because I won't know next
year's dates... But I could certainly make the customer enter them in each
year... (I can't make them re-occurring, because the "day off" may not be
the holiday... For instance, July 5th is the "observed" Independence Day for
UPS.. NOT the 4th, since it falls on a Sunday.)
So - with that in mind - how could I do it? Without storing "future dates"
- like this?
*Get Ship Costs
*Get Non-Ship Dates
*Set variables.NewDay
<cfset variables.NonShipDates = ValueList(qryGetNonShipDates.NonShipDate,
",")>
<cfloop from="1" to="30" index="i">
<cfif NOT ListContains(variables.NonShipDates, "newDay")>
<cfif DayOfWeek(variables.newDay) NEQ 1>
<li>#LSDateFormat(variables.newDay, "mmm-dd-yyyy")# -
#DayOfWeekAsString(DayOfWeek(variables.newDay))#
<!---Next Day Delivery --->
<cfif i EQ 1>
<strong>#qryGetShipCosts.NextDay#</strong>
<!---Two Day Delivery --->
<cfelseif i EQ 2>
<strong>#qryGetShipCosts.TwoDay#</strong>
<!--- All other delivery options get standard price unless it is for
a Saturday. --->
<cfelse>
<cfif DayOfWeek(variables.newDay) NEQ 7>
#qryGetShipCosts.Standard#
<cfelse>
#qryGetShipCosts.Saturday#
</cfif>
</cfif>
</li>
</cfif>
<cfset variables.newDay = DateAdd("d",1,variables.newDay)>
</cfif>
</cfloop>
??
- Nick
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Want to reach the ColdFusion community with something they want? Let them know
on the House of Fusion mailing lists
Archive:
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:329754
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4