📄 frmemployees_properties.frm
字号:
End Sub
Private Sub ddResign_Click()
CheckEmpFields
End Sub
Private Sub ddResign_GotFocus()
SelText ddResign
End Sub
Private Sub ddResign_KeyPress(KeyAscii As Integer)
OnlyNum KeyAscii
End Sub
Private Sub Form_Load()
Move 0, 0
Dim i As Integer
i = 65
While Not i < 17
yyyyBirth.addItem Format$(Year(Now()) - i)
i = i - 1
Wend
For i = 0 To 20
yyyyComm.addItem Format$(Year(Now()) - 10 + i)
yyyyResign.addItem Format$(Year(Now()) - 10 + i)
Next i
FillComboCountry cmbCountry
Dim tempSQL As String
maxSalary = getSettings("maxSalary")
tempSQL = "SELECT Positions.PositionID FROM Positions ORDER BY Positions.PositionID ASC;"
FillCombo cmbPosition, tempSQL, "PositionID"
End Sub
Private Sub Form_Unload(Cancel As Integer)
Set frmEmployees_Properties = Nothing
End Sub
Private Sub mmBirth_Click()
CheckEmpFields
End Sub
Private Sub mmBirth_GotFocus()
SelText mmBirth
End Sub
Private Sub mmBirth_KeyPress(KeyAscii As Integer)
OnlyNum KeyAscii
End Sub
Private Sub mmComm_Click()
CheckEmpFields
End Sub
Private Sub mmComm_GotFocus()
SelText mmComm
End Sub
Private Sub mmComm_KeyPress(KeyAscii As Integer)
OnlyNum KeyAscii
End Sub
Private Sub mmResign_Click()
CheckEmpFields
End Sub
Private Sub mmResign_GotFocus()
SelText mmResign
End Sub
Private Sub mmResign_KeyPress(KeyAscii As Integer)
OnlyNum KeyAscii
End Sub
Private Sub mmResign_LostFocus()
If Len(mmResign.Text) > 0 Then
mmResign.Text = Format(mmResign.Text, "00")
End If
End Sub
Private Sub optMarriedNo_Click()
If optMarriedYes.Value = True Then
udChildren.Enabled = True
Else
udChildren.Enabled = False
End If
CheckEmpFields
End Sub
Private Sub optMarriedYes_Click()
If optMarriedYes.Value = True Then
udChildren.Enabled = True
Else
udChildren.Enabled = False
End If
CheckEmpFields
End Sub
Private Sub optResignNo_Click()
If optResignYes.Value = True Then
ddResign.Enabled = True
mmResign.Enabled = True
yyyyResign.Enabled = True
cmbReason.Enabled = True
Else
ddResign.Enabled = False
mmResign.Enabled = False
yyyyResign.Enabled = False
cmbReason.Enabled = False
End If
CheckEmpFields
End Sub
Private Sub optResignYes_Click()
If optResignYes.Value = True Then
ddResign.Enabled = True
mmResign.Enabled = True
yyyyResign.Enabled = True
cmbReason.Enabled = True
Else
ddResign.Enabled = False
mmResign.Enabled = False
yyyyResign.Enabled = False
cmbReason.Enabled = False
End If
CheckEmpFields
End Sub
Private Sub txtAddress_Change()
CheckEmpFields
End Sub
Private Sub txtAddress_GotFocus()
SelText txtAddress
End Sub
Private Sub txtAddress_LostFocus()
CapCon txtAddress
End Sub
Private Sub txtChildren_Change()
CheckEmpFields
End Sub
Private Sub txtChildren_GotFocus()
SelText txtChildren
End Sub
Private Sub txtChildren_KeyPress(KeyAscii As Integer)
KeyAscii = 0
End Sub
Private Sub txtChildren_LostFocus()
If Len(txtChildren.Text) = 0 Then
txtChildren.Text = "0"
End If
End Sub
Private Sub txtEmployeeID_Change()
CheckEmpFields
End Sub
Private Sub txtEmployeeID_GotFocus()
SelText txtEmployeeID
End Sub
Private Sub txtEPF_Change()
CheckEmpFields
End Sub
Private Sub txtEPF_GotFocus()
SelText txtEPF
End Sub
Private Sub txtIC_Change()
CheckEmpFields
End Sub
Private Sub txtIC_GotFocus()
SelText txtIC
End Sub
Private Sub txtIC_KeyPress(KeyAscii As Integer)
OnlyNum KeyAscii
End Sub
Private Sub txtName_Change()
CheckEmpFields
End Sub
Private Sub txtName_GotFocus()
SelText txtName
End Sub
Private Sub txtName_LostFocus()
CapCon txtName
End Sub
Private Sub txtNotes_Change()
CheckEmpFields
End Sub
Private Sub txtNotes_GotFocus()
SelText txtNotes
End Sub
Private Sub txtSalary_Change()
CheckEmpFields
End Sub
Private Sub txtSalary_GotFocus()
SelText txtSalary
End Sub
Private Sub txtSalary_KeyPress(KeyAscii As Integer)
If KeyAscii <> Asc(".") Then
OnlyNum KeyAscii
End If
End Sub
Private Sub txtSalary_LostFocus()
If Len(txtSalary.Text) > 0 Then
txtSalary.Text = Format$(txtSalary.Text, "#,##0.00")
End If
End Sub
Private Sub txtSocso_Change()
CheckEmpFields
End Sub
Private Sub txtSocso_GotFocus()
SelText txtSocso
End Sub
Private Sub txtTFN_Change()
CheckEmpFields
End Sub
Private Sub txtTFN_GotFocus()
SelText txtTFN
End Sub
Private Sub txtZip_Change()
CheckEmpFields
End Sub
Private Sub txtZip_GotFocus()
SelText txtZip
End Sub
Private Sub txtZip_KeyPress(KeyAscii As Integer)
OnlyNum KeyAscii
End Sub
Private Sub yyyyBirth_Click()
CheckEmpFields
End Sub
Private Sub yyyyBirth_GotFocus()
SelText yyyyBirth
End Sub
Private Sub yyyyBirth_KeyPress(KeyAscii As Integer)
OnlyNum KeyAscii
End Sub
Private Sub yyyyBirth_LostFocus()
If Len(yyyyBirth.Text) > 0 Then
yyyyBirth.Text = Format(yyyyBirth.Text, "00")
End If
End Sub
Private Sub yyyyComm_Click()
CheckEmpFields
End Sub
Private Sub yyyyComm_GotFocus()
SelText yyyyComm
End Sub
Private Sub yyyyComm_KeyPress(KeyAscii As Integer)
OnlyNum KeyAscii
End Sub
Private Sub yyyyResign_Click()
CheckEmpFields
End Sub
Private Sub yyyyResign_GotFocus()
SelText yyyyResign
End Sub
Private Sub yyyyResign_KeyPress(KeyAscii As Integer)
OnlyNum KeyAscii
End Sub
Private Sub CheckEmpFields()
If (Len(txtEmployeeID.Text) = 0) Or (Len(txtName.Text) = 0) Or ((optMale.Value = False) And (optFemale.Value = False)) Or _
(Len(ddBirth.Text) = 0) Or (Len(mmBirth.Text) = 0) Or (Len(yyyyBirth.Text) = 0) Or (Len(txtIC.Text) = 0) Or _
(Len(cmbRace.Text) = 0) Or (Len(txtAddress.Text) = 0) Or (Len(cmbCountry.Text) = 0) Or (Len(cmbState.Text) = 0) Or _
(Len(cmbCity.Text) = 0) Or (Len(txtZip.Text) = 0) Or (Len(cmbPosition.Text) = 0) Or (Len(txtSalary.Text) = 0) Or _
(Len(ddComm.Text) = 0) Or (Len(mmComm.Text) = 0) Or (Len(yyyyComm.Text) = 0) Then
cmdSave.Enabled = False
ElseIf (optMarriedYes.Value = True) And (Len(txtChildren.Text) = 0) Then
cmdSave.Enabled = False
ElseIf ((optResignYes.Value = True) And (optResignNo.Value = False)) And ((Len(ddResign.Text) = 0) Or (Len(mmResign.Text) = 0) Or (Len(yyyyResign.Text) = 0)) And (Len(cmbReason.Text) = 0) Then
cmdSave.Enabled = False
Else
cmdSave.Enabled = True
End If
End Sub
Public Sub getEmployeeInfo(ByVal strEmployeeID As String)
Dim tempSQL As String
Dim empRS As Recordset
Screen.MousePointer = 11
tempSQL = "SELECT * FROM Employees WHERE Employees.EmployeeID='" & strEmployeeID & "';"
'On Error GoTo ErrHandler
RSOpen empRS, tempSQL, dbOpenSnapshot
Dim tempDate() As String
txtEmployeeID.Text = empRS("EmployeeID")
lblhidden.Caption = empRS("EmployeeID")
txtName.Text = empRS("Name")
optFemale.Value = IIf((empRS("Gender") = True), True, False)
optMale.Value = IIf((empRS("Gender") = True), False, True)
tempDate = Split(empRS("DOB"), "/")
ddBirth.Text = Format$(tempDate(0), "00")
mmBirth.Text = Format$(tempDate(1), "00")
yyyyBirth.Text = Format$(tempDate(2), "0000")
txtIC.Text = empRS("IC")
cmbRace.Text = IIf(IsNull(empRS("Race")), "", empRS("Race"))
optMarriedYes.Value = IIf((empRS("Maritial") = True), True, False)
If optMarriedYes.Value = True Then
udChildren.Enabled = True
Else
udChildren.Enabled = False
End If
optMarriedNo.Value = IIf((empRS("Maritial") = True), False, True)
txtChildren.Text = empRS("Children")
txtAddress.Text = empRS("Address")
cmbCountry.Text = empRS("CountryID")
cmbState.Text = empRS("StateID")
cmbCity.Text = empRS("City")
txtZip.Text = empRS("Zip")
txtEPF.Text = IIf(IsNull(empRS("EPF")), "", empRS("EPF"))
txtSocso.Text = IIf(IsNull(empRS("SSN")), "", empRS("SSN"))
txtTFN.Text = IIf(IsNull(empRS("TFN")), "", empRS("TFN"))
cmbPosition.Text = empRS("PositionID")
previousPos = empRS("PositionID")
txtSalary.Text = Format$(empRS("Salary"), "#,##0.00")
tempDate = Split(empRS("Commence"), "/")
ddComm.Text = Format$(tempDate(0), "00")
mmComm.Text = Format$(tempDate(1), "00")
yyyyComm.Text = Format$(tempDate(2), "0000")
optResignYes.Value = IIf((empRS("Resign") = True), True, False)
optResignNo.Value = IIf((empRS("Resign") = True), False, True)
If Not IsNull(empRS("Resignation")) Then
tempDate = Split(empRS("Resignation"), "/") 'date
ddResign.Text = Format$(tempDate(0), "00")
mmResign.Text = Format$(tempDate(1), "00")
yyyyResign.Text = Format$(tempDate(2), "0000")
End If
cmbReason.Text = IIf(IsNull(empRS("Reason")), "", empRS("Reason"))
txtNotes.Text = IIf(IsNull(empRS("Notes")), "", empRS("Notes"))
empRS.Close
Set empRS = Nothing
Call cmbCountry_Click
Call cmbState_Click
getHistory txtEmployeeID.Text
Screen.MousePointer = 0
ErrHandler:
If Err.Number <> 0 Then
Screen.MousePointer = 0
ErrorNotifier Err.Number, Err.description
Unload Me
End If
End Sub
Private Sub getHistory(ByVal strEmployeeID As String)
Dim pastRS As Recordset, pastSQL As String
pastSQL = "SELECT Progress.Date, Progress.Note FROM Progress WHERE Progress.EmployeeID='" & strEmployeeID & "';"
On Error GoTo ErrHandler
RSOpen pastRS, pastSQL, dbOpenSnapshot
With list_Progress
'Clear any existing header
.View = lvwReport
.ColumnHeaders.Clear
'Specify the columns and properties
.ColumnHeaders.add , , "Date"
.ColumnHeaders.add , , "Memo"
.ColumnHeaders(2).width = .width - .ColumnHeaders(1).width
'Clear any existing content
.ListItems.Clear
While Not pastRS.EOF
.ListItems.add , , pastRS("Date")
.ListItems(.ListItems.Count).SubItems(1) = pastRS("Note")
pastRS.MoveNext
Wend
End With
pastRS.Close
Set pastRS = Nothing
ErrHandler:
If Err.Number <> 0 Then
ErrorNotifier Err.Number, Err.description
End If
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -