📄
字号:
<%
dim Pri
Pri=CheckUrl("成绩报表管理")
%>
<!--#include virtual="/school/public/CheckUrl.asp"-->
<%
vServer="http://" & Request.ServerVariables("Server_name")
%>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>打印成绩通知单 write by longZhiping on 1999.8.26</title>
<meta name="GENERATOR" content="Microsoft FrontPage 3.0">
</head>
<body background="../../images/di2001.jpg">
<p><font color="#0000a0" size="6"><strong>打印成绩通知单</strong><object id="rds1" classid="clsid:BD96C556-65A3-11D0-983A-00C04FC29E33" width="0" height="0">
</object><object id="rds2" classid="clsid:BD96C556-65A3-11D0-983A-00C04FC29E33" width="0" height="0"></object>
</font><br><img src="../../images/Slidbar.gif" width="760">
<div align="center"><center>
<table border="1" width="760" height="325">
<TR>
<td width="610" height="325" valign="top"><p align="center">
<OBJECT classid=clsid:00028CD1-0000-0000-0000-000000000046
CODEBASE="http://<%=Request.ServerVariables("SERVER_NAME")%>/school/public/tdbg6.ocx"
dataSrc=#rds1 height=350 id=grid1 style="LEFT: 0px; TOP: 0px"
width=600 VIEWASTEXT></OBJECT></p>
</td>
<td width="136" height="325" valign="top">
<P><font color="#0000ff"></font><FONT color=crimson face="">请选择学年学期:</FONT>
</P>
<P><font color="#0000ff">学年<INPUT id=yearno name=yearno
style="FONT-FAMILY: serif; HEIGHT: 21px; LEFT: 18px; TOP: 65px; WIDTH: 61px"></font>
<font color="#0000ff">学期</font><select name="termno" size="1">
<option value="上">上学期
<option value="下">下学期
</select>
</P>
<hr color="#0000a0">
<P align="center"><input type="button" value="开始打印" onclick="beginPrint()" name="start_input" style="COLOR: rgb(0,0,255); FONT-FAMILY: 宋体; FONT-SIZE: 14px" >
<P align="center"><input type="button" value="全部打印" onclick="Allprint()" name="all_print" style="COLOR: rgb(0,0,255); FONT-FAMILY: 宋体; FONT-SIZE: 14px" >
<P align="center"><input type="button" value="全部取消" onclick="AllNoprint()" name="all_no_print" style="COLOR: rgb(0,0,255); FONT-FAMILY: 宋体; FONT-SIZE: 14px" >
<P align="center"><input type="button" value="退出返回" onclick="returning()" name="exiting" style="COLOR: rgb(0,0,255); FONT-FAMILY: 宋体; FONT-SIZE: 14px" >
</P></td></TR>
</table>
</center></div>
<script language="Vbscript">
dim courseNoArray,courseArray,courseSelectArray
dim courseCount,courseSelectCount
dim course_sql
dim total_score
dim print_lineno
print_lineno=0
RDS1.Server = "http://<%=REQUEST.SERVERVARIABLES("SERVER_NAME")%>"
RDS1.Connect="database=school;uid=sa;pwd=;dsn=school"
rds1.SQL = "Execute createTempclass "
rds1.ExecuteOptions = 1
rds1.Refresh
Set xlApp = CreateObject("Excel.Application")
xlApp.Visible = false
Set xlBook =xlApp.Workbooks.Add
Set xlSheet = xlBook.Worksheets(1)
sub beginPrint()
if len(trim(yearno.value))=0 then
msgbox "请先输入学年!"
exit sub
end if
if len(trim(termno.value))=0 then
msgbox "请先选择学期!"
exit sub
end if
rds2.server = "http://<%=REQUEST.SERVERVARIABLES("SERVER_NAME")%>"
rds2.connect ="database=school;uid=sa;pwd=;dsn=school"
'下面从数据库中取得课程名称,课程代码
rds2.sql = "select * from course"
rds2.ExecuteOptions = 1
rds2.refresh
courseArray = rds2.recordset.Getrows(rds2.recordset.recordcount,0,1)
rds2.Recordset.movefirst
courseNoArray= rds2.recordset.Getrows(rds2.recordset.recordcount,0,0)
courseCount = rds2.Recordset.recordcount
xlApp.Visible = true
rds1.recordset.movefirst
allrecords=rds1.Recordset.recordcount
for i =1 to allrecords
if rds1.Recordset.fields(2).value="打 印" then
call ToClassprint(rds1.Recordset.fields(0).value)
end if
rds1.Recordset.movenext
next
msgbox "打印完毕"
rds1.Recordset.movefirst
end sub
sub Allprint()
rds1.recordset.movefirst
allrecords=rds1.Recordset.recordcount
for i =1 to allrecords
rds1.Recordset.fields(2).value="打 印"
rds1.Recordset.movenext
next
rds1.recordset.movefirst
end sub
sub AllNoprint()
rds1.recordset.movefirst
allrecords=rds1.Recordset.recordcount
for i =1 to allrecords
rds1.Recordset.fields(2).value="不打印"
rds1.Recordset.movenext
next
rds1.recordset.movefirst
end sub
'===================================================
sub grid1_BeforeColEdit(colindex,keyascii,cancel)
set colsel = grid1.columns.item(colindex)
select case colsel.caption
case "打印状态"
'colsel.button = true
if grid1.columns.item(colindex).value = "打 印" then
grid1.columns.item(colindex).value = "不打印"
else
grid1.columns.item(colindex).value = "打 印"
end if
cancel = true
case else
cancel = true
end select
end sub
sub ToClassPrint(classno)
'取班级某学期学年的所开课程
call get_course(classno,"CLASS")
if courseSelectCount <=0 then
msgbox "此班没有输入成绩,请运行班级课程模块中的刷新功能或输入成绩!"
exit sub
end if
course_sql = "select 学号,姓名,"
total_score ="("
select_course = 0
for i = 0 to courseSelectCount - 1
course_sql = course_sql +"'"+rtrim(GetCourseName(i))+"'=str("+courseSelectArray(0,i)+",7,1),"
total_score = total_score + courseSelectArray(0,i)+"+"
select_course = select_course + 1
next
total_score = total_score + "0)"
avg_score = total_score+"/"+cstr(select_course)
course_sql = course_sql + "'总成绩'=str("+total_score+",6,1),'平均成绩'=str("+avg_score+",6,2) from score "
course_sql = course_sql +" where 学号 in (select 学号 from student where rtrim(班号)='"+rtrim(classno)+"') and "
course_sql = course_sql + " 学年='"+yearno.value+"' and 学期='"+termno.value+"' and 成绩类型='总评成绩'"
rds2.SQL = course_sql
rds2.ExecuteOptions = 1
rds2.refresh
if rds2.Recordset.recordcount = 0 then
msgbox "对不起,"+classno+"班"+yearno.value+"年"+termno.value+"学期成绩还没有输入无法打印!打印下一班!"
exit sub
end if
xlApp.Visible = true
ToPrintExcel(classno)
end sub
'==============================================================
sub toPrintExcel(classno)
rds2.Recordset.movefirst
while not rds2.Recordset.eof
'先打印每个学生成绩通知单的表头
print_lineno = print_lineno + 3
xlSheet.Cells(print_lineno, courseSelectCount/2) = "成绩通知单"
xlSheet.Cells(print_lineno+1,courseSelectCount/2) = "_________"
xlSheet.Cells(print_lineno+2,2) = "班号:"+classno+" 学号:"+rds2.Recordset.fields(0).value+" 姓名:"+rds2.Recordset.fields(1).value+" 学年: "+yearno.value+" 学期:"+termno.value
print_lineno=print_lineno+3
for k=2 to rds2.Recordset.fields.count-1
xlsheet.cells(print_lineno,k)=rds2.Recordset.fields(k).name
next
for k=2 to rds2.Recordset.fields.count-1
If isnull(rds2.Recordset.fields(k))=false then ' or trim(rds1.Recordset.fields(j))<>"" then
if IsNumeric(rds2.Recordset.fields(k).value) = true Then
xlSheet.Cells(print_lineno+1, k) = trim(cstr(rds2.Recordset.fields(k)))
else
xlSheet.Cells(print_lineno+1, k) = trim(cstr(rds2.Recordset.fields(k)))
End If
end if
next
print_lineno=print_lineno+3
rds2.Recordset.movenext
wend
end sub
'========按班、年级及学号取某学年某学期所开所的课程======
sub get_course(classno,get_type)
courseSelectCount = 0
select case get_type
case "CLASS"
rds2.SQL = " select 课程号 from class_course where 班号='"+classno+"' and "&_
" 学年='"+yearno.value+"' and 学期='"+termno.value+"'"
case "XH"
rds2.SQL = "select a.课程号 from class_course as a,student as b where b.学号>='"+rtrim(startno.value)+"' and "&_
" b.学号<='"+rtrim(endno.value)+"' and b.班号=a.班号 and "&_
" 学年='"+yearno.value+"' and 学期='"+termno.value+"' group by a.课程号"
case "GRADE"
rds2.SQL = " select 课程号 from class_course where 班号 in (select 班号 from class where year(入学年度)='"+rtrim(gradeno.value)+"') and "&_
" 学年='"+yearno.value+"' and 学期='"+termno.value+"' group by 课程号"
end select
'msgbox rds2.sql
rds2.ExecuteOptions = 1
rds2.Refresh
courseSelectCount = rds2.Recordset.recordcount
if courseSelectCount <=0 then
exit sub
end if
courseSelectArray= rds2.recordset.Getrows(rds2.recordset.recordcount,0,0)
end sub
'==============根据序列号从开设课程数组中取课程名称=================
function GetCourseName(cno)
GetCourseName = "No Find"
for loopcount = 0 to courseCount-1
if courseNoArray(0,loopcount) = courseSelectArray(0,cno) then
GetCourseName = courseArray(0,loopcount)
exit for
end if
next
end function
'===========================================================
sub returning()
history.go(-1)
end sub
'==============================================================
</script>
</html>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -