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

📄 exporttoexcelcalendar.asp

📁 1 除掉了 时间 限制 2 除掉了 人数 限制 改为 500人 原为5人 3 发现一点小缺陷 增加人员的时候没有判断 登陆名是否重复! 自己写吧~~~:) 4 又 是一点缺陷
💻 ASP
字号:
<!--#include file="../config.ini" -->
<!--#include file="../commfunction.inc" -->
<%
Dim objcheck
Set objcheck=Server.CreateObject("SmartSales.CheckFunction")
objcheck.CheckUserFunction "report","read"
set objcheck=nothing

if Request.Form("selusername")<>"" then
	strwhere =strwhere&" and AssignedTo='"&Request.Form("selusername")&"'"
else
	strwhere =strwhere &"and (AssignedTo='"&session("loginid")&"' or AssignedTo in(select userid from v_userreportto_all where reportto='"&session("loginid")&"'))"
end if

'所有未完成日程
	if Request.Form("stattype")="uncomplete" then
		strwhere=strwhere&" and closed='0'"
'所有完成日程
	elseif Request.Form("stattype")="complete" then
		strwhere=strwhere&" and closed='1'"
	end if

if Request.Form("relativetype")="其他" then
	if  Request.Form("TaskType2")<>"" then
		strwhere=strwhere&" and TaskTypeId="&Request.Form("TaskType2")
	else
		strwhere=strwhere&" and relativetype = '其他'"		
	end if
elseif Request.Form("relativetype")="客户" then
	if  Request.Form("TaskType1")<>"" then
		strwhere=strwhere&" and TaskTypeId = '"&Request.Form("TaskType1")&"'"
	else
		strwhere=strwhere&" and relativetype = '客户'"		
	end if
end if

if Request.Form("startdate")<>"" then
	strwhere=strwhere&" and createdate>='"&Request.Form("startdate")&"'"
end if

if  Request.Form("enddate")<>"" then
	strwhere=strwhere&" and createdate<='"&Request.Form("enddate")&"'"
end if

dim conn
dim rs 
set conn=server.CreateObject("adodb.connection")
set rs=server.CreateObject("adodb.recordset")
conn.Open connstring

sql="select * from v_Schedule where 1=1 "&strwhere&" order by AssignedTo,Schedule"
'response.write "select * from v_Schedule where 1=1 "&strwhere&" order by AssignedTo,Schedule"
rs.Open sql,conn,1,1

Set fs = server.CreateObject("scripting.filesystemobject")
filename = Request.ServerVariables("APPL_PHYSICAL_PATH") & "report\excel\"&session("loginid")&".xls"
if fs.FileExists(filename) then
        fs.DeleteFile(filename)
end if

set myfile = fs.CreateTextFile(filename,true)
if not rs.EOF and not rs.BOF then
        dim strLine,responsestr
        strLine=""
        strLine= "待做者" & chr(9)&"主题"&chr(9)&"日程类型"&chr(9)&"日程时间"&chr(9)&"相关"&chr(9)&"创建日期"&chr(9)&"状态"&chr(9)
        
        myfile.writeline strLine
        i=1
        Do while Not rs.EOF
        strLine=""
			if rs("closed") then
				strstatus="完成" 
			else
				strstatus="未完成"
			end if

			if rs("relativetype")="其他" then
				relativetypename=rs("relativetype")
			else	
				relativetypename=rs("account")
			end if
				

		if rs("username")<>previous then	
             strLine= rs("username")
                myfile.writeline strLine  
		end if
             strLine= ""&chr(9)&rs("Schedule") & chr(9)&rs("TaskType")& chr(9)&rs("ScheduleDate")& chr(9)&relativetypename& chr(9)&rs("createdate") & chr(9)&strstatus & chr(9)
                myfile.writeline strLine 

        i=i+1     
		previous=rs("username")
        rs.MoveNext

       loop
end if

%>
<html>
<head>
<LINK href="../global.css" rel=STYLESHEET type=text/css>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>导出为EXCEL</title>
</head>
<body leftmargin="10" rightmargin="0" topmargin="10">
<form name="form1" method="post" action="account.asp">
  <table width="100%" height="20" border="0" cellpadding="0" cellspacing="0">
    <tr> 
      <td height="25" colspan=3><div align="center"><strong><font size="2" class=title>导出为EXCEL</font></strong></div></td>
    </tr>
    <tr > 
      <td height="16" colspan="3" background="../images/title.gif">&nbsp;</td>
    </tr>
	<tr><td  colspan="3" height=4></td></tr>
  </table>
  <table width="100%" border="0" cellpadding="0" cellspacing="1" bgcolor="#DECFAD">
    <tr bgcolor="#EFEFEF"> 
      <td height=25 align=center><a href="excel\<%=session("loginid")%>.xls">文件下载</a></td>
    </tr>
    </table>
</body>
</html>

⌨️ 快捷键说明

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