Sub uf9c_ok1()
Dim i
Dim crew1, mno, ini As String
Dim arrCtrls
Dim fnd_row, fnd_trow, ref_row As Integer
Dim ws_wstofnd As Worksheet
Dim empno
If uf9_poststaff.mp1_cupe.Value = True Then 'CUPE PAGE
uf9_poststaff.MultiPage1.Value = 1
ElseIf uf9_poststaff.mp1_student.Value = True Then 'STUDENT PAGE
uf9_poststaff.MultiPage1.Value = 2
ElseIf uf9_poststaff.mp1_wloopk.Value = True Then 'STUDENT PAGE
uf9_poststaff.MultiPage1.Value = 3
ElseIf uf9_poststaff.mp1_trim.Value = True Then 'STUDENT PAGE
uf9_poststaff.MultiPage1.Value = 4
Else 'MAIN PAGE
uf9_poststaff.MultiPage1.Value = 0
End If
With uf9_poststaff
.MultiPage1.Width = 408
If uf9_poststaff.mp1_cupe.Value = True Then 'CUPE PAGE
arrCtrls = Array("CU1", "CU2", "CUA", "CUB", "CUC", "CUD", "CUE", "CUF", "CU7", "CU6", "CU5", "CU4", "CU8", "WPRK1", "WBLVD1")
ElseIf uf9_poststaff.mp1_student.Value = True Then 'SPORTS PAGE
arrCtrls = Array("FLD1A", "FLD1B", "FLD2A", "FLD2B", "BPA", "BPB", "BPC", "HPA", "HPB", "HPC", "WPA", "WPB", "WPC", "RPA", "RPB", "RPC")
ElseIf uf9_poststaff.mp1_wloopk.Value = True Then 'WLOOPK PAGE
arrCtrls = Array("ZOO1A", "ZOO1B", "ZOO2A", "ZOO2B", "SEA", "SEB", "SEC", "PTA", "PTB", "PTC", "PTD")
ElseIf uf9_poststaff.mp1_trim.Value = True Then 'TRIM PAGE
arrCtrls = Array("WPRKA", "WPRKB", "WBLVDA", "WBLVDB")
End If
For i = LBound(arrCtrls) To UBound(arrCtrls)
crew1 = arrCtrls(i)
fnd_row = Application.WorksheetFunction.Match(crew1, ws_rstr.Columns(7), 0)
empno = ws_rstr.Cells(fnd_row, 1)
mno = ws_rstr.Cells(fnd_row, 5)
If empno = "0" Then
fnd_trow = Application.WorksheetFunction.Match(arrCtrls(i), ws_psfront.Columns(8), 0)
Else
fnd_trow = Application.WorksheetFunction.Match(empno, ws_psfront.Columns(5), 0)
End If
ini = ws_psfront.Cells(fnd_trow, 10)
wstofnd = Format(empno, "00000") & " " & ini
Set ws_wstofnd = wb_pstaff.Worksheets(wstofnd)
Debug.Print ws_wstofnd.Name
With ws_wstofnd
ref_row = Application.WorksheetFunction.Match(CLng(usd), .Columns(2), 0)
End With
With uf9_poststaff
.Controls(crew1 & "_en").Caption = Format(empno, "00000")
.Controls(crew1 & "_name").Value = mno
.Controls(crew1 & "_start").Value = Format(ws_wstofnd.Cells(ref_row, 3), "h:mm am/pm")
.Controls(crew1 & "_startbu").Value = Format(ws_wstofnd.Cells(ref_row, 3), "h:mm am/pm")
.Controls(crew1 & "_end").Value = Format(ws_wstofnd.Cells(ref_row, 4), "h:mm am/pm")
.Controls(crew1 & "_endbu").Value = Format(ws_wstofnd.Cells(ref_row, 3), "h:mm am/pm")
.Controls(crew1 & "_hours").Value = Format(ws_wstofnd.Cells(ref_row, 5), "0.00")
.Controls(crew1 & "_notes").Value = ws_wstofnd.Cells(ref_row, 7)
.Controls(crew1 & "_notesbu").Value = ws_wstofnd.Cells(ref_row, 7)
If Not IsNumeric(ws_wstofnd.Cells(ref_row, 8)) = True Then
.Controls(crew1 & "_en").BackColor = RGB(51, 204, 51)
.Controls(crew1 & "_start").Locked = True
.Controls(crew1 & "_end").Locked = True
.Controls(crew1 & "_notes").Locked = True
allgreen = allgreen + 1
'.tb_allgreen.Value = allgreen
If .MultiPage1.Value = 1 Then
cupegreen = cupegreen + 1
.tb_cupegreen.Value = cupegreen
.tb_allgreen1.Value = allgreen
ElseIf .MultiPage1.Value = 2 Then
sportsgreen = sportsgreen + 1
.tb_sportsgreen.Value = sportsgreen
.tb_allgreen2.Value = allgreen
ElseIf .MultiPage1.Value = 3 Then
wloopkgreen = wloopkgreen + 1
.tb_wloopkgreen.Value = wloopkgreen
.tb_allgreen3.Value = allgreen
ElseIf .MultiPage1.Value = 4 Then
trimgreen = trimgreen + 1
.tb_trimgreen.Value = trimgreen
.tb_allgreen4.Value = allgreen
End If
End If
End With
Next i
End With
With uf9_poststaff
.Label807.Visible = False
.Label834.Visible = True
.todaysdate.Visible = False
.processdate.Visible = True
.processdate.Value = Format(usd, "dddd, mmmm dd, yyyy")
End With
Unload uf9c_idate
MsgBox "Always make changes to the shift START times (if applicable) before" & Chr(13) & "making changes to the shift END times." & Chr(13) & "To mark an absence, enter the same shift START time" & Chr(13) & "into the shift END time.", vbInformation, "NOTICE"
End Sub