Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Ignoring days
Message
From
06/04/2006 15:03:20
 
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Title:
Environment versions
Visual FoxPro:
VFP 8 SP1
OS:
Windows XP SP2
Miscellaneous
Thread ID:
01110880
Message ID:
01111166
Views:
13
>>>>Hi all
>>>>I have a table with two field - order_date and ship_date - I want to know the days from the customer ordered till when we shipped, but I want to ignore from friday an saturday (if we got the order in thursday and we shipped it in sunday it's will be considerd as one day and if we got the order in monday and shipped in wednesday is 2 days).
>>>>Thank's
>>>
>>>
>>>? Ship_date - Order_Date - IIF(TRANSFORM(DOW(Ship_date,2)) $ [67],DOW(Ship_date,2)-5, 0)
>>>
>>???
>>try
Ship_date=date()
>>Order_Date=date()-30
>>?Ship_date - Order_Date - IIF(TRANSFORM(DOW(Ship_date,2)) $ [67],DOW(Ship_date,2)-5, 0)
>
>I see what you mean :o)
>So try this:
>
>
>Ship_date  = date()
>Order_Date = date()-30
>** How many weeks are passed from order date to sheep date
>lnWeeks    = INT((Ship_date - Order_Date) / 7)
>
>** Get the from Ship date week when full week ends
>lcThisWeekDay = Order_Date + lnWeeks*7
>
>WAIT WINDOW (Ship_date - lcThisWeekDay - IIF(TRANSFORM(DOW(Ship_date,2)) $ [67],DOW(Ship_date,2)-5, 0)) + lnWeeks*5
>
Run the two following options:
messagebox('OPTION 1')
Ship_date  = date()-4
Order_Date = date()-6
** How many weeks are passed from order date to sheep date
lnWeeks    = INT((Ship_date - Order_Date) / 7)

** Get the from Ship date week when full week ends
lcThisWeekDay = Order_Date + lnWeeks*7

WAIT WINDOW (Ship_date - lcThisWeekDay - IIF(TRANSFORM(DOW(Ship_date,2)) $ [67],DOW(Ship_date,2)-5, 0)) + lnWeeks*5
messagebox('OPTION 2')
Ship_date  = date()-3
Order_Date = date()-6
** How many weeks are passed from order date to sheep date
lnWeeks    = INT((Ship_date - Order_Date) / 7)

** Get the from Ship date week when full week ends
lcThisWeekDay = Order_Date + lnWeeks*7

WAIT WINDOW (Ship_date - lcThisWeekDay - IIF(TRANSFORM(DOW(Ship_date,2)) $ [67],DOW(Ship_date,2)-5, 0)) + lnWeeks*5
I changed one day but the difrrance is 3
Thank you
Chaim
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform