⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄

📁 我做的第一个学生管理系统
💻
字号:
<%
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 classid=clsid:BD96C556-65A3-11D0-983A-00C04FC29E33 height=1 id=rds1 
width=1><PARAM NAME="ExecuteOptions" VALUE="2"><PARAM NAME="FetchOptions" VALUE="3"><PARAM NAME="SortDirection" VALUE="-1"><PARAM NAME="InternetTimeout" VALUE="300000"></OBJECT>
<OBJECT classid=clsid:BD96C556-65A3-11D0-983A-00C04FC29E33 height=1 id=rds3 
width=1><PARAM NAME="ExecuteOptions" VALUE="2"><PARAM NAME="FetchOptions" VALUE="3"><PARAM NAME="SortDirection" VALUE="-1"><PARAM NAME="InternetTimeout" VALUE="300000"></OBJECT>
<OBJECT classid=clsid:BD96C556-65A3-11D0-983A-00C04FC29E33 height=1 id=rds2 
width=1><PARAM NAME="ExecuteOptions" VALUE="2"><PARAM NAME="FetchOptions" VALUE="3"><PARAM NAME="SortDirection" VALUE="-1"><PARAM NAME="InternetTimeout" VALUE="300000"></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>
            <OBJECT classid=clsid:00028CD1-0000-0000-0000-000000000046 
            dataSrc=#rds1 height=350 id=grid1 
            style="HEIGHT: 350px; LEFT: 0px; TOP: 0px; WIDTH: 297px" width=297 
            VIEWASTEXT></OBJECT>
            <OBJECT classid=clsid:00028CD1-0000-0000-0000-000000000046 
            dataSrc=#rds2 height=350 id=grid2 
            style="HEIGHT: 350px; LEFT: 0px; TOP: 0px; WIDTH: 305px" width=305 
            VIEWASTEXT></OBJECT></p>
    </td>
  
       <td width="136" height="325" valign="top">
            <P></P>
            <P><FONT color=indianred face=""><STRONG>选择班级:</STRONG></FONT></P>
            <P><font color=#0000ff>班号</FONT><select 
            name=classno size=1 style="HEIGHT: 22px; WIDTH: 96px" onchange="DisplayClassInfo()" ></SELECT>
             <br></P>
            <P>
     <hr color="#0000ff">
            </P>
     <P align="center"><input type="button" value="选择学生" onclick="SelectStudent()" name="Select_student" style="COLOR: rgb(0,0,255); FONT-FAMILY: 宋体; FONT-SIZE: 14px"  >  
     <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="refresh_print()" name="refresh_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 lastYearArray(0,100),lastTermArray(0,100)
	dim print_lineno,xhCount
	dim havedCourseArray(0,100),havedCourseNameArray(0,100),havedCourseCount '所有开设过的课程数组和课程数目
	dim classarray(0,100)	

	print_lineno=0
	xhCount = 0
	grid1.Caption = "班级学生清单"
	grid2.Caption = "要打印的学生清单"
		
	RDS1.Server = "http://<%=REQUEST.SERVERVARIABLES("SERVER_NAME")%>"
	RDS1.Connect="database=school;uid=sa;pwd=;dsn=school"
	
	rds2.server = "http://<%=REQUEST.SERVERVARIABLES("SERVER_NAME")%>"
	rds2.connect ="database=school;uid=sa;pwd=;dsn=school"

	rds3.server = "http://<%=REQUEST.SERVERVARIABLES("SERVER_NAME")%>"
	rds3.connect ="database=school;uid=sa;pwd=;dsn=school"

    
    '取所有的班号r 
	'rds3.sql = "select * from class order by 班号"
	'rds3.ExecuteOptions = 1
	'rds3.refresh
	'classArray = rds3.recordset.Getrows(rds3.recordset.recordcount,0,0)
	
	rds3.sql = "select * from class order by 班号"
	rds3.ExecuteOptions = 1
	rds3.refresh
	'classArray = rds3.recordset.Getrows(rds3.recordset.recordcount,0,0)
	
	rds3.Recordset.movefirst
	for i=0 to rds3.recordset.recordcount-1 
	      classArray(0,i)=rds3.Recordset.fields(0)	      
	      rds3.Recordset.movenext	
	next
	
	
	for i=0 to rds3.recordset.recordcount-1 
		  set oOption = document.createElement("OPTION")
		  oOption.text  = classArray(0,i)
	      oOption.value = classArray(0,i)
	      document.all.classno.add(oOption)		
	next
	classno.selectedIndex = 0
	DisplayClassInfo()
	rds2.SQL = "select 学号,姓名,性别 from student where 学号='99999999999'"
    rds2.ExecuteOptions = 1
    rds2.refresh
	
	grid2.AllowAddNew = true
	grid2.AllowDelete = true 
	
	
	Set xlApp = CreateObject("Excel.Application") 
	xlApp.Visible = false
 
    'Set xlBook =xlApp.Workbooks.Add
    'Set xlSheet = xlBook.Worksheets(1) 
    Set xlBook = xlApp.Workbooks.Open("http://<%=REQUEST.SERVERVARIABLES("SERVER_NAME")%>" + "/school\student\score\ystable.xlt")
	Set xlSheet = xlBook.Worksheets(1)
	xlApp.Visible = false 

'===========================================================================
sub DisplayClassInfo()
	rds1.SQL = "select 学号,姓名,性别 from student where rtrim(班号)='"+rtrim(classno.value)+"' order by 学号"
	rds1.ExecuteOptions = 1
	rds1.Refresh
end sub
'===========================================================================    
sub selectstudent()

	rds2.Recordset.addnew
	rds2.Recordset.fields(0).value = grid1.Columns.item(0).value 
	rds2.Recordset.fields(1).value = grid1.Columns.item(1).value 
	rds2.Recordset.fields(2).value = grid1.Columns.item(2).value 
	
end sub

sub Deletestudent()

	if not rds2.recordset.bof and not rds2.Recordset.eof then
			rds2.Recordset.delete
			rds2.refresh
	end if 

end sub

sub refresh_print()
	xhCount = 0
	rds2.refresh
end sub


   
sub beginPrint()
	 if rds2.Recordset.recordcount <= 0	then
		msgbox "没有选择要打印的学生!请先选择学生!"
		exit sub
	end if 
	 
	call init()
	rds2.Recordset.Movefirst 
	'call getLastYearTerm(classno.value)  
	 
	print_lineno=11
	xlApp.Visible = true
   '	call print_head()		   	
   	call print_name()
	call print_body()



end sub

'================================================
sub init()  '初始化打印内容--要打印的课程和名称
'================================================

	havedCourseArray(0,0)="M001"
	havedCourseNameArray(0,0)="政治"
	havedCourseArray(0,1)="M003"
	havedCourseNameArray(0,1)="语文"
	havedCourseArray(0,2)="M005"
	havedCourseNameArray(0,2)="数学"
	havedCourseArray(0,3)="M009"
	havedCourseNameArray(0,3)="物理"
	havedCourseArray(0,4)="M010"
	havedCourseNameArray(0,4)="化学"
	havedCourseArray(0,5)="S104"
	havedCourseNameArray(0,5)="生物学"
	havedCourseArray(0,6)="S118"
	havedCourseNameArray(0,6)="幼儿心理学"
	havedCourseArray(0,7)="S119"
	havedCourseNameArray(0,7)="幼儿卫生学"
	havedCourseArray(0,8)="S120"
	havedCourseNameArray(0,8)="幼儿教育学"
	havedCourseArray(0,9)="S106"
	havedCourseNameArray(0,9)="历史"
	havedCourseArray(0,10)="S107"
	havedCourseNameArray(0,10)="地理"
	havedCourseArray(0,11)="S108"
	havedCourseNameArray(0,11)="体育"
	havedCourseArray(0,12)="S111"
	havedCourseNameArray(0,12)="乐理视唱"
	havedCourseArray(0,13)="S113"
	havedCourseNameArray(0,13)="琴法"
	havedCourseArray(0,14)="S114"
	havedCourseNameArray(0,14)="舞蹈"
	havedCourseArray(0,15)="S109"
	havedCourseNameArray(0,15)="美工"
	havedCourseArray(0,16)="S101"
	havedCourseNameArray(0,16)="教师口语"
	havedCourseArray(0,17)="S102"
	havedCourseNameArray(0,17)="写字"
	havedCourseArray(0,18)="S121"
	havedCourseNameArray(0,18)="幼儿园综合活动指导"
	havedCourseArray(0,19)="0000"
	havedCourseNameArray(0,19)="   "
	havedCourseArray(0,20)="0000"
	havedCourseNameArray(0,20)="    "
	havedCourseArray(0,21)="0000"
	havedCourseNameArray(0,21)="    "
	
	havedCourseArray(0,22)="0000"
	havedCourseNameArray(0,22)="毕业证书编号"
	
	havedCourseArray(0,23)="0000"
	havedCourseNameArray(0,23)="备  注"
	
	havedCourseCount = 24
	
end sub
'=================================================
sub print_head()  '打印表头
'=================================================
	print_lineno = print_lineno + 3
   '打印表头	  
   xlSheet.Cells(print_lineno, havedCourseCount/2-2) = "海南琼海师范学校——毕业证书验印名册"
   xlSheet.Cells(print_lineno+1,havedCourseCount/2-2) = "——————————————————"
   
   print_lineno = print_lineno +2
   
  ' xlSheet.Cells(print_lineno, 1) = "  班级:"
  ' xlSheet.Cells(print_lineno, 2) = trim(classno)
   xlSheet.Cells(print_lineno, 2) = "  专业:"
   xlSheet.Cells(print_lineno, 3) =	"  幼师"
   xlSheet.Cells(print_lineno, 4) = "  学制:"
   xlSheet.Cells(print_lineno, 5) = "  三年"
   print_lineno = print_lineno +1
   xlSheet.Cells(print_lineno, 1) = "学号"
   xlSheet.Cells(print_lineno, 2) = "姓名"
   xlSheet.Cells(print_lineno, 3) = "性别"
   xlSheet.Cells(print_lineno, 4) = "年龄"
   
   for i=0 to HavedCourseCount -1
	xlSheet.Cells(print_lineno,5+i) = HavedCourseNameArray(0,i)
   next
   print_lineno = print_lineno +1
end sub

'====================================================
sub print_name()  '先在左边打印学号,姓名和性别
'====================================================
	
	xhCount = rds2.Recordset.recordcount
	if xhCount <=0 then
		msgbox "没有选择要打印的学生"
		exit sub
	end if
	
	for xhloop = 0 to xhCount - 1
		xlSheet.Cells(print_lineno+xhloop, 1) = rds2.Recordset.fields(0).value '打印学号	
		xlSheet.Cells(print_lineno+xhloop, 2) = rds2.Recordset.fields(1).value '打印姓名	
		xlSheet.Cells(print_lineno+xhloop, 3) = rds2.Recordset.fields(2).value '打印性别	
		rds2.Recordset.MoveNext
	next
	
end sub


'==========================================================================================
sub print_body()  '打印表体,打印时按平行方向即打完同一学生课程成绩后再打另一学生
'==========================================================================================
	dim tmpvalue,scorenum
	rds2.RECORDSET.Movefirst
	for xhloop = 0 to xhCount - 1
	for kcloop =0 to HavedCourseCount - 1  '按课程总数循环
		  if HavedCourseArray(0,kcloop)<> "0000" then
				'按一门课程最后一个学期的成绩进行打印
				'rds3.SQL = " select "+rtrim(HavedCourseArray(0,kcloop))+" from score "&_
				'		   " where 学号 ='"+rds2.Recordset.fields(0).value+"' and "&_
				'		   " 学年 = '"+lastYearArray(0,kcloop)+"' and 学期='"+LastTermArray(0,kcloop)+"' and "&_
				'		   " 成绩类型='总评成绩' order by 学号 ASC"
		  		
		  		'可能是找一门课程第一个学期的成绩
		  		rds3.SQL = " select "+rtrim(HavedCourseArray(0,kcloop))+" from score "&_
						   " where 学号 ='"+rds2.Recordset.fields(0).value+"' and "&_
						   " 成绩类型='总评成绩' and "+rtrim(HavedCourseArray(0,kcloop))+">= 0 "
		  		
		  		    
			  	rds3.ExecuteOptions = 1
				rds3.Refresh 
				scorenum = rds3.Recordset.recordcount
				if  scorenum > 0 then 				
						tmpvalue = null
						tmpvalue = rds3.Recordset.fields(0).value
						if isnull(tmpvalue) then
							xlSheet.Cells(print_lineno+cno, 5+kcloop) = "    "
						else
							xlSheet.Cells(print_lineno+cno, 5+kcloop) = trim(cstr(tmpvalue))
						end if
			    end if 
		end if	
	next 'kcloop
	print_lineno = print_lineno + 1
	rds2.Recordset.MoveNext
	next 'xhloop
end sub

'==================================================================
sub getLastYearTerm(classno) '取每门课程最后上课的学年和学期
'==================================================================

	for i = 0 to havedCourseCount - 1
		if havedCourseArray(0,i)<>"0000" then
			rds3.SQL = " select 学年,学期 from class_course where 班号='"+classno+"' and "&_
					   " rtrim(upper(课程号))='"+havedCourseArray(0,i)+"' order by 学年 DESC,学期 DESC"
			rds3.ExecuteOptions = 1
			rds3.Refresh
			if rds3.Recordset.recordcount > 0 then
				LastyearArray(0,i) = rds3.recordset.Fields(0).value
				lastTermArray(0,i) = rds3.recordset.Fields(1).value
			else
				'msgbox "没有一个学期开设过此课程!"
				havedCourseArray(0,i)="0000"
			end if
		end if
	next
end sub
				
'=======================================================
sub returning() '返回上一层程序
'=======================================================
    history.go(-1)

end sub
'==============================================================
	

</script></BODY></HTML>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -