📄 exportdata.asp
字号:
<%@LANGUAGE="VBSCRIPT" CODEPAGE="936"%>
<%
Option Explicit
Response.Buffer = True
Response.Expires = 0
Response.Expiresabsolute = Now() - 1
Response.AddHeader "pragma","no-cache"
Response.AddHeader "cache-control","private"
Response.CacheControl = "no-cache"
%>
<!--#include file="Connections/conn.asp" -->
<!--登录权限判断,Session和MD5加密判断-->
<%
Rem Session("CRM_account") 用户帐号
Rem Session("CRM_name") 用户名
Rem Session("CRM_level") 用户等级
If Session("CRM_account") = "" Or Session("CRM_name") = "" Or Session("CRM_level") <= 0 Then Response.Redirect("login.asp")
Dim strCounter,strToPrint
Dim dataItem,beginData,endData
dataItem = Trim(Request("dataItem"))
beginData = Trim(Request("beginData"))
endData = Trim(Request("endData"))
If beginData = "起始数据" Then beginData = ""
If endData = "结束数据" Then endData = ""
Function getUserList(intLevel,intGroup)
Dim rs,strUserList
strUserList = "'" & Session("CRM_name") & "'"
Set rs = Server.CreateObject("ADODB.Recordset")
rs.Open "Select * From baidu_user Where uLevel < " & intLevel & " And uGroup = " & intGroup,conn,3,1
Do While Not rs.BOF And Not rs.EOF
If strUserList = "" Then
strUserList = "'" & rs("uName") & "'"
Else
strUserList = strUserList & ",'" & rs("uName") & "'"
End If
rs.MoveNext
Loop
rs.Close
Set rs = Nothing
getUserList = strUserList
End Function
Function getItem(dataItem)
If dataItem = "" Then
getItem = ""
Else
Select Case dataItem
Case "caddress"
getItem = "公司地址"
Case Else
getItem = ""
End Select
End If
End Function
Dim flag
flag = 0
If dataItem <> "" Then
strToPrint = strToPrint & " <tr>" & VBCrlf
strToPrint = strToPrint & " <td width=""60"" align=""center"" bgcolor=""menu"">编号</td>" & VBCrlf
strToPrint = strToPrint & " <td align=""center"" bgcolor=""menu"">邮政编码</td>" & VBCrlf
strToPrint = strToPrint & " <td align=""center"" bgcolor=""menu"">公司名称</td>" & VBCrlf
strToPrint = strToPrint & " <td width=""80"" align=""center"" bgcolor=""menu"">" & getItem(dataItem) & "</td>" & VBCrlf
If Session("CRM_level") = 9 Then
strToPrint = strToPrint & " <td width=""80"" align=""center"" bgcolor=""menu"">业务员</td>" & VBCrlf
End If
strToPrint = strToPrint & " </tr>" & VBCrlf
Dim fso,f,fl
Set fso = Server.CreateObject("Scripting.FileSystemObject")
fl = Server.MapPath("Connections/data.csv")
If fso.FileExists(fl) Then
fso.DeleteFile(fl)
Set f = fso.CreateTextFile(fl)
f.WriteLine("邮编,公司名称,公司地址,联系人,职位,电话,传真,邮箱,手机,客户类型")
Else
Set f = fso.CreateTextFile(fl)
f.WriteLine("邮编,公司名称,公司地址,联系人,职位,电话,传真,邮箱,手机,客户类型")
End If
Dim rs
Set rs = Server.CreateObject("ADODB.Recordset")
Select Case dataItem
Case "caddress"
If beginData = "" And endData = "" Then
If Session("CRM_level") = 9 Then
rs.Open "Select * From baidu_client Order By cId Desc",conn,3,1
Else
rs.Open "Select * From baidu_client Where cUser = '" & Session("CRM_name") & "' Order By cId Desc",conn,3,1
End If
Else
If beginData = "" Then beginData = endData
If Session("CRM_level") = 9 Then
rs.Open "Select * From baidu_client Where caddress Like '%" & beginData & "%' Order By cId Desc",conn,3,1
Else
rs.Open "Select * From baidu_client Where caddress Like '%" & beginData & "%' And cUser = '" & Session("CRM_name") & "' Order By cId Desc",conn,3,1
End If
End If
Case Else
End Select
Do While Not rs.BOF And Not rs.EOF
strToPrint = strToPrint & " <tr>" & VBCrlf
strToPrint = strToPrint & " <td width=""60"" align=""center"">" & rs("cId") & "</td>" & VBCrlf
strToPrint = strToPrint & " <td width=""60"">" & rs("czip") & "</td>" & VBCrlf
strToPrint = strToPrint & " <td width=""240"">" & rs("cCompany") & "</td>" & VBCrlf
strToPrint = strToPrint & " <td width=""240""><a href=""view.asp?cId=" & rs("cId") & """>" & rs(dataItem) & "</a></td>" & VBCrlf
If Session("CRM_level") = 9 Then
strToPrint = strToPrint & " <td>" & rs("cUser") & "</td>" & VBCrlf
End If
f.WriteLine(rs("cZip") & "," & rs("cCompany") & "," & rs(dataItem) & "," & rs("cLinkman") & "," & rs("czhiwei") & "," & rs("ctel") & "," & rs("cfax") & "," & rs("cemail") & "," & rs("cshouji") & "," & rs("ctype"))
rs.MoveNext
Loop
rs.Close
Set rs = Nothing
f.CLose
Set f = Nothing
Set fso = Nothing
flag = 1
End If
%>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<meta name="Author" content="http://127.0.0.1">
<meta name="Date" content="2007-08">
<title>客户资料收集系统</title>
<link href="myStyle.css" rel="stylesheet" type="text/css">
<link rel="stylesheet" href="images/test.css" type="text/css">
<script language="JavaScript">
<!--
function showHideHead(strSrc)
{
var strFile = strSrc.substring(strSrc.lastIndexOf("/"),strSrc.length);
if (strFile == "/arrow_up.gif"){
oHead.style.display = "none";
oHeadCtrl.src = "images/arrow_down.gif";
oHeadCtrl.alt = "显示头部";
oHeadBar.title = "显示头部";
}
else {
oHead.style.display = "block";
oHeadCtrl.src = "images/arrow_up.gif";
oHeadCtrl.alt = "隐藏头部";
oHeadBar.title = "隐藏头部";
}
}
if (this.location.href == top.location.href){
top.location.href = "";
}
function checkInput()
{
if (document.exportForm.dataItem.value == ""){
alert("请选择要导出的数据种类。");
document.exportForm.dataItem.focus();
return false;
}
}
-->
</script>
<style type="text/css">
<!--
a:link {
font-family: "宋体";
font-size: 12px;
color: #005288;
text-decoration: none;
}
a:visited {
font-family: "宋体";
font-size: 12px;
color: #005288;
text-decoration: none;
}
a:hover {
font-family: "宋体";
font-size: 12px;
color: #005288;
text-decoration: underline;
}
a:active {
font-family: "宋体";
font-size: 12px;
color: #005288;
text-decoration: none;
}
-->
</style>
</head>
<body style="background-color: menu;" >
<table width="100%" height="100%" border="0" cellpadding="0" cellspacing="0">
<tr id="oHead" style="display: block;">
<td height="1" valign="top"> <table width="778" border="0" cellspacing="0" cellpadding="0">
<tr>
<td height="5"><img src="images/null.gif" width="1" height="1"></td>
</tr>
</table>
<table width="100%" border="0" cellpadding="0" cellspacing="0" bgcolor="menu">
<tr>
<td align="left" background='images/tab_top_background_runner.gif'>
<table width="5" border="0" align="left" cellpadding="0" cellspacing="0">
<tr >
<td height="20"><img src="images/icon-default.gif" width="16" height="15" class="button" onclick="javascript:window.parent.testframeset.cols = '110,*';" vspace="2" hspace="1" alt="恢复左栏默认宽度"></td>
<td height="15" width=40> </td>
</tr>
</table>
<table width="5" border="0" align="left" cellpadding="0" cellspacing="0">
<tr>
<td><img src="images/null.gif" width="1" height="1"></td>
</tr>
</table>
<table onclick="window.location.replace('listAll.asp')" style="cursor: hand;" border="0" cellspacing="0" cellpadding="0" align="left">
<tr >
<td><img src="images/tab_off_left.gif" width="16" height="24"></td>
<td background="images/tab_off_middle.gif">查看所有数据</td>
<td><img src="images/tab_off_right.gif" width="16" height="24"></td>
</tr>
</table>
<table onclick="window.location.replace('addData.asp')" style="cursor: hand;" border="0" cellspacing="0" cellpadding="0" align="left">
<tr>
<td><img src="images/tab_off_left.gif" width="16" height="24"></td>
<td background="images/tab_off_middle.gif">添加数据</td>
<td><img src="images/tab_off_right.gif" width="16" height="24"></td>
</tr>
</table>
<table onclick="window.location.replace('advanceSearch.asp')" style="cursor: hand;" border="0" cellspacing="0" cellpadding="0" align="left">
<tr>
<td><img src="images/tab_off_left.gif" width="16" height="24"></td>
<td background="images/tab_off_middle.gif">高级搜索</td>
<td><img src="images/tab_off_right.gif" width="16" height="24"></td>
</tr>
</table>
<table onclick="window.location.replace('dataForm.asp')" style="cursor: hand;" border="0" cellspacing="0" cellpadding="0" align="left">
<tr>
<td><img src="images/tab_off_left.gif" width="16" height="24"></td>
<td background="images/tab_off_middle.gif">拜访查询</td>
<td><img src="images/tab_off_right.gif" width="16" height="24"></td>
</tr>
</table>
<table onclick="window.location.replace('exportData.asp')" style="cursor: hand;" border="0" cellspacing="0" cellpadding="0" align="left">
<tr>
<td><img src="images/tab_on_left.gif" width="16" height="24"></td>
<td background="images/tab_on_middle.gif">数据导出</td>
<td><img src="images/tab_on_right.gif" width="16" height="24"></td>
</tr>
</table>
<% If Session("CRM_level") = 9 Then %>
<table onclick="window.location.replace('transData.asp')" style="cursor: hand;" border="0" cellspacing="0" cellpadding="0" align="left">
<tr>
<td><img src="images/tab_off_left.gif" width="16" height="24"></td>
<td background="images/tab_off_middle.gif">数据转移</td>
<td><img src="images/tab_off_right.gif" width="16" height="24"></td>
</tr>
</table>
<table onclick="window.location.replace('manageUser.asp')" style="cursor: hand;" border="0" cellspacing="0" cellpadding="0" align="left">
<tr>
<td><img src="images/tab_off_left.gif" width="16" height="24"></td>
<td background="images/tab_off_middle.gif">用户管理</td>
<td><img src="images/tab_off_right.gif" width="16" height="24"></td>
</tr>
</table>
<table onclick="window.location.replace('system_level.asp')" style="cursor: hand;" border="0" cellspacing="0" cellpadding="0" align="left">
<tr>
<td><img src="images/tab_off_left.gif" width="16" height="24"></td>
<td background="images/tab_off_middle.gif">系统设置</td>
<td><img src="images/tab_off_right.gif" width="16" height="24"></td>
</tr>
</table>
<% End If %>
<table onclick="window.location.replace('logout.asp')" style="cursor: hand;" border="0" cellspacing="0" cellpadding="0" align="right">
<tr>
<td><img src="images/tab_off_left.gif" width="16" height="24"></td>
<td background="images/tab_off_middle.gif">注销</td>
<td><img src="images/tab_off_right.gif" width="16" height="24"></td>
</tr>
</table>
<table onclick="window.location.reload();" style="cursor: hand;" border="0" cellspacing="0" cellpadding="0" align="right">
<tr>
<td><img src="images/tab_off_left.gif" width="16" height="24"></td>
<td background="images/tab_off_middle.gif">刷新</td>
<td><img src="images/tab_off_right.gif" width="16" height="24"></td>
</tr>
</table></td>
</tr>
</table>
<table width="100%" border="0" cellpadding="0" cellspacing="0">
<tr>
<td height="5"><img src="images/null.gif" width="1" height="1"></td>
</tr>
<tr>
<td bgcolor="#1E75CF"> </td>
</tr>
</table>
<table width="100%" border="0" cellpadding="5" cellspacing="0" bgcolor="#FFFFFF">
<form name="exportForm" action="?" method="post" onSubmit="return checkInput();">
<tr>
<td width="40" align="right"> </td>
<td>请选择导出数据项目:
<select name="dataItem" id="dataItem">
<option value="caddress">客户信息</option>
</select>
<br>
请选择导出数据范围:
<input name="beginData" type="text" id="beginData" value="" size="16" maxlength="36" onFocus="this.value='';">
-
<input name="endData" type="text" id="endData" value="" size="16" maxlength="36" onFocus="this.value='';">
<input type="submit" name="Submit" value=" 导 出 ">
<hr size="1" noshade>
<span class="emRed">说明:</span><br>
导出数据范围,可以限定一个数据列表范围,例如要导出包含有字符“上海”的地址,在“起始数据”中输入“上海”即可。<br>
如果“起始数据”和“结束数据”均留空,将导出全部数据。</td>
</tr>
</form>
</table>
</td>
</tr>
<tr>
<td height="16" align="center" bgcolor="#1E75CF" id="oHeadBar" style="cursor: hand;" title="隐藏头部" onClick="return showHideHead(document.all.oHeadCtrl.src);">
<img src="images/arrow_up.gif" alt="隐藏头部" width="16" height="16" align="absmiddle" id="oHeadCtrl"> </td>
</td>
</tr>
<tr>
<td valign="top" bgcolor="#FFFFFF" style="padding: 10px;">
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td><% = strCounter %></td>
</tr>
</table><BR>
<table width="100%" align="center" border="1" cellpadding="3" cellspacing="0" bordercolor="#DCDCDC" bordercolordark="#FFFFFF"><% = strToPrint %>
</table><BR>
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td><% = strCounter %></td>
</tr>
</table></td>
</tr>
</table>
<%
If flag = 1 Then
Response.Write("<script>window.open('Connections/data.csv','','');</script>")
End If
%>
</body>
</html>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -