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

📄

📁 我做的第一个学生管理系统
💻
字号:
<%
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=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">
            <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>
    </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>&nbsp;&nbsp;&nbsp;&nbsp;
    <font color="#0000ff">学期</font><select name="termno" size="1">
      <option value="上" selected>上学期
      <option value="下">下学期
    </select>
       <br><FONT color=mediumblue face="">及格分数<INPUT id=jg_num name=jg_num value="60"
            style="FONT-FAMILY: serif; HEIGHT: 21px; LEFT: 18px; TOP: 65px; WIDTH: 36px"></FONT>
 
     </P>
     <hr color="#0000ff">
     <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 courseNoArray(0,100),courseArray(0,100),courseSelectArray(0,100)
	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 

    rds2.sql = "select * from course"
	rds2.ExecuteOptions = 1
	rds2.refresh
	courseCount = rds2.Recordset.recordcount 
	rds2.Recordset.movefirst
	for i=0 to rds2.recordset.recordcount-1 
	      courseArray(0,i)=rds2.Recordset.fields(1)
	      courseNoArray(0,i)=rds2.Recordset.fields(0)
	      rds2.Recordset.movenext	
	next
	
	vp.Preview = true
	vp.StartDoc 
	
	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
	rds1.Recordset.movefirst
	vp.EndDoc 
	vp.SaveDoc "c:\xkprint.prn"
	window.open "http://<%=REQUEST.SERVERVARIABLES("SERVER_NAME")%>/school/public/print.asp"
	
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 成绩类型='总评成绩' order by 学号"


	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)
   ' xlApp.Visible = false

end sub

'==============================================================
sub ToPrintExcel(classno)
	rds2.Recordset.movefirst
    
    while not rds2.Recordset.eof
    if not checkall() then
		'先打印每个学生补考通知单的表头
		print_lineno = print_lineno + 3
		'xlSheet.Cells(print_lineno, 2) = "补考成绩通知单"
		'xlSheet.Cells(print_lineno+1, 2) = "_________"
		'xlSheet.Cells(print_lineno+2, 2) = "班号:"+classno+"  学号:"+rds2.Recordset.fields(0).value+"  姓名:"+rds2.Recordset.fields(1).value+" 学年: "+yearno.value+" 学期:"+termno.value

		head1 = "班号:"&trim(classno) &"  学号:" & trim(rds2.Recordset.fields(0).value) & "  姓名:" & trim(rds2.Recordset.fields(1).value)
		head2 =  "  "+trim(yearno.value) & "年" & trim(termno.value) & "学期"
		vp.header="|琼海师范学校补考通知单" & vbLf & head1 & head2 & "|"
	
		formatstr = ""
		headstr = ""
		
		print_lineno=print_lineno+3
		for k=2 to rds2.Recordset.fields.count-2 
		  if isnull(rds2.Recordset.fields(k)) = false then
			
			If cint(rtrim(rds2.Recordset.fields(k)))<cint(rtrim(jg_num.value)) then   		   
			'xlsheet.cells(print_lineno,k+1)=rds2.Recordset.fields(k).name
				formatstr = formatstr + "^+800|"
				headstr = headstr +rds2.Recordset.fields(k).name+"|" 
			end if		  	 
		    end if
		next 

		onelinestr = ""
		for k=2 to rds2.Recordset.fields.count-2 
			if isnull(rtrim(rds2.Recordset.fields(k))) = true then
				'onelinestr = onelinestr + "0|"
				'msgbox "null"
	    	else 
	    		If cint(rtrim(rds2.Recordset.fields(k)))<cint(rtrim(jg_num.value)) then   		   
          
				if IsNumeric(rds2.Recordset.fields(k).value) = true  Then
    
                   'xlSheet.Cells(print_lineno+1, k + 1) = trim(cstr(rds2.Recordset.fields(k)))
                   onelinestr = onelinestr + trim(cstr(formatnumber(rds2.Recordset.fields(k),0))) + "|"
               
				else        

					'xlSheet.Cells(print_lineno+1, k + 1) = trim(cstr(rds2.Recordset.fields(k)))
					onelinestr = onelinestr + trim(cstr(rds2.Recordset.fields(k)))+"|"

				end if
			end if  
		  end if
		next
 
		 print_lineno=print_lineno+3
		 vp.AddTable formatstr,headstr,onelinestr,,,false
		 vp.NewPage 
	end if 
    rds2.Recordset.movenext
 
 wend 
end sub
'=======================================================

function checkall()'检查学生是否有不及格课程
		checkall = true
		for k=2 to rds2.Recordset.fields.count-2 
   
			If isnull(rds2.Recordset.fields(k))=false  then   
				if cint(rtrim(rds2.Recordset.fields(k)))<cint(rtrim(jg_num.value)) then
					'msgbox rds2.Recordset.fields(k) +"----"+jg_num.value
					checkall =false
					exit for
				end if
			end if
     
		next 
end function
'========按班、年级及学号取某学年某学期所开所的课程======
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) 
	rds2.Recordset.movefirst
	for i=0 to rds2.recordset.recordcount-1 
	      courseSelectArray(0,i)=rds2.Recordset.fields(0)	      
	      rds2.Recordset.movenext	
	next
	
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>
<OBJECT classid=clsid:6E84D662-9599-11D2-9367-20CC03C10627 height=1 id=vp width = 1  
  CODEBASE="http://<%=Request.ServerVariables("SERVER_NAME")%>/school/public/VsVIEW6.ocx" VIEWASTEXT>

</OBJECT>
</BODY>
</HTML>

⌨️ 快捷键说明

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