📄 frmadmin_settings.frm
字号:
TabIndex = 18
Top = 1920
Width = 1695
End
Begin VB.Label Label3
Caption = "Next unique key for:"
BeginProperty Font
Name = "Tahoma"
Size = 8.25
Charset = 0
Weight = 400
Underline = -1 'True
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 255
Left = 240
TabIndex = 17
Top = 1680
Width = 1575
End
Begin VB.Label Label2
Caption = "Max salary allowed per employee:"
Height = 255
Left = 240
TabIndex = 16
Top = 1320
Width = 2535
End
Begin VB.Label Label1
Caption = "Max item allowed in delivery order cart:"
Height = 255
Left = 240
TabIndex = 15
Top = 840
Width = 2895
End
End
Begin VB.Label lblNotes
BackStyle = 0 'Transparent
ForeColor = &H00FFFFFF&
Height = 615
Left = 720
TabIndex = 22
Top = 120
Width = 3735
End
Begin VB.Image Image1
Height = 480
Left = 120
Picture = "frmAdmin_Settings.frx":0000
Top = 120
Width = 480
End
Begin VB.Shape Shape1
BackColor = &H00FF8080&
BackStyle = 1 'Opaque
BorderStyle = 0 'Transparent
Height = 855
Left = 0
Top = 0
Width = 4575
End
End
Attribute VB_Name = "frmAdmin_Settings"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit
Private Sub boss_Change()
End Sub
Private Sub boss_GotFocus()
SelText boss
End Sub
Private Sub boss_KeyPress(KeyAscii As Integer)
OnlyNum KeyAscii
End Sub
Private Sub boss_LostFocus()
If boss.Text = "" Then
'By default - 11%
boss.Text = "11"
Else
If Val(boss.Text) > 50 Then
ValidMsg "The government must be crazy. Please try again.", "Invalid EPF contribution"
boss.SetFocus
End If
End If
End Sub
Private Sub cmdClose_Click()
Unload Me
End Sub
Private Sub cmdUpdateUser_Click()
Dim tempSQL As String
If compName.Text = "" Then
ValidMsg "Please enter a company name.", "Missing company name"
compName.SetFocus
Else
If chkPrice.Value = vbChecked Then
tempSQL = "TRUE"
Else
tempSQL = "FALSE"
End If
On Error GoTo ErrHandler
BeginTrans
tempSQL = "UPDATE Pub_settings SET Pub_settings.Value='" & tempSQL & "' WHERE Pub_settings.Subject='allowPrice';"
MySynonDatabase.Execute tempSQL
tempSQL = "UPDATE Pub_settings SET Pub_settings.Value='" & txtCartMax.Text & "' WHERE Pub_settings.Subject='cartSize';"
MySynonDatabase.Execute tempSQL
tempSQL = "UPDATE Pub_settings SET Pub_settings.Value='" & txtSalary.Text & "' WHERE Pub_settings.Subject='maxSalary';"
MySynonDatabase.Execute tempSQL
'Unique keys related
tempSQL = "UPDATE Misc SET Misc.DataValue='" & txtpo.Text & "' WHERE Misc.DataType='PO';"
MySynonDatabase.Execute tempSQL
tempSQL = "UPDATE Misc SET Misc.DataValue='" & txtdo.Text & "' WHERE Misc.DataType='DLVR';"
MySynonDatabase.Execute tempSQL
tempSQL = "UPDATE Misc SET Misc.DataValue='" & txtemp.Text & "' WHERE Misc.DataType='EMP';"
MySynonDatabase.Execute tempSQL
tempSQL = "UPDATE Misc SET Misc.DataValue='" & txtprod.Text & "' WHERE Misc.DataType='PRODUCT';"
MySynonDatabase.Execute tempSQL
'Human resource related
tempSQL = "UPDATE Pub_settings SET Pub_settings.Value='" & numDays.Text & "' WHERE Pub_settings.Subject='numDays';"
MySynonDatabase.Execute tempSQL
tempSQL = "UPDATE Pub_settings SET Pub_settings.Value='" & worker.Text & "' WHERE Pub_settings.Subject='EPFWorkRate';"
MySynonDatabase.Execute tempSQL
tempSQL = "UPDATE Pub_settings SET Pub_settings.Value='" & boss.Text & "' WHERE Pub_settings.Subject='EPFEmpRate';"
MySynonDatabase.Execute tempSQL
tempSQL = "UPDATE Pub_settings SET Pub_settings.Value='" & compName.Text & "' WHERE Pub_settings.Subject='compName';"
MySynonDatabase.Execute tempSQL
insertLog "Administration settings changed."
CommitTrans
InfoMsg "Settings updated. Effect of the changes would begin immediately.", "Settings updated"
End If
ErrHandler:
If Err.Number <> 0 Then
Rollback
ErrorNotifier Err.Number, "Settings could not be updated. Please try again." & vbCrLf & "If you see this message again, please contact system administrator immediately."
End If
End Sub
Private Sub compName_Change()
End Sub
Private Sub compName_GotFocus()
SelText compName
End Sub
Private Sub compName_KeyPress(KeyAscii As Integer)
tickerKeys KeyAscii
End Sub
Private Sub Form_Load()
lblNotes.Caption = "These administrative settings should be carefully configured as it affects the entire system as a whole." & vbCrLf & _
"Please ensure no other users are logged on before attempting to modify these settings."
If getSettings("allowPrice") = "TRUE" Then
chkPrice.Value = vbChecked
Else
chkPrice.Value = vbUnchecked
End If
txtCartMax.Text = getSettings("cartSize")
txtSalary.Text = getSettings("maxSalary")
txtpo.Text = getNextKeys("PO")
txtdo.Text = getNextKeys("DLVR")
txtemp.Text = getNextKeys("EMP")
txtprod.Text = getNextKeys("PRODUCT")
numDays.Text = getSettings("numDays")
worker.Text = getSettings("EPFWorkRate")
boss.Text = getSettings("EPFEmpRate")
compName.Text = getSettings("compName")
End Sub
Private Sub Form_Unload(Cancel As Integer)
Set frmAdmin_Settings = Nothing
End Sub
Private Sub numDays_Change()
End Sub
Private Sub numDays_GotFocus()
SelText numDays
End Sub
Private Sub numDays_KeyPress(KeyAscii As Integer)
OnlyNum KeyAscii
End Sub
Private Sub numDays_LostFocus()
If numDays.Text = "" Then
'By default - 26 days
numDays.Text = "26"
Else
If Val(numDays.Text) > 31 Then
ValidMsg "The number of working days in a month cannot exceed 31 days.", "Invalid days"
numDays.SetFocus
End If
End If
End Sub
Private Sub txtCartMax_GotFocus()
SelText txtCartMax
End Sub
Private Sub txtCartMax_KeyPress(KeyAscii As Integer)
KeyAscii = 0
End Sub
Private Sub txtdo_GotFocus()
SelText txtdo
End Sub
Private Sub txtdo_KeyPress(KeyAscii As Integer)
OnlyNum KeyAscii
End Sub
Private Sub txtemp_GotFocus()
SelText txtemp
End Sub
Private Sub txtemp_KeyPress(KeyAscii As Integer)
OnlyNum KeyAscii
End Sub
Private Sub txtPO_GotFocus()
SelText txtpo
End Sub
Private Sub txtpo_KeyPress(KeyAscii As Integer)
OnlyNum KeyAscii
End Sub
Private Sub txtprod_GotFocus()
SelText txtprod
End Sub
Private Sub txtprod_KeyPress(KeyAscii As Integer)
OnlyNum KeyAscii
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 txtSalary.Text <> "" Then
txtSalary.Text = Format$(txtSalary.Text, "#,##0.00")
End If
End Sub
Private Sub worker_Change()
End Sub
Private Sub worker_GotFocus()
SelText worker
End Sub
Private Sub worker_KeyPress(KeyAscii As Integer)
OnlyNum KeyAscii
End Sub
Private Sub worker_LostFocus()
If worker.Text = "" Then
'By default - 9%
worker.Text = "9"
Else
If Val(worker.Text) > 50 Then
ValidMsg "The government must be crazy. Please try again.", "Invalid EPF contribution"
worker.SetFocus
End If
End If
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -