com.sage.accpac.sm
Interface FiscalCalendar


@ThreadSafe
public interface FiscalCalendar

The FiscalCalendar interface provides methods to access the fiscal calendar set up in the company. The results returned reflect the state of the fiscal calendar at the time that the calls are made; it is possible for the same call to return different answers at different times.

An instance of this class cannot be created directly by applications. It should be obtained from the Program's Program.getFiscalCalendar() method.

The interface provides inner interfaces to give access to the information:


Nested Class Summary
static interface FiscalCalendar.DateRange
          A date range, as returned by getPeriodDates and other functions, describes a range of dates
static interface FiscalCalendar.FiscalPeriod
          The fiscal period returned by getPeriod
static interface FiscalCalendar.FiscalYear
          The properties of a fiscal year, as returned by getYear and other methods
 
Method Summary
 FiscalCalendar.FiscalYear getFirstYear()
          returns the first fiscal year in the calendar.
 FiscalCalendar.FiscalYear getLastYear()
          returns the last fiscal year in the calendar.
 FiscalCalendar.FiscalPeriod getPeriod(java.util.Date date)
          Locates the fiscal year and period a given date falls on.
 FiscalCalendar.DateRange getPeriodDates(int year, int period)
          Retrieves the start and end dates of a given fiscal year and period.
 int getQuarter(int year, int period)
          retrieves the quarter a given fiscal period belongs to.
 FiscalCalendar.DateRange getQuarterDates(int year, int quarter)
          Retrieves the start and end dates of a given fiscal year and quarter.
 FiscalCalendar.FiscalYear getYear(int year)
          Looks up a fiscal year in the calendar and retrieves its details.
 FiscalCalendar.DateRange getYearDates(int year)
          Retrieves the start and end dates of a given fiscal year.
 java.util.List<java.lang.Integer> getYears()
          Return a list of the years that are in the Fiscal Calendar, as integers.
 boolean isPeriodOpen(int year, int period)
          Gets whether a fiscal period is open or not
 

Method Detail

getFirstYear

FiscalCalendar.FiscalYear getFirstYear()
returns the first fiscal year in the calendar.

Returns:
a FiscalYear instance for the first year of the program's fiscal calendar, or null if there is none.
See Also:
getLastYear(), getYear(int), getYears()

getLastYear

FiscalCalendar.FiscalYear getLastYear()
returns the last fiscal year in the calendar.

Returns:
a FiscalYear instance for the last year of the program's fiscal calendar, or null if there is none.
See Also:
getFirstYear(), getYear(int), getYears()

getPeriod

FiscalCalendar.FiscalPeriod getPeriod(java.util.Date date)
Locates the fiscal year and period a given date falls on.

Parameters:
date - Date
Returns:
A FiscalPeriod object corresponding to the date given, or null if the date does not appear in the fiscal calendar.

getPeriodDates

FiscalCalendar.DateRange getPeriodDates(int year,
                                        int period)
Retrieves the start and end dates of a given fiscal year and period.

Parameters:
year - Fiscal year.
period - Fiscal period within the fiscal year.
Returns:
null if the fiscal period is not in the calendar and the DateRange if it is

getQuarter

int getQuarter(int year,
               int period)
retrieves the quarter a given fiscal period belongs to.

Parameters:
year - Fiscal year
period - Fiscal period within the year
Returns:
The quarter that the period is in
Throws:
java.lang.IllegalArgumentException - If the fiscal period is not in the fiscal calendar

getQuarterDates

FiscalCalendar.DateRange getQuarterDates(int year,
                                         int quarter)
Retrieves the start and end dates of a given fiscal year and quarter.

Parameters:
year - Fiscal year.
quarter - Quarter within the fiscal year.
Returns:
A DateRange for the quarter, or null if the quarter is not in the fiscal calendar

getYear

FiscalCalendar.FiscalYear getYear(int year)
Looks up a fiscal year in the calendar and retrieves its details.

Parameters:
year - The fiscal year to locate in the fiscal calendar.
Returns:
a FiscalYear record for the specified year of the program's fiscal calendar, or null if it is not found in the calendar.

getYearDates

FiscalCalendar.DateRange getYearDates(int year)
Retrieves the start and end dates of a given fiscal year.

Parameters:
year - Fiscal year.
Returns:
A DateRange for the year, or null if the year is not in the fiscal calendar

getYears

java.util.List<java.lang.Integer> getYears()
Return a list of the years that are in the Fiscal Calendar, as integers.
To use the result, for example, for (Integer i: c.getYears()) System.out.println("Year " + i);

Returns:
a list of Integer

isPeriodOpen

boolean isPeriodOpen(int year,
                     int period)
Gets whether a fiscal period is open or not

Parameters:
year - Fiscal year.
period - Fiscal period within the fiscal year.
Returns:
true if the period is open, false otherwise
Throws:
java.lang.IllegalArgumentException - if the fiscal period is not in the fiscal calendar


Copyright © 2011 Sage Software, Inc. All rights reserved.