Hi,
Has anyone come up with a way to change the shift ID when an employee is clocking in if they clock in outside their shift? I notice that Epicor always defaults to the employees shift. We have 4 different shifts in Epicor at the moment. 7-330, 8-430, 330-12, 430-1.
If an employees default shift is 8-430 and they are asked to work second shift (430-1), when they clock in I want it to default the 430-1 shift ID rather than the shift ID on the employees record because I cant rely on them to change the shift here.
Any ideas appreciated, I have been playing around with it and on the shift select form's load event this is what I have come up with so far.
Private Sub ShiftSelect_Load(ByVal sender As Object, ByVal args As EventArgs)
' Add Event Handler Code
Dim TimeNow As DateTime = Now()
Dim hrs As Integer = TimeNow.Hour
Dim mins As Integer = TimeNow.Minute
Dim curTime As Decimal = Math.Round(hrs + (mins / 60), 2)
Dim empID As String = ShiftSelect.Session.EmployeeID
Dim EmpAdapter As EmpBasicAdapter = New EmpBasicAdapter(ShiftSelect)
EmpAdapter.BOConnect()
empAdapter.GetByID(empID)
Dim _empDS As EmpBasicDataSet = EmpAdapter.EmpBasicData
Dim empShift As Integer = _empDS.Tables(0).Rows(0)("Shift")
Dim shift As Integer = 0
Dim opts2 As New SearchOptions(Epicor.Mfg.UI.Searches.SearchMode.AutoSearch)
opts2.DataSetMode = DataSetMode.ListDataSet
opts2.SortDescending = true
opts2.PreLoadSearchFilter = "Company = '" + ShiftSelect.Session.CompanyID + "'"
Dim callResult As Object = ProcessCaller.LaunchSearch(ShiftSelect, "JCShiftAdapter", opts2)
If(TypeOf callResult Is System.Data.DataSet) AndAlso (DirectCast(callResult, DataSet).Tables(0).Rows.Count > 0) Then
For i As Integer = 0 To callResult.Tables(0).Rows.Count - 1
If callResult.Tables(0).Rows(i)("Shift") <> 99 Then
If curTime >= callResult.Tables(0).Rows(i)("StartTime") Then
shift = callResult.Tables(0).Rows(i)("Shift")
If empShift >= 1 And empShift <= 2 And shift >=1 And shift <= 2 Then
shift = empShift
ElseIf empShift >= 3 And empShift <= 4 And shift >=3 And shift <= 4 Then
shift = empShift
End If
Exit For
End If
End If
Next
End If
Dim txtShift As EpiTextBox = CType(csm.GetNativeControlReference("7b392f8b-7314-4695-b096-5af8236169c7"), EpiTextBox)
If shift = 0 Then
txtShift.Text = empShift
Else
txtShift.Text = shift
End If
empAdapter.Dispose()
End Sub
Thanks,
-Ted
Has anyone come up with a way to change the shift ID when an employee is clocking in if they clock in outside their shift? I notice that Epicor always defaults to the employees shift. We have 4 different shifts in Epicor at the moment. 7-330, 8-430, 330-12, 430-1.
If an employees default shift is 8-430 and they are asked to work second shift (430-1), when they clock in I want it to default the 430-1 shift ID rather than the shift ID on the employees record because I cant rely on them to change the shift here.
Any ideas appreciated, I have been playing around with it and on the shift select form's load event this is what I have come up with so far.
Private Sub ShiftSelect_Load(ByVal sender As Object, ByVal args As EventArgs)
' Add Event Handler Code
Dim TimeNow As DateTime = Now()
Dim hrs As Integer = TimeNow.Hour
Dim mins As Integer = TimeNow.Minute
Dim curTime As Decimal = Math.Round(hrs + (mins / 60), 2)
Dim empID As String = ShiftSelect.Session.EmployeeID
Dim EmpAdapter As EmpBasicAdapter = New EmpBasicAdapter(ShiftSelect)
EmpAdapter.BOConnect()
empAdapter.GetByID(empID)
Dim _empDS As EmpBasicDataSet = EmpAdapter.EmpBasicData
Dim empShift As Integer = _empDS.Tables(0).Rows(0)("Shift")
Dim shift As Integer = 0
Dim opts2 As New SearchOptions(Epicor.Mfg.UI.Searches.SearchMode.AutoSearch)
opts2.DataSetMode = DataSetMode.ListDataSet
opts2.SortDescending = true
opts2.PreLoadSearchFilter = "Company = '" + ShiftSelect.Session.CompanyID + "'"
Dim callResult As Object = ProcessCaller.LaunchSearch(ShiftSelect, "JCShiftAdapter", opts2)
If(TypeOf callResult Is System.Data.DataSet) AndAlso (DirectCast(callResult, DataSet).Tables(0).Rows.Count > 0) Then
For i As Integer = 0 To callResult.Tables(0).Rows.Count - 1
If callResult.Tables(0).Rows(i)("Shift") <> 99 Then
If curTime >= callResult.Tables(0).Rows(i)("StartTime") Then
shift = callResult.Tables(0).Rows(i)("Shift")
If empShift >= 1 And empShift <= 2 And shift >=1 And shift <= 2 Then
shift = empShift
ElseIf empShift >= 3 And empShift <= 4 And shift >=3 And shift <= 4 Then
shift = empShift
End If
Exit For
End If
End If
Next
End If
Dim txtShift As EpiTextBox = CType(csm.GetNativeControlReference("7b392f8b-7314-4695-b096-5af8236169c7"), EpiTextBox)
If shift = 0 Then
txtShift.Text = empShift
Else
txtShift.Text = shift
End If
empAdapter.Dispose()
End Sub
Thanks,
-Ted