Hi everyone
I am working on a project and have run into some issues. I am creating a monthly report that automatically fills in the hours that an individual works for a month depending on the Employee Type. All the user has to do is pick the month and his employee type and the time **** for that month come up. My problem is I want to have Sunday and Saturday automatically be set to "OFF" and just can't get this to work. Can some please help. How can I get my IsWorkDay function work in my PrintDays function
Here are my functions
Public
Function IsWorkDay(ByVal currentDay As Date) As Boolean
Dim bSpecialDay As Boolean = Me.SpecialDays.Contains(ConvertDateToInt(currentDay))Select Case currentDay.DayOfWeekCase DayOfWeek.Monday, DayOfWeek.Tuesday, DayOfWeek.Wednesday, DayOfWeek.Thursday, DayOfWeek.FridayReturn Not bSpecialDayCase DayOfWeek.Saturday, DayOfWeek.SundayReturn bSpecialDayEnd Select
End Function
Public Shared Function ConvertDateToInt(ByVal dt As Date) As Int32Return dt.Year * 10000 + dt.Month * 100 + dt.DayEnd Function
Private Function CheckLeap(ByVal year As Integer) As Boolean
If (year Mod 4 = 0) And (year Mod 100 <> 0) Or (year Mod 400 = 0) Then
Return True
Else
Return False
End If
End Function
Public Function PrintDays(ByVal month As Integer, ByVal year As Integer, ByVal EmpType As String, ByVal sStartDate As Date) As Integer
d = System.DateTime.Today
Dim d As DateTimeDim i As Integer
month = DDList1.SelectedValue
EmpType = DDList2.SelectedValue
Dim AlDays As New ArrayListDim Civilian As String = "1"
Dim iCivilian As Integer = Integer.Parse(Civilian)Dim Uniform As String = "2"
Dim iUniform As Integer = Integer.Parse(Uniform)Dim CommSpec As String = "3"
Dim iONDD As Integer = Integer.Parse(CommSpec)Dim Schedule As String = "4"
Dim iShift As Integer = Integer.Parse(Schedule)Dim January As String = "1"
Dim M1 As Integer = Integer.Parse(January)'dl = New DropDownList
dt =
New DataTable'Adding Columns to GridView
dt.Columns.Add(
dt.Columns.Add(
dt.Columns.Add(
dt.Columns.Add(
dt.Columns.Add(
dt.Columns.Add(
dt.Columns.Add(
dt.Columns.Add(
dt.Columns.Add(
dt.Columns.Add(
dt.Columns.Add(
dr = dt.NewRow()
New DataColumn("Date", GetType(Integer)))New DataColumn("Hours On Duty", GetType(Double)))New DataColumn("Unpaid O.T", GetType(Double)))New DataColumn("Paid O.T", GetType(Double)))New DataColumn("Admin", GetType(Double)))New DataColumn("Court", GetType(Double)))New DataColumn("INSTR", GetType(Double)))New DataColumn("STDNT", GetType(Double)))New DataColumn("COMM SERV", GetType(Double)))New DataColumn("VICT SERV", GetType(Double)))New DataColumn("Remarks", GetType(String)))Select Case monthCase 1, 3, 5, 7, 8, 10, 12For i = 1 To 31If DDList2.SelectedValue = Uniform Then
dr(1) = 10.0
dr(4) = 10.0
Else
If DDList2.SelectedValue = Civilian Then
dr(1) = 7.5
dr(4) = 7.5
Else
If DDList2.SelectedValue = CommSpec Then
dr(1) = 10.0
dr(4) = 10.0
Else
If DDList2.SelectedValue = Schedule Then
dr(1) = 9.5
dr(4) = 9.5
End If
End If
End If
End If
dt.Rows.Add(dr)
Next
Case 2 If CheckLeap(year) Then
dr = dt.NewRow()
dr(0) = i
dr(1) = 0.0
For i = 1 To 28 If DDList2.SelectedValue = Uniform Then
dr(1) = 10.0
dr(4) = 10.0
Else
If DDList2.SelectedValue = Civilian Then
dr(1) = 7.5
dr(4) = 7.5
Else
If DDList2.SelectedValue = CommSpec Then
dr(1) = 10.0
dr(4) = 10.0
Else
If DDList2.SelectedValue = Schedule Then
dr(1) = 9.5
dr(4) = 9.5
End If
End If
End If
End If
dt.Rows.Add(dr)
Next
Else
dr = dt.NewRow()
dr(0) = i
dr(1) = 0.0
For i = 1 To 29 If DDList2.SelectedValue = Uniform Then
dr(1) = 10.0
dr(4) = 10.0
Else
If DDList2.SelectedValue = Civilian Then
dr(1) = 7.5
dr(4) = 7.5
Else
If DDList2.SelectedValue = CommSpec Then
dr(1) = 10.0
dr(4) = 10.0
Else
If DDList2.SelectedValue = Schedule Then
dr(1) = 9.5
dr(4) = 9.5
End If
End If
End If
End If
dt.Rows.Add(dr)
Next
End If
dr = dt.NewRow()
Case 4, 6, 9, 11 For i = 1 To 30 If DDList2.SelectedValue = Uniform Then
dr(1) = 10.0
dr(4) = 10.0
Else
If DDList2.SelectedValue = Civilian Then
dr(1) = 7.5
dr(4) = 7.5
Else
If DDList2.SelectedValue = CommSpec Then
dr(1) = 10.0
dr(4) = 10.0
Else
If DDList2.SelectedValue = Schedule Then
dr(1) = 9.5
dr(4) = 9.5
End If
End If
End If
End If
dt.Rows.Add(dr)
Next
End Select
GridView1.DataSource =
GridView1.DataBind()
New DataView(dt)End Function