day ( Date ( M + 1 ; 0 ; Y ) )
where M is the month number and Y is the year.
How about forgetting the "management-by-attendance model" altogether?
Just a thought.
In an ideal world, I would second that, but that ideal world does not exist. So sometimes people just work a bit better with a little extra incentive in the form of an award.
In any case, it's a policy decision that is probably beyond the control of the database guy setting up the solution.
In my experience, when attendance is emphasized (rarely in software dev jobs), it's because real management isn't. As a software developer, who cares if I'm late, work offsite, take a long lunch, as long as I'm productive and get my work done? (Ans: no real manager cares.)
Strict Attendance <> productivity.
Strict Attendance <> morale (maybe the opposite)
However, my experience might not apply to your situation.
But, in my experience, you're solving the wrong problem.
I doubt that they are tracking the attendance patterns of software developers.
Every time you use one calc on more than one record, you must plan to deal with different records yielding the same result.
Besides that, the time I've put into it counts less than what I've put into the time.
Translated from italian: "Non conta il tempo che ci metto, conta cosa ci metto nel tempo."
There are lots of situations where it is needed that people arrive exactly in time for work and that has nothing to do with management skills.
You want your bus/train/plane to arrive exactly on the scheduled time, don't you? In such situations it is not a bad thing to stimulate employees to improve on their attendance record (or maintain their perfect record).
You will need to tell us more about how you are tracking attendance.
Is there strictly one attendance record per day?
Or might there be more records per day. Morning check-in record.
Check in after lunch.
How is attendance recorded?
Yes; Phil's first reply lets you calculate exact number of days in a month.