raziel3
Registered User.
- Local time
- Yesterday, 19:31
- Joined
- Oct 5, 2017
- Messages
- 316
Hello everyone,
Still working on my Payroll db and I am looking for a way to make a query to return the total hours worked for weekly employees.
Payroll ends on a Saturday and for each employee I want to generate a report to get the hours worked for each week in a month because statutory deductions are done monthly.
So far I've come up with this to get all the Saturdays in a month and results fills a combobox.
But how do I execute it in the query GUI to look something like this
Payroll is from Sunday to Saturday. If for example, the month starts on a Saturday like January 2022, payroll period will capture all the data between December 26th, 2021 to January 1st, 2022
Still working on my Payroll db and I am looking for a way to make a query to return the total hours worked for weekly employees.
Payroll ends on a Saturday and for each employee I want to generate a report to get the hours worked for each week in a month because statutory deductions are done monthly.
So far I've come up with this to get all the Saturdays in a month and results fills a combobox.
Code:
Private Sub WkEnd()
Me.cboPayEnd.RowSource = ""
Me.cboPayEnd.RowSourceType = "Value List"
BegDate = DateSerial(Me.cboYear, Me.cboMonth, 1)
EndDate = DateSerial(Me.cboYear, Me.cboMonth2 + 1, 0)
For intDay = BegDate To EndDate
If Weekday(intDay) = vbSaturday Then
Me.cboPayEnd.AddItem Format(intDay, "Medium Date")
End If
Next intDay
End Sub
But how do I execute it in the query GUI to look something like this
Code:
+-----+---------------+--------------+--------------+-----------+
| EID | SumOfSTDHours | SumOfDTHours | SumOfOTHours | WKEnd |
+-----+---------------+--------------+--------------+-----------+
| 13 | 37 | 0 | 0 | 1/1/2022 |
| 13 | 47.25 | 0 | 0 | 8/1/2022 |
| 13 | 54.25 | 0 | 0 | 15/1/2022 |
| 13 | 45 | 0 | 0 | 22/1/2022 |
| 13 | 37 | 0 | 0 | 29/1/2022 |
| 14 | 40 | 0 | 0 | 1/1/2022 |
| 14 | 46 | 0 | 0 | 8/1/2022 |
| 14 | 47.25 | 0 | 0 | 15/1/2022 |
| 14 | 47 | 0 | 0 | 22/1/2022 |
| 14 | 47.75 | 0 | 0 | 29/1/2022 |
| 15 | 48 | 0 | 0 | 1/1/2022 |
| 15 | 40 | 0 | 0 | 8/1/2022 |
| 15 | 47 | 0 | 0 | 15/1/2022 |
| 15 | 48 | 0 | 0 | 22/1/2022 |
| 15 | 40 | 0 | 0 | 29/1/2022 |
+-----+---------------+--------------+--------------+-----------+
Payroll is from Sunday to Saturday. If for example, the month starts on a Saturday like January 2022, payroll period will capture all the data between December 26th, 2021 to January 1st, 2022