← Back to team overview

dhis2-devs team mailing list archive

FiscalYear Period type?

 

Hi there. I was wondering if it would be possible to implement the fiscal
year period type? This meay have come up before, but it seems we may need it
soon.


   - FY 2010 runs from October 1st 2009 through September 30th 2010.
   - FY 2011 is from October 1st 2010 through September 30th 2011.
   - FY 2012 is from October 1st 2011 through September 30th 2012.



I think it would look something like this..perhaps..

    private Period createPeriod( Calendar cal )
    {
        cal.set( Calendar.YEAR, cal.get( Calendar.YEAR ) + cal.get(
Calendar.MONTH ) % 10 );
        cal.set( Calendar.MONTH, Calendar.OCTOBER );
        cal.set( Calendar.DATE, 1 );

        Date startDate = cal.getTime();

        cal.add( Calendar.YEAR, 1 );
        cal.set( Calendar.DAY_OF_YEAR, cal.get( Calendar.DAY_OF_YEAR ) - 1
);

        return new Period( this, startDate, cal.getTime() );
    }

What I am not sure about is all the rest of the methods which need to be in
the API, as well as the aggregation engine. Data will be entered in our case
quarterly, but needs to be aggregated to fiscal years.

Regards.
Jason


-- 
Jason P. Pickering
email: jason.p.pickering@xxxxxxxxx
tel:+260974901293

Follow ups