Alpha Video Training
Results 1 to 11 of 11

Thread: Fiscal Year

  1. #1
    VAR davej's Avatar
    Real Name
    Dave Jampole
    Join Date
    Apr 2000
    Location
    Haughton, LA ( just east of Shreveport, Louisiana)
    Posts
    2,524

    Default 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

  2. #2
    "Certified" Alphaholic Stan Mathews's Avatar
    Real Name
    Stan Mathews
    Join Date
    Apr 2000
    Location
    Bowling Green, KY
    Posts
    25,119

    Default 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

  3. #3
    VAR davej's Avatar
    Real Name
    Dave Jampole
    Join Date
    Apr 2000
    Location
    Haughton, LA ( just east of Shreveport, Louisiana)
    Posts
    2,524

    Default RE: Fiscal Year

    Stan,

    Thanks, I'll give it a try.

    Dave

  4. #4
    "Certified" Alphaholic Stan Mathews's Avatar
    Real Name
    Stan Mathews
    Join Date
    Apr 2000
    Location
    Bowling Green, KY
    Posts
    25,119

    Default 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

  5. #5
    "Certified" Alphaholic Stan Mathews's Avatar
    Real Name
    Stan Mathews
    Join Date
    Apr 2000
    Location
    Bowling Green, KY
    Posts
    25,119

    Default 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

  6. #6
    VAR davej's Avatar
    Real Name
    Dave Jampole
    Join Date
    Apr 2000
    Location
    Haughton, LA ( just east of Shreveport, Louisiana)
    Posts
    2,524

    Default 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

  7. #7
    Member
    Real Name
    robert adler
    Join Date
    Apr 2000
    Location
    Boynton Beach, BL
    Posts
    591

    Default RE: Fiscal Year

    Dave:

    Add a year and subtract a day.

    new date = addyears(date+1)
    new date = add_bus_days(new dat},-1)

    I hope this helps

    bob adler

  8. #8
    "Certified" Alphaholic Stan Mathews's Avatar
    Real Name
    Stan Mathews
    Join Date
    Apr 2000
    Location
    Bowling Green, KY
    Posts
    25,119

    Default 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}

  9. #9
    VAR davej's Avatar
    Real Name
    Dave Jampole
    Join Date
    Apr 2000
    Location
    Haughton, LA ( just east of Shreveport, Louisiana)
    Posts
    2,524

    Default 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

  10. #10
    "Certified" Alphaholic Stan Mathews's Avatar
    Real Name
    Stan Mathews
    Join Date
    Apr 2000
    Location
    Bowling Green, KY
    Posts
    25,119

    Default 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

    cyear(addyears(Appdate,1)) for cyear(Appdate)+1

  11. #11
    VAR davej's Avatar
    Real Name
    Dave Jampole
    Join Date
    Apr 2000
    Location
    Haughton, LA ( just east of Shreveport, Louisiana)
    Posts
    2,524

    Default 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)

Similar Threads

  1. Finding Fiscal Week
    By Dan Daley in forum Alpha Five Version 4
    Replies: 7
    Last Post: 03-28-2002, 12:57 PM
  2. How to Get Fiscal Info
    By Dan Daley in forum Announcements
    Replies: 3
    Last Post: 03-26-2002, 05:59 AM
  3. Group on Year
    By forskare in forum Alpha Five Version 4
    Replies: 7
    Last Post: 12-29-2000, 06:55 PM
  4. All Calcuations out by One Year
    By Donna Brown in forum Alpha Five Version 4
    Replies: 8
    Last Post: 09-07-2000, 01:10 PM
  5. Alpha4v6 beyond Year 2038 & Year 2038
    By Francois Blawat in forum Alpha Four Version 6 and Prior
    Replies: 2
    Last Post: 07-20-2000, 05:09 AM

Bookmarks

Posting Permissions

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