📄 frmaresult.frm
字号:
VERSION 5.00
Object = "{5E9E78A0-531B-11CF-91F6-C2863C385E30}#1.0#0"; "MSFLXGRD.OCX"
Begin VB.Form frmAResult
Caption = "员工出勤结果列表"
ClientHeight = 7170
ClientLeft = 60
ClientTop = 345
ClientWidth = 14745
ControlBox = 0 'False
LinkTopic = "Form1"
MDIChild = -1 'True
ScaleHeight = 7170
ScaleWidth = 14745
WindowState = 2 'Maximized
Begin VB.CommandButton Command6
Caption = "退 出"
Height = 375
Left = 11640
TabIndex = 6
Top = 6600
Width = 1335
End
Begin VB.CommandButton Command5
Caption = "查询出勤信息"
Height = 375
Left = 8400
TabIndex = 5
Top = 6600
Width = 1455
End
Begin VB.CommandButton Command3
Caption = "删除出勤信息"
Height = 375
Left = 6960
TabIndex = 4
Top = 6600
Width = 1335
End
Begin VB.CommandButton Command2
Caption = "增加出勤信息"
Height = 375
Left = 5520
TabIndex = 3
Top = 6600
Width = 1335
End
Begin VB.CommandButton Command1
Caption = "修改出勤信息"
Height = 375
Left = 3840
TabIndex = 2
Top = 6600
Width = 1455
End
Begin MSFlexGridLib.MSFlexGrid recordlist
Height = 5775
Left = 840
TabIndex = 1
Top = 720
Width = 13485
_ExtentX = 23786
_ExtentY = 10186
_Version = 393216
Cols = 9
FixedCols = 0
FillStyle = 1
BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851}
Name = "宋体"
Size = 10.5
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
End
Begin VB.Label Label1
Alignment = 2 'Center
Caption = "员工出勤信息列表"
BeginProperty Font
Name = "宋体"
Size = 12
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
ForeColor = &H000000FF&
Height = 255
Left = 6720
TabIndex = 0
Top = 240
Width = 2415
End
End
Attribute VB_Name = "frmAResult"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit
Public Sub ListTopic()
On Error Resume Next
Dim i As Integer
With recordlist '设置表头
.TextMatrix(0, 0) = "记录编号"
.TextMatrix(0, 1) = "员工编号"
.TextMatrix(0, 2) = "员工姓名"
.TextMatrix(0, 3) = "出勤日期"
.TextMatrix(0, 4) = "进出标志"
.TextMatrix(0, 5) = "上班时间"
.TextMatrix(0, 6) = "下班时间"
.TextMatrix(0, 7) = "迟到次数"
.TextMatrix(0, 8) = "早退次数"
For i = 0 To 8 '设置所有表格对齐方式
.ColAlignment(i) = 4
Next i
For i = 0 To 8 '设置每列宽度
.ColWidth(i) = 1500
Next i
End With
End Sub
Public Sub ShowData(query As String)
On Error Resume Next
Dim rsAttendance As New ADODB.Recordset
Set rsAttendance = TransactSQL(query)
If rsAttendance.EOF = False Then
With recordlist
.Rows = 1
While Not rsAttendance.EOF
.Rows = .Rows + 1
.TextMatrix(.Rows - 1, 0) = rsAttendance(0)
.TextMatrix(.Rows - 1, 1) = rsAttendance(1)
.TextMatrix(.Rows - 1, 2) = rsAttendance(2)
.TextMatrix(.Rows - 1, 3) = rsAttendance(3)
.TextMatrix(.Rows - 1, 4) = rsAttendance(4)
If IsNull(rsAttendance(5)) Then
.TextMatrix(.Rows - 1, 5) = ""
Else
.TextMatrix(.Rows - 1, 5) = rsAttendance(5)
End If
If IsNull(rsAttendance(6)) Then
.TextMatrix(.Rows - 1, 6) = ""
Else
.TextMatrix(.Rows - 1, 6) = rsAttendance(6)
End If
.TextMatrix(.Rows - 1, 7) = rsAttendance(7)
.TextMatrix(.Rows - 1, 8) = rsAttendance(8)
rsAttendance.MoveNext
Wend
rsAttendance.Close
End With
End If
End Sub
Private Sub Command1_Click()
On Error Resume Next
flag = 2
If frmAResult.recordlist.Rows > 1 Then
kqsql = "select * from AttendanceInfo where ID=" & Trim( _
frmAResult.recordlist.TextMatrix(frmAResult.recordlist.Row, 0))
FrmAttendance.Show
FrmAttendance.ZOrder 0
ArecordID = Trim(frmAResult.recordlist.TextMatrix(frmAResult.recordlist.Row, 0))
Else
MsgBox "没有考勤信息!", vbOKOnly + vbExclamation, "警告!"
flag = 1
FrmAttendance.Show
End If
End Sub
Private Sub Command2_Click()
On Error Resume Next
flag = 1
FrmAttendance.Show
FrmAttendance.ZOrder 0
End Sub
Private Sub Command3_Click()
On Error Resume Next
Dim kpsql As Integer
If frmAResult.recordlist.Rows = 1 Then
MsgBox "目前没有上下班信息!", vbOKOnly + vbExclamation, "警告!"
flag = 1
FrmAttendance.Show
FrmAttendance.ZOrder 0
Else
kqsql = "delete from AttendanceInfo where ID=" & frmAResult.recordlist.TextMatrix(frmAResult.recordlist.Row, 0)
If MsgBox("真的要删除这条记录么?", vbOKCancel + vbExclamation, "提示!") = vbOK _
Then
TransactSQL (kqsql)
MsgBox "记录已经删除!", vbOKOnly + vbExclamation, "警告!"
Unload Me
kqsql = "select * from AttendanceInfo"
frmAResult.ListTopic
frmAResult.ShowData (kqsql)
frmAResult.Show
End If
End If
End Sub
Private Sub Command5_Click()
frmCheckKQ.Show
End Sub
Private Sub Command6_Click()
Unload Me
End Sub
Private Sub Form_Load()
On Error Resume Next
Dim SQL As String
SQL = "select * from AttendanceInfo order by ID desc"
Call ListTopic
Call ShowData(SQL)
End Sub
Private Sub recordlist_DblClick()
On Error Resume Next
flag = 2
If frmAResult.recordlist.Rows > 1 Then
kqsql = "select * from AttendanceInfo where ID=" & Trim( _
frmAResult.recordlist.TextMatrix(frmAResult.recordlist.Row, 0))
FrmAttendance.Show
FrmAttendance.ZOrder 0
ArecordID = Trim(frmAResult.recordlist.TextMatrix(frmAResult.recordlist.Row, 0))
Else
MsgBox "没有考勤信息!", vbOKOnly + vbExclamation, "警告!"
flag = 1
FrmAttendance.Show
End If
End Sub
Private Sub recordlist_MouseUp(Button As Integer, Shift As Integer, x As Single, y As Single)
On Error Resume Next
If Button = 2 And Shift = 0 Then
PopupMenu popmenu.popmenu1
End If
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -