top of page

77. "You must file for the following years ... "

Description

Based on the last year that an individual made a tax filing, create a list of years that the individual must still make filings for.

Code

(Main Computation)

SET Year-n TO YEAR OF ( LastFiling-d )

// If it has been more that one year since the last filing:
// - the resultant text should read "years"
// - and the list will come from a looping computation
IF (YEAR OF( TODAY ) - 1 ) - YEAR OF( LastFiling-d ) > 1
"You must file for the tax years "
RESULT + FORMAT(( YEAR OF( LastFiling-d ) + 1), "9999")
RESULT + YearList-c

// If it has only been one year since the last filing:
ELSE IF ( YEAR OF( TODAY ) - 1 ) - YEAR OF( LastFiling-d ) = 1
"You must file for the tax year "
RESULT + FORMAT ((YEAR OF(LastFiling-d) + 1), "9999")

// If they are current on their filings:
ELSE
""
END IF


(YearList-c Computation)

""
// Year-n was SET to the year of the last filing.
// We now want to increase its value by one.
SET Year-n TO ( Year-n + 1 )

// If there is more than one year remaining to be listed:
// - add a comma plus the year
IF (( YEAR OF( TODAY ) - 1 ) - Year-n ) > 1
RESULT + ", " + FORMAT (( Year-n + 1 ), "9999")
// Since there is more than one year remaining,
// we need to call YearList-c again
RESULT + YearList-c

// If there is only one year remaining to be listed:
// add " and " plus the "Year"
ELSE IF (( YEAR OF( TODAY ) - 1 ) - Year-n ) = 1
RESULT + " and " + FORMAT(( Year-n + 1 ), "9999")

// If there are no years remaining: done
ELSE
""
END IF

Explanation

This computation is designed to create a list of years for which an individual must make a tax (or other) filing. It is based on the last year that a filing was made. For example, if an individual last filed in 1997, the computation will create this line:

You must file for the tax years 1998, 1999 and 2000

This computation is actually two computations: the main computation (which you will insert in your document where you want the list to appear) and the computation YearList-c, a looping computation which creates the list of years.

The main computation looks at the year when the last filing was made, YEAR OF( LastFiling-d ). Based on how many years have passed since this filing, it will insert either of two text strings: "You must file for the tax year XXXX" if only one filing is required, or "You must file for the tax years" if more than one filing is required. In this case, it then calls the looping computation YearList-c to create the list of years.

YearList-c keeps looping (calling itself) until it has reached YEAR OF( TODAY ). The last year processed is stored in the temporary number variable Year-n (set its Advanced options to "Ask only in dialog," "Don't warn if unanswered," and "Don't save in answer file").

WARNING: Whenever you use a computation that calls itself (such as YearList-c) there is always the possibility that it will throw HotDocs into an eternal loop and lock up. My experience has been if the computation calls itself more than 7-10 times you experience a lock up. Therefore, if you know someone may have entered "1975" as the last Tax Year filed, you would have to build additional safeguards into your looping computation to prevent that from happening.

bottom of page