-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
added service targets to organisation
- Loading branch information
Showing
10 changed files
with
535 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
function OrganisationService(organisation, options) { | ||
var self = this; | ||
var defaults = { | ||
excludeFinancialYearData : false | ||
}; | ||
|
||
var config = _.defaults(options, defaults); | ||
|
||
self.getBudgetHeaders = function() { | ||
if (config.excludeFinancialYearData) { | ||
return []; // Return a single period header for the organisation | ||
} | ||
var headers = []; | ||
var startYr = moment(organisation.plannedStartDate).format('YYYY'); | ||
var endYr = moment(organisation.plannedEndDate).format('YYYY'); | ||
var startMonth = moment(organisation.plannedStartDate).format('M'); | ||
var endMonth = moment(organisation.plannedEndDate).format('M'); | ||
|
||
//Is startYr is between jan to june? | ||
if(startMonth >= 1 && startMonth <= 6 ){ | ||
startYr--; | ||
} | ||
|
||
//Is the end year is between july to dec? | ||
if(endMonth >= 7 && endMonth <= 12 ){ | ||
endYr++; | ||
} | ||
|
||
var count = endYr - startYr; | ||
for (i = 0; i < count; i++){ | ||
headers.push(startYr + '/' + ++startYr); | ||
} | ||
|
||
return headers; | ||
}; | ||
} |
Oops, something went wrong.