Finding Records created in past 30 days
I am trying to create a solution that we can use to track points for employee attendance. I have everything setup to enter the points into the database manually and it seems to be working. If an employee is absent or late, they accrue positive points (this is done manually)
Employee Table -->Points Table
If an employee goes more than 30 days without accumulating any points for being late/absent, they earn 1 point back, up to a max of -2. (So their point’s total, at the most, only be -2 or greater.)
I'm trying to write a script to calculate subtracting points automatically with the following conditions:
- If the employee’s points total is at -2, nothing happens (exit script)
- If the employee has accrued any positive points in the previous 30 days, nothing happens (exit script).
- If the employees total is greater than -2, and there were no records for positive points added in the last 30 days, a new record is created for -1 point.
- I would like this to automatically run every day. Would I need to run the script on the server (it is hosted on FM Server 13)?
I'm not sure how to attack this for conditions 2, 3 and 4. Just looking for some suggestions to point me in the right direction.