Does your form already query the database? Can you export the database file to an XML resource form and include in your form's template? If so, you should be able to do this without code. You can use rules and a count function to iteratively walk through from one date to another and add the value for each one. Check out Jo-Anne's recent download on how to iteratively copy values from a SharePoint list to a form. Same technique but instead of copying, you are just adding values and decrementing the count.
Good luck!
Note: eval(eval(...)) technique probably wouldn't work here since your database XML file will have all 365 days in it and it needs to go from one to another. Also note: you'll need to have a day for Feb 29 during leap years which means you probably need to just create an XML resource with 4 year's worth of work/holidays in it and start on the right year (add 1 if (current year minus 2008 mod 4) is equal to zero)