• Create a calendar table having a record for each day you company has been or will be filing tax reports.

    Not sure if it's good or bad, but there are not so many days we're living through.

    10k rows table will cover >25 years period.

    Create a column for each Week# and Day# you need to calculate.

    Populate it with numbers using whatever method you may think of.

    Cursors, correlated subqueries - it's OK. Performance does not matter as it's one-off exercise.

    Present the table to your finance people for approval.

    If they find some errors in the numbers - correct them manually.

    Index the table and use it in queries like this:

    SELECT [DayNoPerWeek]

    From dbo.FiscalCalendar

    where [Date] = ....

    _____________
    Code for TallyGenerator