A request came in today to create a scalar function that would accept a date parameter and return the fiscal period end date for the date provided, the code is below.
On the way to create this, I discovered that we didn't have a 'scalar function template' on this site, so I created that too.
http://dyndeveloper.com/ArticleView.aspx?ArticleID=2741