dim aju()
dim ajum()
dim awlsj()
redim aju(yearnumber-1)
redim ajum(yearnumber)
redim awlsj(yearnumber,yearnumber)
rs.movefirst
for i=0 to yearnumber-1
aju(i)=rs(0).value
ajum(i)=rs(1).value
rs.movenext
next
ajum(i)="合计"
set rs=nothing
for i=0 to ubound(awlsj)
for j=0 to ubound(awlsj)
awlsj(i,j)=0
next
next
dim amonth(11)
for i=0 to 11
amonth(i)=i+1
next
dim aday(31)
for i=0 to 30
aday(i)=i+1
next
dim akou(4)
akou(0)="永州"
akou(1)="黎塘"
akou(2)="可靠"
akou(3)="扩大"
set rs=Server.CreateObject("ADODB.Recordset")
rs.cursorlocation=3
sou="select year(riqi) from v_wlsj group by year(riqi) order by year(riqi) desc"
rs.open sou,ConnectionString,1,1,1
rs.movelast
rs.movefirst
yearnumber=rs.recordcount
dim ayear()
redim ayear(yearnumber-1)
for i=0 to yearnumber-1
ayear(i)=rs(0).value
rs.movenext
next
set rs=nothing
function sele(firstval,lastval)
if trim(firstval)=trim(lastval) then
sele="SELECTED"
end if
end function
function scanary(aaryl,chrzf)
dim si,sj
sj=-1
for si=0 to ubound(aaryl)
if trim(aaryl(si))=trim(chrzf) then
scanary=si
sj=1
exit for
end if
next
if sj=-1 then scanry=sj
end function
%>
if isempty(snian) then snian=year(date())
if isempty(syue1) then syue1=month(date())
if isempty(sday1) then sday1=1
if isempty(syue2) then syue2=month(date())
if isempty(sday2) then sday2=day(date())
if isempty(skou) then skou=akou(0)
%>
<table border=0 cellspacing=0 cellpadding=0 align=center >
<tr height=14><th>
<form action="wl.asp" method="post">开始时间
<select name="nian" >
<%
for each var in ayear %>
<option <%=sele(var,snian)%>> <% =var %> </option>
<% next
%>
</select>
年
<select name="yue1" >
<%
for each var in amonth %>
<option <%=sele(var,syue1)%>> <% =var %> </option>
<% next
%>
</select>
月
<select name="day1" >
<%
for each var in aday %>
<option <%=sele(var,sday1)%>> <% =var %> </option>
<% next
%>
</select>
日至
<select name="yue2" >
<%
for each var in application("arymonth") %>
<option <%=sele(var,syue2)%>> <% =var %> </option>
<% next
%>
</select>
月
<select name="day2" >
<%
for each var in aday %>
<option <%=sele(var,sday2)%>> <% =var %> </option>
<% next
%>
</select>
日 检测口:
<select name="kou" >
<%
for each var in akou %>
<option <%=sele(var,skou)%>> <% =var %> </option>
<% next
%>
</select>
<input type=submit name=b1 value="确定">
</form>
</th>
</table>
<%
do while not rs.eof
i=scanary(aju,rs(0).value)
j=scanary(aju,rs(2).value)
if i<>-1 and j<>-1 then
awlsj(i,j)=awlsj(i,j)+rs(4).value
awlsj(i,ubound(awlsj))=awlsj(i,ubound(awlsj))+rs(4).value
awlsj(ubound(awlsj),j)=awlsj(ubound(awlsj),j)+rs(4).value
awlsj(ubound(awlsj),ubound(awlsj))=awlsj(ubound(awlsj),ubound(awlsj))+rs(4).value
if i=7 or i=14 then
d=scanary(aju,rs(1).value)
if d<>-1 then
awlsj(d,j)=awlsj(d,j)+rs(4).value
awlsj(d,ubound(awlsj))=awlsj(d,ubound(awlsj))+rs(4).value
end if
if j=7 or j=14 then
c=scanary(aju,rs(3).value)
if c<>-1 then awlsj(d,c)=awlsj(d,c)+rs(4).value
end if
else
if j=7 or j=14 then
c=scanary(aju,rs(3).value)
if c<>-1 then
awlsj(i,c)=awlsj(i,c)+rs(4).value
awlsj(ubound(awlsj),c)=awlsj(ubound(awlsj),c)+rs(4).value
end if
end if
end if
end if
rs.movenext
loop
set rs=nothing
%>
<table border=0 cellspacing=0 cellpadding=1 align=center bgcolor=#4274de width=630>
<tr><th>
<table border=0 cellspacing=1 cellpadding=3 align=center bgcolor=#ffffff width=630>
<colgroup align=center>
<colgroup align=right span=8>
<tr><td class=biao width=70>到 - 发</td>
<%
for i=0 to 7
response.write "<td class=biao width=70>"&ajum(i)&"</td>"
next
for i=0 to ubound(awlsj)
response.write "<tr><th class=biao>"&ajum(i)&"</th>"
for j=0 to 7
response.write "<th class=biao>"&awlsj(i,j)&"</th>"
next
next
%>
</table>
</th>
<tr><th bgcolor=#ffffff >续1:<br></th>
<tr><th>
<table border=0 cellspacing=1 cellpadding=3 align=center bgcolor=#ffffff width=630>
<colgroup align=center>
<colgroup align=right span=8>
<tr><td class=biao width=70>到 - 发</td>
<%
for i=8 to 15
response.write "<td class=biao width=70>"&ajum(i)&"</td>"
next
for i=0 to ubound(awlsj)
response.write "<tr><th class=biao>"&ajum(i)&"</th>"
for j=8 to 15
response.write "<th class=biao>"&awlsj(i,j)&"</th>"
next
next
%>
</table>
</th>
<tr><th bgcolor=#ffffff>续2:<br></th>
<table border=0 cellspacing=0 cellpadding=1 align=center bgcolor=#4274de width=630>
<tr><th>
<table border=0 cellspacing=1 cellpadding=3 align=center bgcolor=#ffffff width=630>
<colgroup align=center>
<colgroup align=right span=8>
<tr><td class=biao width=70>到 - 发</td>
<%
for i=16 to 23
response.write "<td class=biao width=70>"&ajum(i)&"</td>"
next
for i=0 to ubound(awlsj)
response.write "<tr><th class=biao width=70>"&ajum(i)&"</th>"
for j=16 to 23
response.write "<th class=biao>"&awlsj(i,j)&"</th>"
next
next
%>
</table>
</th>
</table>
</body>