Hi Everyone,
Trying to figure out the query or formula which calculate the employee attendance based on point system, our company recently introduce the point system which track the employees attendance.
The attendance policy is, When an employee Absent he will get a point, and if tardy or arrive late will get 1/2 point. Employee can get a point credit if he/she has perfect attendance in 90 days of the last absent date. and if employee get another absent within the 90 days, his/her 90 days period start with last absent date and the first absent stays till next year
here is one scenario
<tbody>
</tbody>
So, far I have created the following.
Tables
Employees: Employee_ID, Last_Name, First_Name
Points: Point_ID, Point_Description, Point_value
Attendance: Attend_ID, Attend_Date, ID_Employee, ID_Point.
QUERY POINTBALANCE_SUB1
SELECT Attendance.ID_Employee, Attendance.Attend_Date, DMax("[Attend_Date]","Attendance","[ID_Employee]=" & [ID_Employee] & " AND [Attend_Date]<#" & [Attend_Date] & "#") AS LastInfraction, iif(isnull(LastInfraction), Attend_Date, DateValue(LastInfraction)) AS cal, iif((Attend_Date - cal) >=90, 0, 1) AS Point_Value, Attend_Date+90 AS NextInfraction
FROM Attendance, Points
WHERE Attendance.ID_Point = Points.Point_ID
ORDER BY Attendance.ID_Employee, Attendance.Attend_Date;
POINTBALANCE_SUB2
SELECT Employees.Employee_ID, Employees.First_Name, Employees.Last_Name, Sum(PointBalance_sub1.Point_Value) AS SumOfPoint_Value
FROM Employees INNER JOIN PointBalance_sub1 ON Employees.Employee_ID = PointBalance_sub1.ID_Employee
GROUP BY Employees.Employee_ID, Employees.First_Name, Employees.Last_Name;
The only issue I have with the yearly point, I am unable figure out how I will calculate using the right formula. will anyone help me out.
Thanks in Advance
Trying to figure out the query or formula which calculate the employee attendance based on point system, our company recently introduce the point system which track the employees attendance.
The attendance policy is, When an employee Absent he will get a point, and if tardy or arrive late will get 1/2 point. Employee can get a point credit if he/she has perfect attendance in 90 days of the last absent date. and if employee get another absent within the 90 days, his/her 90 days period start with last absent date and the first absent stays till next year
here is one scenario
Attandance Date | Credit Date | ||||
<tbody> </tbody> | 6/1/2015 get credit | ||||
07/1/2014 |
<tbody> </tbody> | ||||
08/01/2014 |
<tbody> </tbody> | ||||
12/01/2014 |
<tbody> </tbody> | ||||
12/24/2014 |
<tbody> </tbody> |
<tbody>
</tbody>
So, far I have created the following.
Tables
Employees: Employee_ID, Last_Name, First_Name
Points: Point_ID, Point_Description, Point_value
Attendance: Attend_ID, Attend_Date, ID_Employee, ID_Point.
QUERY POINTBALANCE_SUB1
SELECT Attendance.ID_Employee, Attendance.Attend_Date, DMax("[Attend_Date]","Attendance","[ID_Employee]=" & [ID_Employee] & " AND [Attend_Date]<#" & [Attend_Date] & "#") AS LastInfraction, iif(isnull(LastInfraction), Attend_Date, DateValue(LastInfraction)) AS cal, iif((Attend_Date - cal) >=90, 0, 1) AS Point_Value, Attend_Date+90 AS NextInfraction
FROM Attendance, Points
WHERE Attendance.ID_Point = Points.Point_ID
ORDER BY Attendance.ID_Employee, Attendance.Attend_Date;
POINTBALANCE_SUB2
SELECT Employees.Employee_ID, Employees.First_Name, Employees.Last_Name, Sum(PointBalance_sub1.Point_Value) AS SumOfPoint_Value
FROM Employees INNER JOIN PointBalance_sub1 ON Employees.Employee_ID = PointBalance_sub1.ID_Employee
GROUP BY Employees.Employee_ID, Employees.First_Name, Employees.Last_Name;
The only issue I have with the yearly point, I am unable figure out how I will calculate using the right formula. will anyone help me out.
Thanks in Advance