📄 frmcjpb.frm
字号:
VERSION 5.00
Object = "{DD44C0E7-B2CF-11D1-8DD3-444553540000}#1.0#0"; "cell32.ocx"
Begin VB.Form FrmCjpb
Caption = "成绩排榜"
ClientHeight = 6795
ClientLeft = 135
ClientTop = 1545
ClientWidth = 11700
LinkTopic = "Form1"
MaxButton = 0 'False
ScaleHeight = 6795
ScaleWidth = 11700
Begin VB.CommandButton Command4
Caption = "打印(&P)"
Height = 375
Left = 6480
TabIndex = 15
Top = 6360
Width = 1335
End
Begin VB.CommandButton Command1
Caption = "录入附加分(&I)"
Height = 375
Left = 3120
TabIndex = 14
Top = 6360
Width = 1335
End
Begin VB.CommandButton Command2
Caption = "成绩排榜(&S)"
Height = 375
Left = 4800
TabIndex = 13
Top = 6360
Width = 1335
End
Begin VB.CommandButton Command3
Caption = "返回(&X)"
Height = 375
Left = 8160
TabIndex = 12
Top = 6360
Width = 1335
End
Begin CELLLib.Cell Cell1
Height = 5295
Left = 120
TabIndex = 11
Top = 960
Width = 11415
_Version = 65536
_ExtentX = 20135
_ExtentY = 9340
_StockProps = 0
End
Begin VB.Frame Frame1
Caption = "排榜对象"
Height = 735
Left = 120
TabIndex = 0
Top = 120
Width = 11415
Begin VB.ComboBox Combo5
Height = 300
ItemData = "FrmCjpb.frx":0000
Left = 6480
List = "FrmCjpb.frx":001C
Style = 2 'Dropdown List
TabIndex = 5
Top = 320
Width = 975
End
Begin VB.ComboBox Combo2
Height = 300
Left = 3720
Style = 2 'Dropdown List
TabIndex = 4
Top = 320
Width = 1695
End
Begin VB.ComboBox Combo1
Height = 300
Left = 840
Style = 2 'Dropdown List
TabIndex = 3
Top = 320
Width = 1815
End
Begin VB.TextBox Text1
Height = 270
Left = 8520
TabIndex = 2
Text = "2000"
Top = 315
Width = 855
End
Begin VB.TextBox Text2
Height = 270
Left = 10320
TabIndex = 1
Top = 315
Width = 735
End
Begin VB.Label Label4
Caption = "学期:"
Height = 255
Left = 5880
TabIndex = 10
Top = 360
Width = 615
End
Begin VB.Label Label3
Caption = "专业:"
Height = 255
Left = 3120
TabIndex = 9
Top = 360
Width = 615
End
Begin VB.Label Label2
Caption = "系别:"
Height = 255
Left = 240
TabIndex = 8
Top = 360
Width = 735
End
Begin VB.Label Label1
Caption = "年级:"
Height = 255
Left = 7920
TabIndex = 7
Top = 360
Width = 615
End
Begin VB.Label Label5
Caption = "班级:"
Height = 255
Left = 9720
TabIndex = 6
Top = 360
Width = 615
End
End
End
Attribute VB_Name = "FrmCjpb"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Public numColHjcj As Integer, numColZcj As Integer, numColCjbc As Integer, numColZbc As Integer
'合计成绩列号,总成绩列号,成绩榜次列号,总榜次列号
'***************************************************************************************
' 过程:cell_SetString
' 功能:设置Cell控件的String型苏据
'***************************************************************************************
Private Sub cell_SetString(ByRef Cell As Object, ByVal col As Long, ByVal row As Long, ByVal title As String, ByVal newcol As Boolean)
If newcol Then
Cell.DoAppendCol 1
End If
Cell.DoSetCellString col, row, Trim(title)
Cell.DoSetCellAlignment col, row, 36
Cell.DoSetCellReadOnly col, row, True
End Sub
'***************************************************************************************
' 过程:Comand1_Click
' 功能:显示成绩,为录入附加分做准备
'***************************************************************************************
Private Sub Command1_Click()
Dim objRs1 As ADODB.Recordset, objRs2 As ADODB.Recordset
Dim numI As Integer, numcol As Integer, numRow As Integer
Dim strExec As String, strTemp As String
Dim numColPjcj As Integer, numCjgs As Integer
' 平均成绩列,成绩个数
Dim strHjcjGs As String, strPjcjGs As String, strZcjGs As String
' 合计成绩公式,平均成绩公式,总成绩公式(由于用于Cell公式,故定义为String型)
Dim btemp As Boolean
Dim vTemp As Variant
Dim fHjcj As Double
' 合计成绩
If Combo1.Text = "" Or Combo2.Text = "" Or Combo5.Text = "" Or Text1.Text = "" Then
MsgBox "您所指定的对象信息不全,无法查询成绩!", vbCritical, "错误信息"
Else
Set objRs = objCon.Execute("Select * From XKQKB Where kcbmc='" & fSckcbmc(Text1.Text, Combo1.Text, Combo2.Text, Combo5.Text) & "'")
' 根据系别(Combo1)、专业(Combo2)、年级(Text1)和学期(Combo5),从选课情况表查询选课情况
If Not objRs.EOF Then
Cell_Setup Cell1
'开始设置表头
Cell1.DoAppendRow 2
' 添加两行,显示表头
cell_SetString Cell1, 0, 0, "学号", True
Cell1.DoSetColWidth 0, 80
Cell1.DoSetCellAlignment 0, 0, 36
' 居中显示
cell_SetString Cell1, 1, 0, "姓名", True
Cell1.DoSetCellAlignment 0, 0, 36
Cell1.DoJoinCells 0, 0, 0, 1
Cell1.DoJoinCells 1, 0, 1, 1
' 由于课程名和课程计分形式各占一行,表头中的“学号”和“姓名”将同列的两行合并
numcol = 2
' 列编号
For numI = 1 To 10
If objRs("kcbh" & Trim(Str(numI))) <> "" Then
' 第numI个课程为已排定的课程
cell_SetString Cell1, numcol, 0, Trim(fGetKcmc(objRs("kcbh" & Trim(Str(numI))))), True
' 显示课程名称
Select Case Trim(objRs("pffs" & Trim(Str(numI))))
' 根据该课程的评分方式,形成表头内容
Case "0"
cell_SetString Cell1, numcol, 1, "总成绩", False
Case "1"
cell_SetString Cell1, numcol, 1, "理论成绩", False
cell_SetString Cell1, numcol + 1, 1, "实训成绩", True
cell_SetString Cell1, numcol + 2, 1, "总成绩", True
Cell1.DoJoinCells numcol, 0, numcol + 2, 0
numcol = numcol + 2
Case "2"
cell_SetString Cell1, numcol, 1, "学分", False
Case "3"
cell_SetString Cell1, numcol, 1, "考查成绩", False
End Select
numcol = numcol + 1
End If
Next
cell_SetString Cell1, numcol, 0, "合计成绩", True
Cell1.DoJoinCells numcol, 0, numcol, 1
numColHjcj = numcol
' 记忆合计成绩列号
numcol = numcol + 1
cell_SetString Cell1, numcol, 0, "平均成绩", True
Cell1.DoJoinCells numcol, 0, numcol, 1
numColPjcj = numcol
' 记忆平均成绩列号
numcol = numcol + 1
cell_SetString Cell1, numcol, 0, "成绩榜次", True
Cell1.DoJoinCells numcol, 0, numcol, 1
Cell1.DoSetColWidth numcol, 60
numColCjbc = numcol
' 记忆成绩榜次列号
Set objRs1 = objCon.Execute("Select mc From XTCSB Where LB=2")
' 从系统参数表获取附加分名称(用lb=2标示)
Do While Not objRs1.EOF
' 将附加分名称显示到表头位置
numcol = numcol + 1
cell_SetString Cell1, numcol, 0, Trim(objRs1("mc")), True
Cell1.DoJoinCells numcol, 0, numcol, 1
objRs1.MoveNext
Loop
numcol = numcol + 1
cell_SetString Cell1, numcol, 0, "总成绩", True
Cell1.DoJoinCells numcol, 0, numcol, 1
numColZcj = numcol
' 记忆总成绩列号
numcol = numcol + 1
cell_SetString Cell1, numcol, 0, "总成绩榜次", True
Cell1.DoJoinCells numcol, 0, numcol, 1
numColZbc = numcol
' 记忆总榜次列号
'开始显示学号、姓名和已经录入的成绩
strExec = "Select * From " & fSckcbmc(Text1.Text, Combo1.Text, Combo2.Text, Combo5.Text)
If Trim(Text2.Text) <> "" Then
' 按班级排榜,所以形成多级查询语句
strExec = strExec & " Where xh In (Select xh From XSDAB Where nj='" & Trim(Text1.Text) & _
"' And xbbh='" & Trim(fGetXbbh(Combo1.Text)) & "' And zybh='" & Trim(fGetZybh(Combo2.Text)) & _
"' And bj='" & Trim(Text2.Text) & "')"
End If
Set objRs1 = objCon.Execute(strExec)
If objRs1.EOF Then '没有录入过成绩
MsgBox "没有找到成绩数据!", vbCritical, "错误信息"
Else
numRow = 2
Do While Not objRs1.EOF
' 显示成绩
Cell1.DoAppendRow 1
Cell1.DoSetCellString 0, numRow, Trim(objRs1("xh"))
' 学号
Cell1.DoSetCellReadOnly 0, numRow, True
Cell1.DoSetCellString 1, numRow, Trim(fGetXm(objRs1("xh")))
' 姓名(由fGetXm(学号)获得)
Cell1.DoSetCellReadOnly 1, numRow, True
numcol = 2
For numI = 1 To 10
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -