Talk with the Author
 Crystal Reports Forum : General Information : Talk with the Author
Message Icon Topic: Business Day count Post Reply Post New Topic
Author Message
cmariemd
Newbie
Newbie


Joined: 27 Aug 2008
Location: United States
Online Status: Offline
Posts: 1
Quote cmariemd Replybullet Topic: Business Day count
    Posted: 27 Aug 2008 at 9:11am
Can anyone tell me how to correct the program below so the consecutive days continue to add up even if the month changes?
 
Shared NumberVar consecDays;
Shared NumberVar consecDaysMax;
if(Previous({TR_CC_HRIS_MAND_ABS_BY_SUPVID.TR_GEMS_ID}) = {TR_CC_HRIS_MAND_ABS_BY_SUPVID.TR_GEMS_ID} and
   DateDiff("d",Previous({TR_CC_HRIS_MAND_ABS_BY_SUPVID.RETURN_DT}), {TR_CC_HRIS_MAND_ABS_BY_SUPVID.BEGIN_DT}) <= 1 or
   (DateDiff("d",Previous({TR_CC_HRIS_MAND_ABS_BY_SUPVID.RETURN_DT}), {TR_CC_HRIS_MAND_ABS_BY_SUPVID.BEGIN_DT}) = 2 and
    DayofWeek(DateAdd("d",-1,{TR_CC_HRIS_MAND_ABS_BY_SUPVID.BEGIN_DT})) in [1,7] and
    DayofWeek(DateAdd("d",-2,{TR_CC_HRIS_MAND_ABS_BY_SUPVID.BEGIN_DT})) in [1,7])) then
    consecDays:= consecDays + DateDiff("d",{TR_CC_HRIS_MAND_ABS_BY_SUPVID.BEGIN_DT},{TR_CC_HRIS_MAND_ABS_BY_SUPVID.RETURN_DT})
else
    consecDays:= DateDiff("d",{TR_CC_HRIS_MAND_ABS_BY_SUPVID.BEGIN_DT},{TR_CC_HRIS_MAND_ABS_BY_SUPVID.RETURN_DT});
if(Previous({TR_CC_HRIS_MAND_ABS_BY_SUPVID.TR_GEMS_ID}) <> {TR_CC_HRIS_MAND_ABS_BY_SUPVID.TR_GEMS_ID}) then
    consecDaysMax := consecDays
else if(consecDaysMax < consecDays) then
    consecDaysMax := consecDays;

consecDays
 
 example:  hrs = 8.00     days = 7     hrs= 56.00
Cynthia W
IP IP Logged
Post Reply Post New Topic
Printable version Printable version

Forum Jump
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot delete your posts in this forum
You cannot edit your posts in this forum
You cannot create polls in this forum
You cannot vote in polls in this forum



This page was generated in 0.016 seconds.