 1. ## Fiscal Year

Does anyone have an idea on how to determine the fiscal year a given date? (The FY runs from Sep 1 thru Aug 31)

Dave  Reply With Quote

2. ## RE: Fiscal Year

If you want Sept through Dec of 2002 and January through August of 2003 to be in FY 2002, etc., I think this works

FUNCTION fiscal AS N (curdate AS D )
if alltrim(cdate(curdate))=""
end
end if
select
case between(month(curdate),9,12)
fiscal = year(curdate)

case between(month(curdate),1,8)
fiscal = year(curdate) - 1

end select

END FUNCTION  Reply With Quote

3. ## RE: Fiscal Year

Stan,

Thanks, I'll give it a try.

Dave  Reply With Quote

4. ## RE: Fiscal Year

A more complete function. Requires two parameters, "as of" date and "begin" date of a fiscal year. Return is numeric fiscal year of the "as of" date, negative 1 is returned if either parameter is missing or if the begin date is not in the form of {xx/01/xxxx}.

FUNCTION fiscalpr AS N (curdate AS D,begin AS D )
fiscalpr = -1
if alltrim(cdate(curdate))="" .or. alltrim(cdate(begin))= "" .or. day(begin)>1
end
end if
select
case month(begin) = 1
fiscalpr = year(curdate)

case between(month(curdate),month(begin),12)
fiscalpr = year(curdate)

case between(month(curdate),1,month(begin))
fiscalpr = year(curdate) - 1

end select

END FUNCTION  Reply With Quote

5. ## RE: Fiscal Year

Slight correction, pasted an early attempt.

FUNCTION fiscalpr AS N (curdate AS D,begin AS D )
fiscalpr = -1
if alltrim(cdate(curdate))="" .or. alltrim(cdate(begin))= "" .or. day(begin)>1
end
end if
select
case month(begin) = 1
fiscalpr = year(curdate)

case between(month(curdate),month(begin),12)
fiscalpr = year(curdate)

case between(month(curdate),1,month(begin)-1)
fiscalpr = year(curdate) - 1

end select
END FUNCTION  Reply With Quote

6. ## RE: Fiscal Year

Stan,

I apologize for not stating my situation clearly enough.

I have an application date on a form. I want to compute the fiscal year based on the application date, with the FY defined as 09/01/year thru 08/31/year+1. I hope this is clearer.

Dave  Reply With Quote

7. ## RE: Fiscal Year

Dave:

Add a year and subtract a day.

I hope this helps  Reply With Quote

8. ## RE: Fiscal Year

I can think of several ways to interpret your statement. The first way is that you want to know what fiscal year your application date "falls in".

Given that, do you want Sept-Dec of one calendar year to "pull" January-Aug of the next calendar year back into the previous numbered year? Say Sept 2002 to Aug 2003 is FY 2002 - this is the function I posted.

Or do you want Jan-Aug of one calendar year to "pull" Sep-Dec forward? Say Sept 2002-Aug 2003 is FY 2003. - easily derived from the same function, moving the -1 up one case statement and making it +1

Another interpretation is you want the entrie fiscal year period to be returned, given an application date

This function

FUNCTION fiscst AS C (curdate AS D)
fiscst = dtoc({01/01/1900}) + " to " + dtoc({01/01/1900})
if alltrim(cdate(curdate))=""
end
end if
select

case between(month(curdate),9,12)
fiscst = "09/01/"+ltrim(str(year(curdate))) + " to "+"08/31/"+ltrim(str(year(curdate)+1))

case between(month(curdate),1,8)
fiscst = "09/01/"+ltrim(str(year(curdate)-1)) + " to "+"08/31/"+ltrim(str(year(curdate)))

end select
END FUNCTION

does that, in character form.

? fiscst({09/01/2002})
= "09/01/2002 to 08/31/2003"

? fiscst({12/01/2002})
= "09/01/2002 to 08/31/2003"

? fiscst({01/01/2003})
= "09/01/2002 to 08/31/2003"

? fiscst({06/15/2003})
= "09/01/2002 to 08/31/2003"

? fiscst({08/31/2002})
= "09/01/2001 to 08/31/2002"

? fiscst({08/31/2003})
= "09/01/2002 to 08/31/2003"

If you want the results in date form, you could parse the character return like

? ctod(left(fiscst({08/31/2003}),10))
= {09/01/2002}

? ctod(right(fiscst({08/31/2003}),10))
= {08/31/2003}  Reply With Quote

9. ## RE: Fiscal Year

Stan,

I'm still having a problem with the fiscal year calculation I need. I would much prefer doing the calc in the receiving (AppFY) field. To that end, I came up with this:

[b]IF((month(Appdate)=>9.AND.month(Appdate)='Appdate' = application date

BUT, I get an Expression does not evaluate to a Character value. error. I cannot see where the problem is.

Any help would be appreciated.

Dave  Reply With Quote

10. ## RE: Fiscal Year

"FY"+cyear(Appdate)+1

evaluates to something like

"FY2003" + 1, depending on the value in Appdate,

not a good thing.

Try substituting  Reply With Quote

11. ## RE: Fiscal Year

Stan,

Thank you, thank you. You gave me the lead to the solution I needed. Interactive mode unlocked to door - A5 cares very much about the sequence of '=>' vs. '>='; they are NOT the same! This is also true between '=9.AND.month(Appdate)  Reply With Quote

#### Posting Permissions

• You may not post new threads
• You may not post replies
• You may not post attachments
• You may not edit your posts
•