Friday, February 17, 2012

Date comparison logic in a trigger without hard-coding the year

I'm having trouble trying to figure out how to write logic into a trigger
that will find when a date in the Tax Due Date field, falls in a particular
quarter and was created after a set day of the year without hard-coding the
year information. I'm trying to avoid having to update the trigger.
Scenario: An extract of data for 1st Quarter tax payments is always sent to
the agent on November 7th of the previous year, 2nd Quarter on February 15th
of the same year, 3rd Quarter on May 15th of the same year, and 4th Quarter
on August 15th of the same year. (The extract is always sent out before the
quarter starts to allow for processing/payment before the tax is actually
due.) The Tax Due Date is auto-generated according to different country
laws. I want to send an email to the user whenever they generate a Tax Due
Date that falls into a particular quarter for which the data extract has
already been sent out. Basically if today's date = December 15, 2006 or
January 4, 2007 and a Tax Due Date is generated = February 3, 2007, send an
email because December 15th or January 4th is after November 7th. This woul
d
apply until the day before the same quarter extract is sent out for the
following year, which in this example would be November 6th, 2007. The
extracts are always sent on the same day of the year. Any help would be
greatly appreciated!
--
Finn GirlUse a calendar table.
http://www.aspfaq.com/2519
"FinnGirl" <FinnGirl@.discussions.microsoft.com> wrote in message
news:E888E3D6-EB97-4DBA-B73E-19C6EAA12633@.microsoft.com...
> I'm having trouble trying to figure out how to write logic into a trigger
> that will find when a date in the Tax Due Date field, falls in a
> particular
> quarter and was created after a set day of the year without hard-coding
> the
> year information. I'm trying to avoid having to update the trigger.
> Scenario: An extract of data for 1st Quarter tax payments is always sent
> to
> the agent on November 7th of the previous year, 2nd Quarter on February
> 15th
> of the same year, 3rd Quarter on May 15th of the same year, and 4th
> Quarter
> on August 15th of the same year. (The extract is always sent out before
> the
> quarter starts to allow for processing/payment before the tax is actually
> due.) The Tax Due Date is auto-generated according to different country
> laws. I want to send an email to the user whenever they generate a Tax
> Due
> Date that falls into a particular quarter for which the data extract has
> already been sent out. Basically if today's date = December 15, 2006 or
> January 4, 2007 and a Tax Due Date is generated = February 3, 2007, send
> an
> email because December 15th or January 4th is after November 7th. This
> would
> apply until the day before the same quarter extract is sent out for the
> following year, which in this example would be November 6th, 2007. The
> extracts are always sent on the same day of the year. Any help would be
> greatly appreciated!
> --
> Finn Girl

No comments:

Post a Comment