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

📄 userdb2excel_in.asp

📁 1.多种查询方式
💻 ASP
字号:
<%@language=vbscript%>
<%
response.buffer=true
Response.Expires = 0
Response.CacheControl = "Private" 
%>
<!-- #include file=../data/username.inc-->
<!-- #include file=../data/connect.asp-->
<!--#include file=../data/myPrg.asp-->
<!-- #include file=../data/flag.inc-->
<%
newcompanyid = request("companyid")
if newcompanyid = "" then
	call closedatabase
	Response.Write "<script language=javascript>"
	Response.Write "alert(""请先选择公司再做此步操作!"");"
	Response.write "history.go(-1);"
	Response.Write "</script>"
	Response.End
elseif not isnumeric(newcompanyid) then
	call closedatabase
	Response.Write "<script language=javascript>"
	Response.Write "alert(""companyid必须为整数!"");history.go(-1);"
	Response.Write "</script>"
	Response.End
else
	newcompanyid = cint(newcompanyid)  
end if
%>
<%'On Error Resume Next%>
<%const title="入库通知书"%>
<html>
<head>
<title>入库通知书</title>
<link rel=stylesheet type=text/css href=../data/forum.css>
</head>
<%
start_year = Request.Form("start_year")
start_month = Request.Form("start_month")
start_day = Request.Form("start_day")
end_year = Request.Form("end_year")
end_month = Request.Form("end_month")
end_day = Request.Form("end_day")
start_date = start_year&"-"&start_month&"-"&start_day
end_date = end_year&"-"&end_month&"-"&end_day
smallinput = request("dc_id")
if smallinput = "" then 
	smallinput = 0
else
	smallinput = replace(smallinput,"'","’")
end if 
biglocation = request("biglocation")
if biglocation = "" then 
	biglocation = 0
else
	biglocation = replace(biglocation,"'","’")
end if

sia = trim(request("sia"))
sia = replace(sia,"'","’")
oddsia = request("oddsia")
	smalllocation = request("smalllocation")
	if smalllocation = "" then 
		smalllocation = 0
	else
		smalllocation = replace(smalllocation,"'","’")
	end if
	prod_type2 = trim(request("prod_type"))
	prod_type2 = replace(prod_type2,"'","’")
	prod_danwei = trim(request("prod_danwei"))
	prod_danwei = replace(prod_danwei,"'","’")
%>
<body topmargin="0">
<%
Showtitle(title)
%>
<%
sql = "select * from inward,dc,inward_detail,product"
sql = sql + " where inward.inwa_dc_id = dc.dc_id " 
sql = sql + " and inward.inwa_id = inward_detail.idetail_inwa_id " 
sql = sql + " and inward_detail.idetail_prod_id = product.prod_id " 
sql = sql + " and inward.inwa_companyid = "&newcompanyid&" and inward.inwa_date >= #"&start_date&"# and inward.inwa_date <= #"&end_date&"# "
if smallinput <> 0 then
	sql = sql + " and inward.inwa_dc_id = "&smallinput&" "
else
	if flag > 3 then
		sql = sql + " and inward.inwa_dc_id in ("&dcservice&") "
	end if
end if
if biglocation <> 0 and smalllocation = 0 then
	sql = sql + " and product.prod_flag = "&biglocation&" "
end if

if clng(oddsia) = 1 then
	if smalllocation <> 0 then
		sql = sql + " and inward_detail.idetail_prod_id = "&smalllocation&" "
	end if
elseif clng(oddsia) = 2 then
	if prod_type2 <> "" then
		sql = sql + " and product.prod_type = '"&prod_type2&"' "
	end if
	if prod_danwei <> "" then
		sql	= sql + " and product.prod_danwei = '"&prod_danwei&"' "
	end if
end if 
if sia <> "" then
	sql = sql + " and inward.inwa_sia like '%"&sia&"%' "
end if
sql = sql + " order by inward.inwa_id asc"
   set rs = server.CreateObject("adodb.recordset")
   rs.Open sql,conn
  if rs.EOF and rs.BOF then
	response.Write "无记录!"
	response.Write "<a href=""javascript:history.go(-1)""><font size=+2> 后 退 </font></a>"
	response.End 
  else
 
    Set fs = server.CreateObject("scripting.filesystemobject")
  '--假设你想让生成的EXCEL文件做如下的存放
  'filename = "D:\mir_20060618\companyadmin\"&Session("companymanager")&"_online.xls"
  filename =  server.MapPath(""&User&"_online.xls")
  filename2 = "operate\"&User&"_online.xls"
  '--如果原来的EXCEL文件存在的话删除它
  if fs.FileExists(filename) then
    fs.DeleteFile(filename)
  end if
  '--创建EXCEL文件
  set myfile = fs.CreateTextFile(filename,true)
  
  
    dim strLine,responsestr
    strLine=""
      'For each x in rs.fields
      '  strLine= strLine & x.name & chr(9)
      'Next
		 strline = strline & "进仓编号SIA" & chr(9) & "货名" & chr(9) & "单位" & chr(9) & "重量" & chr(9) & "尺码" & chr(9) & "数量" & chr(9) & "物品号" & chr(9) & "管理员" & chr(9)  & "货物情况" & chr(9) & "送货地区" & chr(9) & "送货车牌(拆箱箱号)" & chr(9) & "备注" & chr(9)      
      '--将表的列名先写入EXCEL
      myfile.writeline strLine

      Do while Not rs.EOF
      strLine=""
     
      'for each x in rs.Fields
      '  strLine= strLine & x.value & chr(9)
      'next
      inwa_sia = trim(rs("inwa_sia"))
		if isnumeric(inwa_sia) = true then
			inwa_sia = inwa_sia & "'"
		end if
		idcard = trim(rs("idetail_rec_idcard"))
		if isnumeric(idcard) = true then 
			idcard = idcard & "'"
		end if
      danjia=rs("prod_danjia")
	  no=rs("idetail_no")
	  no1=rs("idetail_rec_no")
	  total=danjia*no
	  total1=danjia*no1
      strLine = strLine & inwa_sia & chr(9) & rs("prod_pinming")& chr(9) & rs("prod_danwei")& chr(9) & rs("prod_weight")& chr(9) & rs("prod_tiji")& chr(9) & rs("idetail_no")& chr(9) & rs("prod_no")& chr(9) & rs("inwa_contact")& chr(9) & rs("inwa_stat")& chr(9) & rs("inwa_sendto")& chr(9) & rs("inwa_sendno")& chr(9) & rs("inwa_ser_beizu")
      '--将表的数据写入EXCEL
      myfile.writeline strLine

      rs.MoveNext
      loop
      
  end if


set myfile = nothing
Set fs=Nothing

link="<A HREF=../"&filename2&">请用鼠标右键点击,然后选择<目标另存为></a>"
Response.write link
rs.Close
set rs = nothing
  call closedatabase
  %>
  <input class=buttonface type="button" name="ok" value="返回"  onclick="javascript:history.go(-1)">
  </form>
</div>
<!--#include file=../data/copyright.asp-->
</body>
</html>

⌨️ 快捷键说明

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