Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Quarter Date Formula

Status
Not open for further replies.

wanzek1

Technical User
Jun 13, 2012
79
US
I am working on a formula for a 401(k) report to send to our plan administrator. I need a formula to show which quarter they are eligible. This is the start of my formula:

if DateDiff("d",{HRRM.HireDate},{?EndPayPeriod}) < 30 then 'N'
else if DateDiff("d",{HRRM.HireDate},{?EndPayPeriod})>30 and ({@IBSH0162.IB_Employment_Status} = '06 ' or {@IBSH0162.IB_Employment_Status} = '30 ') then 'Y'
else if {HRRM.udOrigHireDate}> #1/1/1950# and ({@IBSH0162.IB_Employment_Status} = '06 ' or {@IBSH0162.IB_Employment_Status} = '30 ')
then 'Y' else if
{HRRM.TermDate}>#1/1/1950# then space(8)

Whenever the letter 'Y' is I would need the start of the quarter coming up. In this case 7/1/2013. Whereever the letter 'N' is I need the quarter they are eligible. In this case 10/1/2013. I have no idea how I would go about doing that.
 
create a 2nd formula that references the one above.

if your formula is named {@401YN} then the 2nd formula might look something like this:

//{@DisplayDate}
numbervar mn; //month
numbervar dy := 1; //day
numbervar yd; //year
datevar ddt; //display date

IF {@401YN} = 'Y' then
(IF Month(currentdate) in [10,11,12] then yd := year(currentdate)+1 else yd := year(currentdate)); //set year value

IF {@401YN} = 'Y' then
(IF Month(currentdate) in [1,2,3] then mn := 4 else
(IF Month(currentdate) in [4,5,6] then mn := 7 else
(IF Month(currentdate) in [7,8,9] then mn := 10 else
(IF Month(currentdate) in [10,11,12] then mn := 1
)))) ;

IF {@401YN} = 'N' then
//from your post, i have no idea what the calculations you use to determine eligibility date, but they would go here.
//as an example, i am going to use 6 months from the date of hire and represent it with {HIREDATE}
ddt := month(dateserial(year({HIREDATE}),month({HIREDATE})+6,day({HIREDATE}))
else ddt := dateserial(yd,mn,01);

ddt


I apologize in advance for any misunderstanding or mistakes. I do not have crystal in front of me to check syntax/etc.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top