以前的函数是按自然月来计算的(当月1日到31日)
sDate =date()
SYear =Year(SDate)
SMonth =Month(sDate)
SDay =Day(sDate)
sDate2 =dateAdd("d",-1,date())
SYear2 =Year(sDate2)
SMonth2 =Month(sDate2)
SDay2 =Day(sDate2)
但是我现在要改为电信月,该怎样写呢(上月21日到本月20日)
sDate =date()
SYear =Year(SDate)
SMonth =Month(sDate)
SDay =Day(sDate)
sDate2 =dateAdd("d",-1,date())
SYear2 =Year(sDate2)
SMonth2 =Month(sDate2)
SDay2 =Day(sDate2)
但是我现在要改为电信月,该怎样写呢(上月21日到本月20日)
SYear =Year(SDate)
SMonth =Month(sDate)
SDay =20
sDate2 =dateAdd("m",-1,date())
SYear2 =Year(sDate2)
SMonth2 =Month(sDate2)
SDay2 =21
SYear =Year(SDate)
SMonth =Month(sDate)
SDay =20
sDate2 =dateAdd("m",-1,date())
SYear2 =Year(sDate2)
SMonth2 =Month(sDate2)
SDay2 =21
sDate =date()
SYear =Year(SDate)
SMonth =Month(sDate)
SDay =20
sDate2 =dateAdd("m",-1,date())
SYear2 =Year(sDate2)
SMonth2 =Month(sDate2)
SDay2 =21
<%
SpName=StrToSql(Request.Form("SpName"))
SpCode=StrToSql(Request.Form("SpCode"))
if not isNull(SpName) then Conditon=Conditon&" and SpName like '%"&SpName&"%'"
if not isNull(SpCode) then Conditon=Conditon&" and SpCode like '%"&SpCode&"%'"Sql="Select * from serverProvider where 1=1"&Conditon%>
<html>
<head>
<title>网站收入统计</title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<script language=javascript >
function E(Str)
{
window.open("ServerEdit.asp?SpCode="+Str,"","width=10,height=10,resizeable=yes")
}
</script>
<link href="../../css.css" rel="stylesheet" type="text/css">
</head>
<body>
<table width="100%" border="0" align="center" cellpadding="0" cellspacing="1" bgcolor="#426db5">
<form action="" method="post" name="AddForm" id="AddForm">
</form>
<form action="" method="post" name="SearchForm" id="SearchForm">
</form>
<%
Rs.open Sql,Conn,1,1
%>
<tr bgcolor="#426db5">
<td width="30%" align="center" bgcolor="#426db5"><font color="#f79142">加盟网站名称</font></td>
<td width="10%" align="center"><font color="#f79142">今日收入</font></td>
<td width="10%" align="center"><font color="#f79142">昨日收入</font></td>
<td width="10%" align="center"><font color="#f79142">本月收入</font></td>
<td width="11%" align="center"><font color="#f79142">全部已用</font></td>
<td width="20%" align="center">
<input name="BackBut" type="button" id="BackBut" value="返回前页" onClick="history.back()">
</td>
</tr>
<%
Sql="Select Sum(cast(SUBSTRING(code,2,CAST(left(code,1) as int)) as int))/5 from code "
sDate =date()'当前日期
SYear =Year(SDate)'当前年份
SMonth =Month(sDate)'当前自然月
SDay =Day(sDate)
sDate2 =dateAdd("d",-1,date())'前一天
SYear2 =Year(sDate2)'前一年
SMonth2 =Month(sDate2)'前一月
SDay2 =Day(sDate2)'前一日
Sum1 =0
Sum2 =0
Sum3 =0
Sum4 =0
set rss=server.CreateObject("Adodb.recordset")while not rs.eof
%>
<tr title="<%=Rs("SpName")%>">
<td align="center" nowrap bgcolor="#9ccfff"><a href="../SpShow.asp?SpCode=<%=Rs("SpCode")%>" target="_blank">
<%=Rs("SpName")%></a></td>
<td align="center" nowrap bgcolor="#9ccfff"> <%
Rss.open Sql&" where SpCode='"&Rs("SpCode")&"' and year(useTime)="&sYear&" and Month(useTime)="&sMonth&" and day(useTime)="&sday,Conn,1,1
if not isNull(Rss(0)) then Sum1=Sum1+Rss(0)
Response.Write(Rss(0))
Rss.close()
%> </td>
<td align="center" nowrap bgcolor="#9ccfff"> <%
Rss.open Sql&" where SpCode='"&Rs("SpCode")&"' and year(useTime)="&sYear2&" and Month(useTime)="&sMonth2&" and day(useTime)="&sday2,Conn,1,1
if not isNull(Rss(0)) then Sum2=Sum2+Rss(0)
Response.Write(Rss(0))
Rss.close()
%> </td>
<td align="center" nowrap bgcolor="#9ccfff"> <%
Rss.open Sql&" where SpCode='"&Rs("SpCode")&"' and year(useTime)="&sYear&" and Month(useTime)="&sMonth,Conn,1,1
if not isNull(Rss(0)) then Sum3=Sum3+Rss(0)
Response.Write(Rss(0))
Rss.close()
%> </td>
<td align="center" nowrap bgcolor="#9ccfff"> <%
Rss.open Sql&" where SpCode='"&Rs("SpCode")&"'",Conn,1,1
if not isNull(Rss(0)) then Sum4=Sum4+Rss(0)
Response.Write(Rss(0))
Rss.close()
%> </td>
<td align="center" nowrap bgcolor="#9ccfff"><a href="http://www.vnetone.com/income.asp?SPCode=<%=Rs("SpCode")&Rs("CheckCode")%>" target="_blank">销售分布</a>
</td>
</tr>
<%Rs.movenext:wend:Rs.close()%>
<tr bgcolor="#99CCFF">
<td width="30%" align="center"><font color="#f79142">总计</font></td>
<td width="10%" align="center"><font color="#f79142"><%=Sum1%></font></td>
<td width="10%" align="center"><font color="#f79142"><%=Sum2%></font></td>
<td width="10%" align="center"><font color="#f79142"><%=Sum3%></font></td>
<td width="11%" align="center"><font color="#f79142"><%=Sum4%></font></td>
<td width="20%" align="center"><font color="#f79142"> </font></td>
</tr>
</table>
</body>
</html>
<!--#include file="inc/connSql.asp"-->
<%
dim SpCode,Message,SpName,VCount,VCountArray(31),vSumArray(31)
set rss=server.CreateObject("Adodb.recordset")SpCode=Request.QueryString("SpCode")
SDate=request.QueryString("SDate")
if SDate="" or not isDate(SDate) then
sDate=CDate(year(date())&"-"&month(Date())&"-1")
end if
sYear=year(sDate)
sMonth=Month(sDate)if not isNumeric(SpCode) or len(SpCode)<>23 then
Message="传入数据不正确"
end if
CheckCode=mid(Spcode,6)
Spcode=left(Spcode,5)if Message="" then
Rs.open "select * from ServerProvider where SpCode='"&Spcode&"' and CheckCode='"&CheckCode&"'",conn,1,1
if rs.eof then
Message="传入数据不正确"
else
SpName=Rs("SpName")
end if
Rs.close
end if
Function FunGetArray(StCode)
FunFillArray VCountArray,0
Sql="select day(useTime) as days,Sum(cast(SUBSTRING(code,2,CAST(left(code,1) as int)) as int))/5 as Vcount from code where spcode='"&SpCode&"' and stcode='"&StCode&"' and year(useTime)="&Syear&" and month(useTime)="&sMonth&" group by day(useTime) order by day(useTime)"
Rss.open sql,conn,1,1
while not rss.eof
VCountArray(Rss("days"))=Rss("Vcount")
VCountArray(0)=VCountArray(0)+Rss("Vcount")
vSumArray(Rss("days"))=vSumArray(Rss("days"))+Rss("Vcount")
vSumArray(0)=vSumArray(0)+Rss("Vcount")
rss.movenext:wend:rss.close()end FunctionFunction FunFillArray(subArray(),intI)
for i=0 to ubound(subArray)
subArray(i)=intI
next
end Function%>
<script language=javascript ></script><html>
<head>
<title></title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<link href="css.css" rel="stylesheet" type="text/css">
</head>
<body>
<%
if message<>"" then
response.Write(Message)
else
%>
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td colspan="3" align="center" valign="top"><font color="#FF0000" size="3"><%=SpName%></font></td>
</tr>
<tr>
<td align="center" valign="top"><a href="InCome.asp?SDate=<%=DateAdd("m",-1,SDate)%>&SpCode=<%=SpCode&CheckCode%>"><%=Year(dateAdd("m",-1,SDate))&"年"&Month(dateAdd("m",-1,SDate))&"月"%></a></td>
<td align="center" valign="top"><%=Year(SDate)&"年"&Month(SDate)&"月收入一览"%></td>
<td align="center" valign="top"><a href="InCome.asp?SDate=<%=DateAdd("m",1,SDate)%>&SpCode=<%=SpCode&CheckCode%>"><%=Year(dateAdd("m",1,SDate))&"年"&Month(dateAdd("m",1,SDate))&"月"%></a></td>
</tr>
<tr>
<td colspan="3" align="center" valign="top"><table width="100%" border="0" align="center" cellpadding="0" cellspacing="1" bgcolor="#31659C">
<tr align="center" valign="top">
<td bgcolor="#21519C"><font color="#FFFFFF">地区</font></td>
<td bgcolor="#21519C"><font color="#FFFFFF">1</font></td>
<td bgcolor="#21519C"><font color="#FFFFFF">2</font></td>
<td bgcolor="#21519C"><font color="#FFFFFF">3</font></td>
<td bgcolor="#21519C"><font color="#FFFFFF">4</font></td>
<td bgcolor="#21519C"><font color="#FFFFFF">5</font></td>
<td bgcolor="#21519C"><font color="#FFFFFF">6</font></td>
<td bgcolor="#21519C"><font color="#FFFFFF">7</font></td>
<td bgcolor="#21519C"><font color="#FFFFFF">8</font></td>
<td bgcolor="#21519C"><font color="#FFFFFF">9</font></td>
<td bgcolor="#21519C"><font color="#FFFFFF">10</font></td>
<td bgcolor="#21519C"><font color="#FFFFFF">11</font></td>
<td bgcolor="#21519C"><font color="#FFFFFF">12</font></td>
<td bgcolor="#21519C"><font color="#FFFFFF">13</font></td>
<td bgcolor="#21519C"><font color="#FFFFFF">14</font></td>
<td bgcolor="#21519C"><font color="#FFFFFF">15</font></td>
<td bgcolor="#21519C"><font color="#FFFFFF">16</font></td>
<td bgcolor="#21519C"><font color="#FFFFFF">17</font></td>
<td bgcolor="#21519C"><font color="#FFFFFF">18</font></td>
<td bgcolor="#21519C"><font color="#FFFFFF">19</font></td>
<td bgcolor="#21519C"><font color="#FFFFFF">20</font></td>
<td bgcolor="#21519C"><font color="#FFFFFF">21</font></td>
<td bgcolor="#21519C"><font color="#FFFFFF">22</font></td>
<td bgcolor="#21519C"><font color="#FFFFFF">23</font></td>
<td bgcolor="#21519C"><font color="#FFFFFF">24</font></td>
<td bgcolor="#21519C"><font color="#FFFFFF">25</font></td>
<td bgcolor="#21519C"><font color="#FFFFFF">26</font></td>
<td bgcolor="#21519C"><font color="#FFFFFF">27</font></td>
<td bgcolor="#21519C"><font color="#FFFFFF">28</font></td>
<td bgcolor="#21519C"><font color="#FFFFFF">29</font></td>
<td bgcolor="#21519C"><font color="#FFFFFF">30</font></td>
<td bgcolor="#21519C"><font color="#FFFFFF">31</font></td>
<td bgcolor="#21519C"><font color="#FFFFFF">总计</font></td>
</tr>
<%
FunFillArray vSumArray,0
Rs.open "select * from stationProvider order by id",conn,1,1
while not rs.eof
FunGetArray Rs("StCode")
%>
----------------------------
sDate = 年份 & "-" & 月份 & "-" & 20