📄 frmpayroll_new.frm
字号:
Top = 960
Width = 975
End
Begin VB.Label Label18
Caption = "Maritial Status:"
Height = 255
Left = 120
TabIndex = 50
Top = 960
Width = 1095
End
Begin VB.Label lblID
Height = 255
Left = 1320
TabIndex = 42
Top = 600
Width = 1455
End
Begin VB.Label lblName
Height = 255
Left = 1320
TabIndex = 41
Top = 240
Width = 3615
End
Begin VB.Label Label16
Caption = "Employee ID:"
Height = 255
Left = 120
TabIndex = 40
Top = 600
Width = 1095
End
Begin VB.Label Label1
Caption = "Name:"
Height = 255
Left = 120
TabIndex = 39
Top = 240
Width = 1095
End
End
Begin MSComCtl2.DTPicker datepk
Height = 285
Left = 5280
TabIndex = 1
Top = 1320
Width = 3015
_ExtentX = 5318
_ExtentY = 503
_Version = 393216
Format = 19529728
CurrentDate = 38152
MinDate = 31048
End
Begin VB.Frame Frame3
Caption = "Payment Method:"
Height = 1815
Left = 5280
TabIndex = 2
Top = 1680
Width = 3015
Begin VB.TextBox txtCheque
Height = 285
Left = 1560
MaxLength = 15
TabIndex = 6
Top = 1320
Width = 1335
End
Begin VB.Label Label17
Caption = "Cheque Ref:"
Height = 255
Left = 120
TabIndex = 37
Top = 1320
Width = 975
End
End
Begin VB.Frame Frame2
Caption = "Required Details:"
Height = 2775
Left = 5280
TabIndex = 7
Top = 3600
Width = 3015
Begin VB.TextBox txtUnpaid
Height = 285
Left = 1920
TabIndex = 12
Text = "0"
Top = 1680
Width = 495
End
Begin VB.TextBox txtRate
Height = 285
Left = 1920
MaxLength = 10
TabIndex = 13
Text = "0.00"
ToolTipText = "This rate is taken from the salary divided by the number of days for the month."
Top = 2400
Width = 975
End
Begin VB.TextBox txtHours
Height = 285
Left = 1920
MaxLength = 3
TabIndex = 8
Text = "0"
Top = 240
Width = 495
End
Begin VB.TextBox txtOTHours
Height = 285
Left = 1920
MaxLength = 3
TabIndex = 11
Text = "0"
Top = 1320
Width = 495
End
Begin VB.TextBox txtAnnual
Height = 285
Left = 1920
MaxLength = 3
TabIndex = 9
Text = "0"
Top = 600
Width = 495
End
Begin VB.TextBox txtSick
Height = 285
Left = 1920
MaxLength = 3
TabIndex = 10
Text = "0"
Top = 960
Width = 495
End
Begin VB.Label Label22
Caption = "Unpaid Leave(s):"
Height = 255
Left = 120
TabIndex = 58
Top = 1680
Width = 1335
End
Begin VB.Label Label2
Caption = "Estimated daily rate:"
Height = 255
Left = 120
TabIndex = 54
Top = 2400
Width = 1695
End
Begin VB.Label Label3
Caption = "Total Days Worked:"
Height = 255
Left = 120
TabIndex = 36
Top = 240
Width = 1695
End
Begin VB.Label Label4
Caption = "OT hour(s):"
Height = 255
Left = 120
TabIndex = 35
Top = 1320
Width = 1335
End
Begin VB.Label Label5
Caption = "Annual/Paid Leave(s):"
Height = 255
Left = 120
TabIndex = 34
Top = 600
Width = 1815
End
Begin VB.Label Label6
Caption = "Sick Leave(s):"
Height = 255
Left = 120
TabIndex = 33
Top = 960
Width = 1335
End
End
Begin MSComctlLib.ListView lvEmployees
Height = 4095
Left = 120
TabIndex = 0
Top = 1320
Width = 5055
_ExtentX = 8916
_ExtentY = 7223
View = 3
LabelEdit = 1
LabelWrap = -1 'True
HideSelection = -1 'True
FullRowSelect = -1 'True
_Version = 393217
ForeColor = -2147483640
BackColor = -2147483643
Appearance = 1
NumItems = 0
End
Begin VB.Frame Frame1
Caption = "EPF Contribution:"
Height = 975
Left = 8400
TabIndex = 14
Top = 1320
Width = 3015
Begin VB.TextBox txtEmployer
Height = 285
Left = 1560
MaxLength = 12
TabIndex = 16
Text = "0.00"
Top = 600
Width = 1335
End
Begin VB.TextBox txtEmployee
Height = 285
Left = 1560
MaxLength = 12
TabIndex = 15
Text = "0.00"
Top = 240
Width = 1335
End
Begin VB.Label Label9
Caption = "Employer:"
Height = 255
Left = 120
TabIndex = 32
Top = 600
Width = 735
End
Begin VB.Label Label8
Caption = "Employee:"
Height = 255
Left = 120
TabIndex = 31
Top = 240
Width = 735
End
End
Begin VB.Label instructions
Height = 1095
Left = 120
TabIndex = 57
Top = 120
Width = 11295
End
Begin VB.Menu mnu_Options
Caption = "&Options"
Begin VB.Menu mnu_Save
Caption = "&Save"
End
Begin VB.Menu mnu_Print
Caption = "&Print..."
End
Begin VB.Menu dash01
Caption = "-"
End
Begin VB.Menu mnu_Close
Caption = "&Close"
End
End
End
Attribute VB_Name = "frmPayroll_New"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
'This form allows users to insert a payroll record under
'an employee's account.
Option Explicit
Dim hour_work, ot_hour, ann_leave, sick_leave, unpaid_leave As Byte
Private Sub cmdCalc_Click()
autoCalc
End Sub
Private Sub cmdSave_Click()
If lblID.Caption = "" Then
ValidMsg "Please select an employee.", "Missing employee"
lvEmployees.SetFocus
ElseIf ((Val(txtHours.Text) < 0) Or (Val(txtHours.Text) > 552)) Then
ValidMsg "It is impossible to work more than 552 hours a month. Please try again.", "Invalid number of hours"
txtHours.SetFocus
ElseIf (pay1.Value = False) And (pay2.Value = False) And (pay3.Value = False) Then
ValidMsg "Please select the type of payment for this payroll.", "Missing payment method"
pay1.SetFocus
ElseIf (pay3.Value = True) And (txtCheque.Text = "") Then
ValidMsg "Please enter the cheque details.", "Missing cheque details"
txtCheque.SetFocus
Else
savePayroll
End If
End Sub
Private Sub Form_Load()
datepk.Value = Now()
getListofEmployees lvEmployees
instructions.Caption = "To create a payroll, select employee from the list." & vbCrLf & _
"Details including leaves taken during the month of the current date would be retrieved." & vbCrLf & _
"Estimated hourly rate is based on the salary divided by the number of days for the month of the selected date." & vbCrLf & _
"Ensure that payment method has been selected and all other fields have been carefully filled with data." & vbCrLf & _
"Feel free to click on 'Calculate Payroll...' to automate the calculations. When you are done, just click on 'Save'."
End Sub
Private Sub getListofEmployees(ByRef strList As ListView)
Dim tempSQL As String
Dim listRS As Recordset
With strList
.View = lvwReport
.ColumnHeaders.Clear
.ColumnHeaders.add , , "ID", 0
.ColumnHeaders.add , , "Name", .width - 100
'clear existing items
.ListItems.Clear
tempSQL = "SELECT Employees.EmployeeID, Employees.Name FROM Employees;"
On Error GoTo ErrHandler
RSOpen listRS, tempSQL, dbOpenSnapshot
While Not listRS.EOF
.ListItems.add , , listRS("EmployeeID")
.ListItems(.ListItems.Count).SubItems(1) = listRS("Name")
listRS.MoveNext
Wend
End With
ErrHandler:
If Err.Number <> 0 Then
strList.ListItems.Clear
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -