📄 frmhourstatistic.frm
字号:
VERSION 5.00
Begin VB.Form frmHourStatistic
BorderStyle = 3 'Fixed Dialog
Caption = "教学上机统计"
ClientHeight = 2940
ClientLeft = 45
ClientTop = 330
ClientWidth = 3810
Icon = "frmHourStatistic.frx":0000
LinkTopic = "Form1"
MaxButton = 0 'False
MinButton = 0 'False
ScaleHeight = 2940
ScaleWidth = 3810
StartUpPosition = 2 '屏幕中心
Begin VB.Frame fraStatistic
Caption = "教学上机统计"
Height = 1815
Left = 240
TabIndex = 0
Top = 240
Width = 3255
Begin VB.CommandButton cmdFind
Caption = "统 计"
Default = -1 'True
Height = 375
Left = 480
TabIndex = 6
Top = 1320
Width = 975
End
Begin VB.CommandButton cmdPrint
Caption = "打印预览"
Height = 375
Left = 1800
TabIndex = 5
Top = 1320
Width = 975
End
Begin VB.ComboBox cboTime
Height = 300
Left = 1320
Style = 2 'Dropdown List
TabIndex = 4
Top = 840
Width = 1455
End
Begin VB.ComboBox cboI_name
Height = 300
ItemData = "frmHourStatistic.frx":000C
Left = 1320
List = "frmHourStatistic.frx":000E
Style = 2 'Dropdown List
TabIndex = 1
Top = 360
Width = 1455
End
Begin VB.Label lblTime
AutoSize = -1 'True
Caption = "时间:"
Height = 180
Left = 480
TabIndex = 3
Top = 900
Width = 540
End
Begin VB.Label lblI_name
AutoSize = -1 'True
Caption = "院系:"
Height = 180
Left = 480
TabIndex = 2
Top = 420
Width = 540
End
End
Begin VB.Label lblInfo
AutoSize = -1 'True
Height = 180
Left = 360
TabIndex = 8
Top = 2520
Width = 90
End
Begin VB.Label Label1
Caption = "统计说明:"
Height = 255
Left = 360
TabIndex = 7
Top = 2280
Width = 975
End
End
Attribute VB_Name = "frmHourStatistic"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Public rsShangJi As Recordset
Dim rsSum As Recordset
Dim rsInstitute As Recordset
Dim StrInstitute As String
Dim strMonth As String
Private Sub cmdFind_Click()
Set rsSum = New Recordset
Dim strHour As String
strHour = "SELECT cint(sum(left(right([time],5),2))/60)+sum(left([time],1)) AS Sumtime From tbshangji WHERE money=0" & where
rsSum.Open strHour, Modmain.conn, 3, 2
Set rsShangJi = New Recordset
rsShangJi.Open "select * From tbshangji WHERE money=0" & where, Modmain.conn, 3, 2
If rsSum.Fields!sumtime <> "" Then
lblInfo.Caption = StrInstitute & strMonth & "份教学机时为" & rsSum.Fields!sumtime & "小时"
Else
lblInfo.Caption = "所选条件下无教学机时"
End If
cmdPrint.Enabled = True
AddLog ("L22")
End Sub
Private Sub cmdPrint_Click()
If rsSum.Fields!sumtime = "" Or rsSum.Fields!sumtime = 0 Then
MsgBox "没有可打印的信息!", vbOKOnly + vbExclamation, "机房管理"
Else
DRHourStatistic.Show 1
AddLog ("L25")
End If
End Sub
Private Sub Form_Load()
cmdPrint.Enabled = False
Set rsInstitute = New Recordset
rsInstitute.Open "select * from TbInstitute ", Modmain.conn, 3, 2
While Not rsInstitute.EOF
cboI_name.AddItem (rsInstitute.Fields("I_Name"))
rsInstitute.MoveNext
Wend
cboI_name.AddItem ""
rsInstitute.Close
Set rsInstitute = Nothing
cboTime.AddItem ("一月")
cboTime.AddItem ("二月")
cboTime.AddItem ("三月")
cboTime.AddItem ("四月")
cboTime.AddItem ("五月")
cboTime.AddItem ("六月")
cboTime.AddItem ("七月")
cboTime.AddItem ("八月")
cboTime.AddItem ("九月")
cboTime.AddItem ("十月")
cboTime.AddItem ("十一月")
cboTime.AddItem ("十二月")
cboTime.AddItem ("第一季度")
cboTime.AddItem ("第二季度")
cboTime.AddItem ("第三季度")
cboTime.AddItem ("第四季度")
cboTime.AddItem ("上半年")
cboTime.AddItem ("下半年")
cboTime.AddItem ("全年")
cboTime.AddItem ("")
End Sub
Private Function where() As String '查询条件
Dim s As String
If cboI_name.Text <> "" Then
Set rsInstitute = New Recordset
rsInstitute.Open "select * from TbInstitute where I_Name like '" & cboI_name.Text & "'", Modmain.conn, 3, 2
s = " and mid(C_ID,3,2) like '%" & rsInstitute.Fields!I_ID & "%'"
StrInstitute = cboI_name.Text
Else
StrInstitute = ""
End If
If cboTime.Text <> "" Then
If cboTime.Text = "一月" Then
If s <> "" Then
s = s & " and month(Date) like " & 1 & ""
Else
s = " and month(Date) like " & 1 & ""
End If
End If
If cboTime.Text = "二月" Then
If s <> "" Then
s = s & " and month(Date) like " & 2 & ""
Else
s = " and month(Date) like " & 2 & ""
End If
End If
If cboTime.Text = "三月" Then
If s <> "" Then
s = s & " and month(Date) like " & 3 & ""
Else
s = " and month(Date) like " & 3 & ""
End If
End If
If cboTime.Text = "四月" Then
If s <> "" Then
s = s & " and month(Date) like " & 4 & ""
Else
s = " and month(Date) like " & 4 & ""
End If
End If
If cboTime.Text = "五月" Then
If s <> "" Then
s = s & " and month(Date) like " & 5 & ""
Else
s = " and month(Date) like " & 5 & ""
End If
End If
If cboTime.Text = "六月" Then
If s <> "" Then
s = s & " and month(Date) like " & 6 & ""
Else
s = " and month(Date) like " & 6 & ""
End If
End If
If cboTime.Text = "七月" Then
If s <> "" Then
s = s & " and month(Date) like " & 7 & ""
Else
s = " and month(Date) like " & 7 & ""
End If
End If
If cboTime.Text = "八月" Then
If s <> "" Then
s = s & " and month(Date) like " & 8 & ""
Else
s = " and month(Date) like " & 8 & ""
End If
End If
If cboTime.Text = "九月" Then
If s <> "" Then
s = s & " and month(Date) like " & 9 & ""
Else
s = " and month(Date) like " & 9 & ""
End If
End If
If cboTime.Text = "十月" Then
If s <> "" Then
s = s & " and month(Date) like " & 10 & ""
Else
s = " and month(Date) like " & 10 & ""
End If
End If
If cboTime.Text = "十一月" Then
If s <> "" Then
s = s & " and month(Date) like " & 11 & ""
Else
s = " and month(Date) like " & 11 & ""
End If
End If
If cboTime.Text = "十二月" Then
If s <> "" Then
s = s & " and month(Date) like " & 12 & ""
Else
s = " and month(Date) like " & 12 & ""
End If
End If
If cboTime.Text = "第一季度" Then
If s <> "" Then
s = s & " and month(Date) in (1,2,3)"
Else
s = " and month(Date) in (1,2,3)"
End If
End If
If cboTime.Text = "第二季度" Then
If s <> "" Then
s = s & " and month(Date) in (4,5,6)"
Else
s = " and month(Date) in (4,5,6)"
End If
End If
If cboTime.Text = "第三季度" Then
If s <> "" Then
s = s & " and month(Date) in (7,8,9)"
Else
s = " and month(Date) in (7,8,9)"
End If
End If
If cboTime.Text = "第四季度" Then
If s <> "" Then
s = s & " and month(Date) in (10,11,12)"
Else
s = " and month(Date) in (10,11,12)"
End If
End If
If cboTime.Text = "上半年" Then
If s <> "" Then
s = s & " and month(Date) in (1,2,3,4,5,6,)"
Else
s = " and month(Date) in (1,2,3,4,5,6,)"
End If
End If
If cboTime.Text = "下半年" Then
If s <> "" Then
s = s & " and month(Date) in (7,8,9,10,11,12)"
Else
s = " and month(Date) in (7,8,9,10,11,12)"
End If
End If
If cboTime.Text = "全年" Then
If s <> "" Then
s = s & " and month(Date) in (1,2,3,4,5,6,7,8,9,10,11,12)"
Else
s = " and month(Date) in (1,2,3,4,5,6,7,8,9,10,11,12)"
End If
End If
strMonth = cboTime.Text
Else
strMonth = ""
End If
where = s
End Function
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
''将用户统计上机情况的信息记入操作日志 ''
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
Public Sub AddLog(aa As String)
Dim strEvents As String
Set rsOperateLog = New Recordset
rsOperateLog.Open "select * from tbOperateLog", Modmain.conn, 3, 2
Set rsLog = New Recordset
rsLog.Open "select * from tblog where L_ID='" & aa & "'", Modmain.conn, 3, 2
strEvents = rsLog.Fields!Events
rsOperateLog.AddNew
rsOperateLog.Fields!U_ID = frmLoad.StrU_ID
rsOperateLog.Fields!Time = Time
rsOperateLog.Fields!Date = Date
rsOperateLog.Fields!Events = strEvents
rsOperateLog.Fields!Description = strEvents
rsOperateLog.Update
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -