602 lines
18 KiB
Plaintext
602 lines
18 KiB
Plaintext
VERSION 5.00
|
|
Begin VB.Form frmCrewList
|
|
Caption = "Payroll List"
|
|
ClientHeight = 5865
|
|
ClientLeft = 60
|
|
ClientTop = 345
|
|
ClientWidth = 9030
|
|
ControlBox = 0 'False
|
|
KeyPreview = -1 'True
|
|
LinkTopic = "Form1"
|
|
MaxButton = 0 'False
|
|
ScaleHeight = 5865
|
|
ScaleWidth = 9030
|
|
StartUpPosition = 3 'Windows Default
|
|
Begin VB.TextBox txtWCCODE
|
|
Height = 285
|
|
Left = 7950
|
|
TabIndex = 14
|
|
Top = 4890
|
|
Visible = 0 'False
|
|
Width = 510
|
|
End
|
|
Begin VB.TextBox txtDept
|
|
Height = 375
|
|
Left = 6480
|
|
TabIndex = 13
|
|
TabStop = 0 'False
|
|
Top = 5340
|
|
Visible = 0 'False
|
|
Width = 1095
|
|
End
|
|
Begin VB.TextBox txtEmpName
|
|
Height = 315
|
|
Left = 5100
|
|
TabIndex = 12
|
|
TabStop = 0 'False
|
|
Top = 4800
|
|
Visible = 0 'False
|
|
Width = 1995
|
|
End
|
|
Begin VB.CommandButton cmdAddName
|
|
Caption = "Add by Last Name"
|
|
BeginProperty Font
|
|
Name = "MS Sans Serif"
|
|
Size = 8.25
|
|
Charset = 0
|
|
Weight = 700
|
|
Underline = 0 'False
|
|
Italic = 0 'False
|
|
Strikethrough = 0 'False
|
|
EndProperty
|
|
Height = 555
|
|
Left = 180
|
|
TabIndex = 11
|
|
TabStop = 0 'False
|
|
Top = 5280
|
|
Width = 1275
|
|
End
|
|
Begin VB.CommandButton cmdExit
|
|
Caption = "&Exit"
|
|
BeginProperty Font
|
|
Name = "MS Sans Serif"
|
|
Size = 8.25
|
|
Charset = 0
|
|
Weight = 700
|
|
Underline = 0 'False
|
|
Italic = 0 'False
|
|
Strikethrough = 0 'False
|
|
EndProperty
|
|
Height = 555
|
|
Left = 3300
|
|
TabIndex = 5
|
|
Top = 4620
|
|
Width = 1275
|
|
End
|
|
Begin VB.TextBox txtEmpId
|
|
Height = 375
|
|
Left = 5100
|
|
TabIndex = 8
|
|
TabStop = 0 'False
|
|
Top = 5340
|
|
Visible = 0 'False
|
|
Width = 1215
|
|
End
|
|
Begin VB.ListBox lstCrew
|
|
Height = 3765
|
|
Left = 4680
|
|
Sorted = -1 'True
|
|
TabIndex = 6
|
|
TabStop = 0 'False
|
|
Top = 780
|
|
Width = 4215
|
|
End
|
|
Begin VB.CommandButton cmdDelete
|
|
Caption = "&Delete Member"
|
|
BeginProperty Font
|
|
Name = "MS Sans Serif"
|
|
Size = 8.25
|
|
Charset = 0
|
|
Weight = 700
|
|
Underline = 0 'False
|
|
Italic = 0 'False
|
|
Strikethrough = 0 'False
|
|
EndProperty
|
|
Height = 555
|
|
Left = 3300
|
|
TabIndex = 4
|
|
Top = 5280
|
|
Width = 1275
|
|
End
|
|
Begin VB.CommandButton cmdAdd
|
|
Caption = "&Add by Number"
|
|
BeginProperty Font
|
|
Name = "MS Sans Serif"
|
|
Size = 8.25
|
|
Charset = 0
|
|
Weight = 700
|
|
Underline = 0 'False
|
|
Italic = 0 'False
|
|
Strikethrough = 0 'False
|
|
EndProperty
|
|
Height = 555
|
|
Left = 180
|
|
TabIndex = 3
|
|
Top = 4620
|
|
Width = 1275
|
|
End
|
|
Begin VB.ListBox lstPayCrews
|
|
Height = 3765
|
|
Left = 180
|
|
TabIndex = 1
|
|
Top = 780
|
|
Width = 4455
|
|
End
|
|
Begin VB.Label lblCrewName
|
|
BorderStyle = 1 'Fixed Single
|
|
BeginProperty Font
|
|
Name = "MS Sans Serif"
|
|
Size = 8.25
|
|
Charset = 0
|
|
Weight = 700
|
|
Underline = 0 'False
|
|
Italic = 0 'False
|
|
Strikethrough = 0 'False
|
|
EndProperty
|
|
Height = 315
|
|
Left = 1320
|
|
TabIndex = 10
|
|
Top = 180
|
|
Width = 2535
|
|
End
|
|
Begin VB.Label lblCrewId
|
|
Alignment = 1 'Right Justify
|
|
BorderStyle = 1 'Fixed Single
|
|
BeginProperty Font
|
|
Name = "MS Sans Serif"
|
|
Size = 8.25
|
|
Charset = 0
|
|
Weight = 700
|
|
Underline = 0 'False
|
|
Italic = 0 'False
|
|
Strikethrough = 0 'False
|
|
EndProperty
|
|
Height = 315
|
|
Left = 600
|
|
TabIndex = 9
|
|
Top = 180
|
|
Width = 675
|
|
End
|
|
Begin VB.Label lblCrewInstruct
|
|
Caption = "Double Click or CTRL S on the desired Crew Member listed below to add the Crew Member to the Crew List"
|
|
BeginProperty Font
|
|
Name = "MS Sans Serif"
|
|
Size = 8.25
|
|
Charset = 0
|
|
Weight = 700
|
|
Underline = 0 'False
|
|
Italic = 0 'False
|
|
Strikethrough = 0 'False
|
|
EndProperty
|
|
Height = 615
|
|
Left = 5040
|
|
TabIndex = 7
|
|
Top = 60
|
|
Width = 3435
|
|
End
|
|
Begin VB.Label lblCrew
|
|
AutoSize = -1 'True
|
|
Caption = "Crew Member List"
|
|
BeginProperty Font
|
|
Name = "MS Sans Serif"
|
|
Size = 8.25
|
|
Charset = 0
|
|
Weight = 700
|
|
Underline = 0 'False
|
|
Italic = 0 'False
|
|
Strikethrough = 0 'False
|
|
EndProperty
|
|
Height = 195
|
|
Left = 240
|
|
TabIndex = 2
|
|
Top = 540
|
|
Width = 1515
|
|
End
|
|
Begin VB.Label lblCrw
|
|
Alignment = 1 'Right Justify
|
|
AutoSize = -1 'True
|
|
Caption = "Crew:"
|
|
Height = 195
|
|
Left = 120
|
|
TabIndex = 0
|
|
Top = 240
|
|
Width = 405
|
|
End
|
|
End
|
|
Attribute VB_Name = "frmCrewList"
|
|
Attribute VB_GlobalNameSpace = False
|
|
Attribute VB_Creatable = False
|
|
Attribute VB_PredeclaredId = True
|
|
Attribute VB_Exposed = False
|
|
Option Explicit
|
|
Dim moRSCREW As Recordset
|
|
Dim moRSMember As Recordset
|
|
|
|
Dim mboolAdding As Boolean
|
|
|
|
Private Sub GetCrew()
|
|
Dim strCREW As String
|
|
Dim oRS As Recordset
|
|
|
|
strCREW = "SELECT * FROM tblCrew where CREW_id = " & gintCREWID
|
|
Set oRS = New Recordset
|
|
oRS.Open strCREW, goConn, adOpenKeyset, adLockOptimistic
|
|
|
|
If Not oRS.EOF Then
|
|
lblCrewId.Caption = gintCREWID
|
|
lblCrewName.Caption = oRS!Crew_Boss
|
|
Else
|
|
MsgBox "No Crew Was Found - Member Add Not Valid", vbOKOnly, "No Crew"
|
|
Unload Me
|
|
End If
|
|
|
|
End Sub
|
|
|
|
Private Sub GetMember()
|
|
Dim strCREW As String, strName As String
|
|
' If gboolMAS90 Then
|
|
' MsgBox "No MAS90 Database on this computer", vbOKOnly, "No MAS90"
|
|
' Exit Sub
|
|
' End If
|
|
strName = Format(Field2Str(lstCrew.ItemData(lstCrew.ListIndex)), "0000000")
|
|
strCREW = "SELECT * FROM PR1_EmployeeMaster where EmployeeNumber = '" & strName & "'"
|
|
' strCREW = "SELECT Department, employeenumber, firstname, lastname, EmployeeStatus_AIT FROM PR1_EmployeeMaster where department = '52' and EmployeeNumber = '0004107'" '& strName & "'"
|
|
Set moRSMember = New Recordset
|
|
moRSMember.Open strCREW, goConn, adOpenKeyset, adLockOptimistic
|
|
' moRSMember.Open strCREW, goConn2, adOpenKeyset, adLockOptimistic
|
|
If moRSMember!Terminated <> "A" Then
|
|
MsgBox "This Employee is Terminated - Be Sure To Correct Before Entering Payroll", vbOKOnly, "Terminated Employee"
|
|
End If
|
|
|
|
If moRSMember.EOF Then
|
|
MsgBox "Critial Error - No Crew Member Found - Call Darv", vbCritical + vbOKOnly, "Critical Error"
|
|
Unload Me
|
|
End If
|
|
|
|
End Sub
|
|
|
|
Private Sub cmdAdd_Click()
|
|
Dim intID As Double, strSQL As String, strID As String
|
|
Dim oRS As Recordset
|
|
cmdAdd.Enabled = False
|
|
cmdAddName.Enabled = False
|
|
cmdDelete.Enabled = False
|
|
'Code to Add a Crew
|
|
mboolAdding = True
|
|
intID = Field2Double(InputBox("Enter The Employee Number To Add", "Employee Number", 9999))
|
|
If intID = 0 Then
|
|
cmdAdd.Enabled = True
|
|
cmdAddName.Enabled = True
|
|
cmdDelete.Enabled = True
|
|
cmdAdd.SetFocus
|
|
Exit Sub
|
|
End If
|
|
If Len(intID) > 0 Then
|
|
' If gboolMAS90 Then
|
|
' MsgBox "No MAS90 Database on this computer", vbOKOnly, "No MAS90"
|
|
' Exit Sub
|
|
' End If
|
|
strID = Format(intID, "0000000")
|
|
' strSQL = "SELECT Department, EmployeeNumber, LastName, FirstName, DefaultWCCode, Terminated FROM PR1_EmployeeMaster WHERE EmployeeNumber = '" & strID & "'"
|
|
strSQL = "SELECT * FROM PR1_EmployeeMaster WHERE EmployeeNumber = '" & strID & "'"
|
|
Set oRS = New Recordset
|
|
oRS.Open strSQL, goConn, adOpenKeyset, adLockOptimistic
|
|
' oRS.Open strSQL, goConn2, adOpenKeyset, adLockOptimistic
|
|
If oRS.EOF Then
|
|
Call CrewLoad
|
|
Else
|
|
txtEmpId = Field2Str(oRS!EmployeeNumber)
|
|
txtDept = Field2Str(oRS!department)
|
|
txtEmpName = Trim$(Field2Str(oRS!FirstName)) & " " & Trim$(Field2Str(oRS!LastName))
|
|
txtWCCode = Field2Str(oRS!wc_code)
|
|
If oRS!Terminated <> "A" Then
|
|
MsgBox "This Employee is Terminated - Be Sure To Correct Before Entering Payroll", vbOKOnly, "Terminated Employee"
|
|
End If
|
|
Call FormSave
|
|
cmdAdd.Enabled = True
|
|
cmdAddName.Enabled = True
|
|
cmdDelete.Enabled = True
|
|
cmdAdd.SetFocus
|
|
End If
|
|
|
|
End If
|
|
|
|
End Sub
|
|
|
|
Private Sub cmdAddName_Click()
|
|
Dim strName As String, strSQL As String, strLine As String
|
|
Dim strSql2 As String, strSQL3 As String
|
|
Dim oRS As Recordset
|
|
|
|
' If gboolMAS90 Then
|
|
' MsgBox "No MAS90 Database on this computer", vbOKOnly, "No MAS90"
|
|
' Exit Sub
|
|
' End If
|
|
cmdAdd.Enabled = False
|
|
cmdAddName.Enabled = False
|
|
cmdDelete.Enabled = False
|
|
'Code to Add a Crew
|
|
mboolAdding = True
|
|
strName = InputBox("Enter The Employee Last Name To Add", "Employee Last Name")
|
|
If Len(strName) > 0 Then
|
|
strName = "lastname LIKE '" & Trim$(UCase(strName)) & "*'"
|
|
strSQL = "SELECT * FROM PR1_EmployeeMaster"
|
|
' strSQL = "SELECT Department, EmployeeNumber, LastName, DefaultWCCode, FirstName FROM PR1_EmployeeMaster"
|
|
Set oRS = New Recordset
|
|
oRS.Open strSQL, goConn, adOpenKeyset, adLockOptimistic
|
|
' oRS.Open strSQL, goConn2, adOpenKeyset, adLockOptimistic
|
|
oRS.Filter = strName
|
|
|
|
lstCrew.Clear
|
|
|
|
Do Until oRS.EOF
|
|
With lstCrew
|
|
strLine = Trim$(Field2Str(oRS!FirstName)) & " " & Trim$(Field2Str(oRS!LastName))
|
|
.AddItem strLine
|
|
.ItemData(.NewIndex) = oRS!EmployeeNumber
|
|
End With
|
|
oRS.MoveNext
|
|
Loop
|
|
|
|
frmCrewList.Width = 9150
|
|
Else
|
|
cmdAdd.Enabled = True
|
|
cmdAddName.Enabled = True
|
|
cmdDelete.Enabled = True
|
|
End If
|
|
|
|
End Sub
|
|
|
|
Private Sub FieldsSave()
|
|
Dim strSQL As String
|
|
Dim oRS As Recordset
|
|
On Error GoTo Error_EH
|
|
|
|
strSQL = "SELECT * FROM tblCrewList WHERE Crew_Id = 1"
|
|
Set oRS = New Recordset
|
|
oRS.Open strSQL, goConn, adOpenKeyset, adLockOptimistic
|
|
|
|
If mboolAdding Then
|
|
oRS.AddNew
|
|
End If
|
|
|
|
|
|
With oRS
|
|
!CREW_ID = Field2Str(lblCrewId)
|
|
!emp_dept = Field2Str(txtDept)
|
|
!Emp_ID = Field2Str(txtEmpId)
|
|
!EmpName = Left(Field2Str(txtEmpName), 30)
|
|
!wc_code = Field2Str(txtWCCode)
|
|
End With
|
|
|
|
oRS.Update
|
|
|
|
If mboolAdding Then
|
|
End If
|
|
|
|
Exit Sub
|
|
|
|
Error_EH:
|
|
If Err.Number = -2147467259 Then
|
|
MsgBox "Duplicate Lot Record - This will not be saved - ReEnter", , "Duplicate Record"
|
|
Resume Next
|
|
End If
|
|
gstrMODULE = "Form CrewList - Module FieldsSave"
|
|
Call ErrorHandler2
|
|
gstrMODULE = ""
|
|
Exit Sub
|
|
End Sub
|
|
|
|
Private Sub FormSave()
|
|
Dim strName As String
|
|
|
|
On Error GoTo Error_EH
|
|
|
|
|
|
' Store the controls to the recordset
|
|
Call FieldsSave
|
|
|
|
|
|
If mboolAdding Then
|
|
mboolAdding = False
|
|
|
|
End If
|
|
|
|
Call PayLoad
|
|
|
|
txtEmpId = ""
|
|
txtDept = ""
|
|
txtEmpName = ""
|
|
|
|
Exit Sub
|
|
|
|
Error_EH:
|
|
gstrMODULE = "Form CrewList - Module FormSave"
|
|
Call ErrorHandler2
|
|
gstrMODULE = ""
|
|
Exit Sub
|
|
End Sub
|
|
|
|
Private Sub PayLoad()
|
|
|
|
Dim oRS As Recordset
|
|
Dim strSQL As String, strCREW As String
|
|
Dim strLine As String
|
|
On Error GoTo Error_EH
|
|
|
|
strSQL = "SELECT * from tblcrewlist WHERE crew_id = " & Field2Str(lblCrewId.Caption) & " ORDER BY emp_id"
|
|
|
|
Set moRSCREW = New Recordset
|
|
|
|
moRSCREW.Open strSQL, goConn, adOpenForwardOnly, adLockReadOnly
|
|
|
|
lstPayCrews.Clear
|
|
|
|
Do Until moRSCREW.EOF
|
|
With lstPayCrews
|
|
strLine = Field2Str(moRSCREW!Emp_ID) & vbTab & Field2Str(moRSCREW!EmpName)
|
|
.AddItem strLine
|
|
.ItemData(.NewIndex) = moRSCREW!Emp_ID
|
|
End With
|
|
|
|
moRSCREW.MoveNext
|
|
Loop
|
|
moRSCREW.Close
|
|
|
|
If lstPayCrews.ListCount Then
|
|
lstPayCrews.ListIndex = 0
|
|
Else
|
|
lstPayCrews.ListIndex = -1
|
|
cmdDelete.Enabled = False
|
|
End If
|
|
Exit Sub
|
|
|
|
Error_EH:
|
|
gstrMODULE = "Form CrewList - Module PayLoad"
|
|
Call ErrorHandler2
|
|
gstrMODULE = ""
|
|
Exit Sub
|
|
End Sub
|
|
|
|
Private Sub cmdDelete_Click()
|
|
Dim strSQL As String, strYN As String
|
|
|
|
strYN = MsgBox("Are You Sure You Want To Delete This Crew Member?", vbCritical + vbYesNo, "Delete?")
|
|
|
|
If strYN <> vbYes Then
|
|
Exit Sub
|
|
End If
|
|
|
|
strSQL = "DELETE * FROM tblcrewlist where Emp_id = '" & Format(lstPayCrews.ItemData(lstPayCrews.ListIndex), "0000000") & "' and crew_id = " & Field2Str(lblCrewId.Caption)
|
|
goConn.Execute strSQL
|
|
|
|
Call PayLoad
|
|
End Sub
|
|
|
|
Private Sub cmdExit_Click()
|
|
Unload Me
|
|
End Sub
|
|
|
|
Private Sub Form_Activate()
|
|
Dim intResponse As Integer
|
|
Dim strSQL As String
|
|
|
|
On Error GoTo Error_EH
|
|
|
|
Exit Sub
|
|
|
|
Error_EH:
|
|
gstrMODULE = "Form CrewList - Module Form_Activate"
|
|
Call ErrorHandler2
|
|
gstrMODULE = ""
|
|
Exit Sub
|
|
|
|
End Sub
|
|
|
|
Private Sub Form_KeyDown(KeyCode As Integer, Shift As Integer)
|
|
Dim ShiftDown, AltDown, CtrlDown
|
|
|
|
If Shift = 4 Then
|
|
Exit Sub
|
|
End If
|
|
ShiftDown = (Shift And vbShiftMask) > 0
|
|
AltDown = (Shift And vbAltMask) > 0
|
|
CtrlDown = (Shift And vbCtrlMask) > 0
|
|
|
|
If KeyCode = vbKeyS Then ' Display key combinations.
|
|
If CtrlDown Then
|
|
Call lstCrew_DblClick
|
|
' Call CrewLoad
|
|
' Call cmdTotal_Click
|
|
' Call lstLots_DblClick
|
|
End If
|
|
Exit Sub
|
|
End If
|
|
|
|
End Sub
|
|
Private Sub Form_KeyPress(KeyAscii As Integer)
|
|
If KeyAscii = 13 Then
|
|
SendKeys "{TAB}"
|
|
KeyAscii = 0
|
|
End If
|
|
|
|
End Sub
|
|
Private Sub Form_Load()
|
|
On Error GoTo Error_EH
|
|
frmCrewList.Width = 4725
|
|
Call GetCrew
|
|
Call PayLoad
|
|
Exit Sub
|
|
|
|
Error_EH:
|
|
gstrMODULE = "Form CrewList - Module Form_Load"
|
|
Call ErrorHandler2
|
|
gstrMODULE = ""
|
|
Exit Sub
|
|
End Sub
|
|
Private Sub CrewLoad()
|
|
Dim strSQL As String, strLine As String
|
|
|
|
On Error GoTo Error_EH
|
|
|
|
' If gboolMAS90 Then
|
|
' MsgBox "No MAS90 Database on this computer", vbOKOnly, "No MAS90"
|
|
' Exit Sub
|
|
' End If
|
|
strSQL = "SELECT * FROM PR1_EmployeeMaster"
|
|
'' strSQL = "SELECT Department, EmployeeNumber, LastName, FirstName FROM PR1_EmployeeMaster"
|
|
' strSQL = "SELECT Department, EmployeeNumber, LastName, FirstName FROM PR1_EmployeeMaster Order BY LastName"
|
|
Set moRSCREW = New Recordset
|
|
moRSCREW.Open strSQL, goConn, adOpenKeyset, adLockOptimistic
|
|
'' moRSCREW.Open strSQL, goConn2, adOpenKeyset, adLockOptimistic
|
|
'adOpenForwardOnly , adLockReadOnly
|
|
|
|
lstCrew.Clear
|
|
|
|
Do Until moRSCREW.EOF
|
|
With lstCrew
|
|
strLine = Trim$(Field2Str(moRSCREW!FirstName)) & " " & Trim$(Field2Str(moRSCREW!LastName))
|
|
.AddItem strLine
|
|
.ItemData(.NewIndex) = moRSCREW!EmployeeNumber
|
|
End With
|
|
moRSCREW.MoveNext
|
|
Loop
|
|
' moRSCrew.Close
|
|
frmCrewList.Width = 9150
|
|
frmCrewList.SetFocus
|
|
Exit Sub
|
|
|
|
Error_EH:
|
|
gstrMODULE = "Form CrewList - Module ProjLoad"
|
|
Call ErrorHandler2
|
|
gstrMODULE = ""
|
|
Exit Sub
|
|
End Sub
|
|
|
|
Private Sub lstCrew_DblClick()
|
|
Call GetMember
|
|
txtEmpId = Field2Str(moRSMember!EmployeeNumber)
|
|
txtDept = Field2Str(moRSMember!department)
|
|
txtEmpName = Trim$(Field2Str(moRSMember!FirstName)) & " " & Trim$(Field2Str(moRSMember!LastName))
|
|
txtWCCode = Field2Str(moRSMember!wc_code)
|
|
If moRSMember!Terminated <> "A" Then
|
|
MsgBox "This Employee is Terminated - Be Sure To Correct Before Entering Payroll", vbOKOnly, "Terminated Employee"
|
|
End If
|
|
frmCrewList.Width = 4725
|
|
cmdAdd.Enabled = True
|
|
cmdAddName.Enabled = True
|
|
cmdDelete.Enabled = True
|
|
Call FormSave
|
|
End Sub
|
|
|