Where are you storing the "current year" in use?

Is this all in a database?

How do you expect to get the "last sequence number" that was used for the year desired?

Note that we do exactly what you are asking in our financial applications - but without know a bit more about your situation it would be useless for me to show you how we accomplish this.