网站公告列表

  没有公告

加入收藏
设为首页
联系站长
您现在的位置: 网络学院 >> 程序设计 >> VB编程 >> 文章正文
  一个动态rowspan的二维报表            【字体:
一个动态rowspan的二维报表
作者:佚名    文章来源:不详    点击数:    更新时间:2007-8-6    
正在装载数据……

<%@ Language=VBScript %>
<%Option Explicit%>
<!-- #include file="../../inc/config.asp" -->
<!-- #include file="../../inc/check.asp" -->
<!-- #include file="../../inc/public.asp" -->
<!-- #include file="../../inc/vbconn.asp" -->
<!-- #include file="../../inc/Report.asp" -->
<%
'********************************************************************
' Description:                        
'                                                                  
' Author:                                                          
'                                                                  
' Date:                                                            
'********************************************************************
'Call Check(8,1)
Dim rs,rs1,ttl,sql
Dim mydat,fdt,sdt,edt,tim
Dim provide,cls,stime1,stime2,num1,mon1,prc1,mon2,mon3,mon4,area,cdt
dim zsum,zmon,zsumber,zmoney,xmoney,dzmoney,cmoney,sqmoney,tmoney,leixing
Set rs=Server.CreateObject("ADODB.Recordset")
rs.ActiveConnection=conn
rs.CursorType=adOpenForwardOnly
rs.LockType=adLockReadOnly
ttl=Application("Sys_Co_Name")&"水泥包装发货日报表"

stime1=Cdate(getForm("stime1","str",""))
stime2=Cdate(getForm("stime2","str",""))
leixing=getform("leixing","str","")
area=getform("area","str","")

If Len(area)>0 Then cdt=cdt&"  and a.fid='"&area&"' "
'品种数组

 %>

<HTML>
<HEAD>
<META NAME="GENERATOR" Content="Microsoft Visual Studio 6.0">
<LINK rel="stylesheet" type="text/css" href="../../css/main.css">
<LINK rel="stylesheet" type="text/css" href="../../css/scdd.css">
<SCRIPT LANGUAGE=javascript src='../../js/Report.js'></SCRIPT>
<title><%=ttl%></title>

</HEAD>
<BODY>
<h2 align=center><%=ttl%></h2>
<TABLE WIDTH=80% BORDER=0 CELLSPACING=0 CELLPADDING=0>
<TR>
<TD width="10%" NOWRAP align=left>&nbsp;&nbsp;单位:吨</TD>
<TD width="10%" NOWRAP align=right><%=stime1%>至<%=stime2%>&nbsp;</TD>
</TR>
</table>
 <% 
  response.write  ("<TABLE cellSpacing=0 cellPadding=0 width='80%' class=pTable>")
 response.write ("<tr>")
  response.write ("<td nowrap width='5%' >生产线</td>")
  response.write ("<td nowrap width='9%' >水泥品种</td>")
  response.write ("<td nowrap width='9%' >外销数量</td>")
  response.write ("<td nowrap width='9%' >自用数量</td>")
  response.write ("<td nowrap width='9%' >总计数量</td>")
  response.write ("<td nowrap width='9%' >本月累计</td>")
 response.write ("</tr>")

dim myarray1,row1,i
sql="select  distinct a.fid,a.area from X_site a join x_sell b on a.fid=b.area "
 sql=sql&" where a.del=0 and b.stime between '"&stime1&"' and '"&stime2 &"' " &cdt
 sql=sql&" order by a.area "
  rs.open sql
 if not rs.eof then
    myarray1=rs.getrows()
Else
 myarray1=""
End If
If IsArray(myarray1) then
 row1=ubound(myarray1,2)
 else
    row1=-1
 end if
 rs.close

For i=0 To row1

 Dim myarray2,row2,j
sql="select distinct(x.name),a.grup from x_sell a left join X_material x on a.mtr=x.fid where a.area='"&myarray1(0,i)&"' and a.stime between '"&stime1&"' and '"&stime2 &"'  "
rs.open sql
If Not rs.eof Then
 myarray2=rs.getrows()
Else
 myarray2=""
End If
If IsArray(myarray2) Then
 row2=UBound(myarray2,2)
Else
 row2=-1
End If
rs.close
 response.write "<tr>"
 response.write "<td  width='5%' align=center rowspan='"&row2+1&"'>&nbsp;"&myarray1(1,i)&"</td>"

 For j=0 To row2
   response.write ("<td nowrap width='6%' align=center>&nbsp;"&myarray2(0,j)&"</td>")


  sql="select isnull(sum(a.number),0) as number1 from P_Organi p join x_sell a on p.fid=a.customer where p.leixing='1' and a.stime between '"&stime1&"' and '"&stime2 &"'and a.grup='"&myarray2(1,j)&"' and a.area='"&myarray1(0,i)&"'"
  rs.open sql
  If Not rs.eof Then
   Dim number1 '定义外销数量
   number1=CDbl(rs("number1"))
  End If
  rs.close
   response.write ("<td nowrap width='6%' align=center>&nbsp;"&formatnum2(number1,2)&"</td>")
  sql="select isnull(sum(a.number),0) as number2 from P_Organi p join x_sell a on p.fid=a.customer where p.leixing='2' and a.stime between '"&stime1&"' and '"&stime2 &"'and a.grup='"&myarray2(1,j)&"' and a.area='"&myarray1(0,i)&"'"
  rs.open sql
  If Not rs.eof Then
   Dim number2 '定义自用数量
   number2=CDbl(rs("number2"))
  End If
  rs.close
   response.write ("<td nowrap width='6%' align=center>&nbsp;"&formatnum2(number2,2)&"</td>")
  
  
   Dim number3'定义总计数量
   number3=number3+number1+number2
   
  
   response.write ("<td nowrap width='6%' align=center>"&formatnum2(number3,2)&"</td>")
  number3=0
  sql="select isnull(sum(a.number),0) as number4 from P_Organi p join x_sell a on p.fid=a.customer where a.stime between '"&year(stime2)&"-"&month(stime2)&"-1' and '"&stime2 &"'and a.grup='"&myarray2(1,j)&"' and a.area='"&myarray1(0,i)&"'"
  rs.open sql
  If Not rs.eof Then
   Dim number4'定义本月累计
   number4=CDbl(rs("number4"))
  End If
  rs.close
   response.write ("<td nowrap width='6%' align=center>&nbsp;"&formatnum2(number4,2)&"</td>")

 

 response.write ("</tr>")
   
Next
  
  response.write "<td  width='20%' align=center colspan=2>&nbsp;包装当日发出量</td>"
  sql="select isnull(sum(a.number),0) as number5 from P_Organi p join x_sell a on p.fid=a.customer  join X_material x on a.mtr=x.fid where a.stime between '"&stime1&"' and '"&stime2 &"' and a.area='"&myarray1(0,i)&"' and x.cls='1000000000000005' "
  rs.open sql
  If Not rs.eof Then
   Dim number5'定义包装当日发出量
   number5=CDbl(rs("number5"))
  End If
  rs.close
  response.write "<td  width='20%' align=center  colspan=4>&nbsp;"&formatnum2(number5,2)&"</td>"

  response.write ("<tr>")

  response.write "<td  width='20%' align=center   colspan=2 >&nbsp;散装当日发出量</td>"
  sql="select isnull(sum(a.number),0) as number6 from P_Organi p join x_sell a on p.fid=a.customer  join X_material x on a.mtr=x.fid where a.stime between '"&stime1&"' and '"&stime2 &"' and a.area='"&myarray1(0,i)&"' and x.cls='1000000000000006' "
  rs.open sql
  If Not rs.eof Then
   Dim number6'定义散装当日发出量
   number6=CDbl(rs("number6"))
  End If
  rs.close
  response.write "<td  width='20%' align=center  colspan=4 >&nbsp;"&formatnum2(number6,2)&"</td>"
  response.write ("</tr>")
      
 Dim tol'定义合计数量
 tol=tol+number5+number6

 Next 


response.write ("<tr bgcolor='yellow'>")

response.write "<td  width='20%' align=left   colspan=2 >&nbsp;合计</td>"
  
response.write "<td  width='20%' align=center  colspan=4 >&nbsp;"&formatnum2(tol,2)&"</td>" 
response.write ("</tr>")
 response.write("<br><TABLE WIDTH='100%' BORDER=0 CELLSPACING=0 CELLPADDING=0>")
 response.write("<br><TR><TD NOWRAP WIDTH='80%'>&nbsp;</TD><TD NOWRAP WIDTH='20%'>填表:" & Session("name") & "</TD></TR>")
 response.write("</TABLE>")

   %>
 </BODY>
 </HTML>
<!-- #include file="../../inc/vbdonn.asp" -->
 




本文来源:http://blog.csdn.net/xsl3378/archive/2007/07/06/1681050.aspx
站内文章搜索 高级搜索
文章录入:admin    责任编辑:admin 
  • 上一篇文章:

  • 下一篇文章:
  • 发表评论】【加入收藏】【告诉好友】【打印此文】【关闭窗口
    最新热点 最新推荐 相关文章
     如何在ado中使用connect…
     vb 贪吃蛇 单人版游戏 (…
     关于在vb中进行com组件的…
     用vb6.0编写自我升级的程…
     vb自动登陆网络站点详解…
     vb打造超酷个性化菜单(…
  • 浅析Spring框架下PropertyPl…

  • 一个一年工作经验的java工程…

  • 一个关于Comparator的使用例…

  • 也谈 释放动态分配的内存的时…

  • chapter one

  • 一个老程序员的心里话:少发…

  • ymbian视图结构 在 CCoeCont…

  • IronPython指南 - 9. 类[转]

  • 初学者入门:一个COM/ATL简单…

  • 初学者入门:写一个简单的CO…

  •   网友评论:(只显示最新10条。评论内容只代表网友观点,与本站立场无关!)
    网络学院©2007 www.23book.net
    为您提供web编程,vb编程,vc编程,服务器架设管理,数据库设计等方面的知识 站长:David