Created
August 7, 2013 14:43
-
-
Save jprystowsky/6174674 to your computer and use it in GitHub Desktop.
CPAs in Ohio are assigned to a reporting group, numbered 1-3, based upon the year in which they became certified. To calculate the next year in which a CPA in Ohio will need to report to the ABO, where the CPA is in group reportingYear and the reference point ("now") is referenceYear, this JavaScript may be used.
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
function getReportingYear(reportingGroup, referenceYear) { | |
function rotateCyclicGroup(cyclic, x) { | |
for (var i = 0; i < x; i++) { | |
cyclic.splice(0, 0, cyclic.pop()); | |
} | |
} | |
var cyclicGroup = [0, 1, 2]; | |
switch (referenceYear % 3) { | |
case 0: | |
{ | |
rotateCyclicGroup(cyclicGroup, 2); | |
break; | |
} | |
case 2: | |
{ | |
rotateCyclicGroup(cyclicGroup, 1); | |
break; | |
} | |
} | |
return referenceYear + cyclicGroup[reportingGroup - 1]; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment