OTWarrior
03-05-2008, 09:47 AM
On our system we keep a record of how many days per year an employee can take for holiday, and we calculate this based on the dates given to us (using datediff).
As the new financial year is coming up, an issue has occured.
the total amount of days is a stored in a table (lets say 20)
when a holiday is booked onto the system, the datediff calculation add it's value to another field in the table (so if going away for a week, the value would be 5).
If an employee wants to have holiday after April 1st, then the value is still added to the original added total. for example, say they have used 19 of their days on 31st march, should they take holiday after April 1st for 5 days, the system says it will take them over to 24 days. What it should do is calculate the total left after this date, making 4 days.
This is unfortunately not created by me, so I am still trying to get my head around why it was done like this:banghead: . How would one of you guys go about this problem?
Would you create a second field in the table to handle the new total?
As the new financial year is coming up, an issue has occured.
the total amount of days is a stored in a table (lets say 20)
when a holiday is booked onto the system, the datediff calculation add it's value to another field in the table (so if going away for a week, the value would be 5).
If an employee wants to have holiday after April 1st, then the value is still added to the original added total. for example, say they have used 19 of their days on 31st march, should they take holiday after April 1st for 5 days, the system says it will take them over to 24 days. What it should do is calculate the total left after this date, making 4 days.
This is unfortunately not created by me, so I am still trying to get my head around why it was done like this:banghead: . How would one of you guys go about this problem?
Would you create a second field in the table to handle the new total?