I need to write a function that will give me a new due date for an invoice. This needs to be 12 working days after the current due date Say the current due date is 01.Oct.2014. If I look at my calendar manually, I can see that the new date would be 17.Oct.2014 (need to exclude weekends).
However, I also have a table with Bank Holidays. This would have to be taken into consideration. So if I would have a Bank Holiday on 04.Oct.2014, the new due date should be 18.Oct.2014.
EDIT: My table with Bank Holidays would look something like this:
Year: Date: Description
2014 04.Oct.2014 Bank Holiday 1
Any help with this would be deeply appreciated, I'm stuck at this for almost a day now.
Thanks a lot in advance.
Kind regards
Gerben
CASE
construct, such that if any of the dates in bank_holidays table is BETWEEN your current_due_date and current_due_date + 12, then add equal number of days for those bank holidays. – Lalit Kumar B