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

📄 exporttoexcelwhs.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"

strwhere=strwhere&" and model like '%"&Request.Form("Contain")&"%'"

if Request.Form("locationtype")<>"" then
	strwhere=strwhere&" and locationtype="&Request.Form("locationtype")
end if

if Request.Form("whse")<>"" then
	strwhere=strwhere&" and whseid="&Request.Form("whse")
end if

if Request.Form("producttype")<>"" then
	strwhere=strwhere&" and producttype="&Request.Form("producttype")
end if

if Request.Form("account")<>"" then
	strwhere=strwhere&" and manufacturer="&Request.Form("account")
end if

if Request.Form("nonnet")<>"" then
	strwhere=strwhere&" and nonnet="&Request.Form("nonnet")
end if

if Request.Form("storedays")<>"" then
	strwhere=strwhere&" and days>"&Request.Form("storedays")
end if

if Request.Form("recentsaledays")<>"" then
	strwhere=strwhere&" and recentsaledays>"&Request.Form("recentsaledays")
end if

if Request.Form("orderby")<>"" then
	strwhere=strwhere&" order by "&Request.Form("orderby")&" "&Request.Form("orderbymethod")
end if

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

sql="select * from vw_product_location where qty_on_hand>0  "&strwhere

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= "No." & chr(9)&"名称"&chr(9)&"型号"&chr(9)&"仓库"&chr(9)&"货位"&chr(9)&"数量"&chr(9)&"平均成本"&chr(9)&"非净"&chr(9)&"在库时间"&chr(9)&"最近销售时间"
        
        myfile.writeline strLine
        i=1
        totalqty=0
		totalcost=0
        Do while Not rs.EOF
        strLine=""
			if rs("nonnet") then
				strnonnet="是"
			else
				strnonnet="否"
			end if
			if objcheck.CheckUserFunction2("viewcost","read") then
				strcost=rs("averagecost")
			else
				strcost=""
			end if
			if rs("recentsaledays")>38000 then
				recentsaledays="未销售"
			else
				recentsaledays=rs("recentsaledays")
			end if
             strLine= i&chr(9)&rs("name") & chr(9)&rs("model") & chr(9)&rs("whse")& chr(9)&rs("location")& chr(9)&rs("qty_on_hand")& chr(9)&strcost& chr(9)&strnonnet& chr(9)&rs("days")& chr(9)&recentsaledays
                myfile.writeline strLine  
		totalqty=totalqty+rs("qty_on_hand")
		totalcost=csng(totalcost)+csng(strcost)*csng(rs("qty_on_hand"))
        i=i+1     
        rs.MoveNext
        loop
             strLine= "合计"&chr(9)&chr(9)&chr(9)& chr(9)&chr(9)&totalqty& chr(9)&totalcost& chr(9)& chr(9)
             myfile.writeline strLine   
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 width="43%">&nbsp; </td>
      <td width=10%>&nbsp;</td>
      <td width="47%"> <div align="right"> 
        </div></td>
    </tr>
    <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>
<%set objcheck=nothing%>

⌨️ 快捷键说明

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