Paul Kraus wrote:
> here is the problem.
> 
> I am parsing sales reports that are printed 2 or more times each day.
> The 1st report of everyday is actually the last report of the previous
> day.
> 
> I have written a program that look at the modified time of the reports
> then if the reports date is before 9am then the report is set to the
> previous day.
> 
> To ease my work when having to go through these reports at a later
> date I have the reports renamed based on date and then incrementally
> ordered for that date. Example: 7.9.2003_(1)_(64836).txt Reads date -
> report number time when report was run. You may recognize this from a
> bunch of posts yesterday ;)
> 
> Now I have this all set so that it work great!! Thanks to everyone's
> help on the list. However when I do the check to see if the report is
> from the previous day the system does not take into account non-work
> days. For instance if its Mondays morning report (which is actually
> posted to Fridays sales) the report date would be set to Sunday.
> 
> I am trying to figure out a good way to account for this. The only
> thing I can think of would be to great hashes for each month. Then
> have hash keys for the day after days off. So the system would check
> the hash key if exits it would set the day to the day defined in the
> hash. 
> 
> Sample (Fridays date is the 11th. Mondays date is 14th.)
> I would have a hash called july{14}=11;
> If report is for previous day
>       if ($july{reports modify date})
>               report date = $july{reports modify day}
>       else
>               report date -= 1
>       endif
> 
> 
> This seem VERY CUMBERSOME :) any suggestions or am I on the right
> track with this.
> 
> Paul

        Just do a day check from timelocal which has element 6 for day of week.  If 
Mon then day of week equal to 1, so need to go back 3 days.  Make a little routine to 
determine date to use and then flow everything through that sub.  What I have is 
get_time( $TimeInfo ) for myself which is a reference to array, so $TimeInfo->[6] == 1 
would setup a diff variable to 3 and another call usually  like get_time( $MyPullDate 
) and with the diff at 3 then $MyPulDate has info for Prev Friday.

        Just one approach, but pretty simplistic and no extra modules really needed.

Wags ;)


**********************************************************
This message contains information that is confidential
and proprietary to FedEx Freight or its affiliates.
It is intended only for the recipient named and for
the express purpose(s) described therein.
Any other use is prohibited.
****************************************************************


--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to