searchlrcount.asp
来自「创建和运行动态、交互的Web服务器应用程序」· ASP 代码 · 共 220 行
ASP
220 行
<!--#include file="conn.asp"-->
<%
dim action,s_year,s_month,rs_ac,rs_cg,ccount,scount,cgsy,xssy
action = request("action")
ccount=0:scount=0
%>
<html>
<head>
<title>销售统计</title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<link href="../images/css2.css" rel="stylesheet" type="text/css">
<SCRIPT LANGUAGE="JavaScript">
<!--
function checksearch()
{
if(document.searchlrcount.s_year.value==0) {
document.searchlrcount.s_year.focus();
alert("请选择要查询的年份!");
return false;
}
if(document.searchlrcount.s_month.value==0 && document.searchlrcount.s_day.value!=0){
document.searchlrcount.s_month.focus();
alert("请选择要查询的月份!");
return false;
}
}
//-->
</script>
</head>
<table width="90%" height="450" border="0" cellpadding="0" cellspacing="0">
<tr>
<td bgcolor="#ece9d8"><br><table width="98%" border="0" align="center" cellpadding="0" cellspacing="0">
<tr><td>
<table width=77 border="0" cellpadding="0" cellspacing="0">
<tr valign=bottom>
<td background=images/get_img.gif width=77 height=26><P style='PADDING-LEFT: 7px'><div align="center"><font color=#ffffff>利润分析</font></div></td>
</tr>
</table>
<table width="98%" border="1" cellspacing="0" cellpadding="0" bordercolordark="#ffffff" bordercolorlight="#666666">
<tr><td><table width="100%" border="1" cellspacing="0" cellpadding="0"><tr><td>
<table width="100%" border="0" align="center" cellpadding="0" cellspacing="0">
<form name="searchlrcount" method="post" action="searchlrcount.asp?action=list_search" >
<tr height=25>
<td width="16%" bgcolor="#ece9d8" align="center"><input type="button" name="b_month" class="bt4" value="本月利润" onClick="location.href='searchlrcount.asp?action=list_search&s_year=<%=year(now)%>&s_month=<%=month(now)%>'">
<td width="16%" bgcolor="#ece9d8" align="center"><input type="button" name="b_year" class="bt4" value="本年利润" onClick="location.href='searchlrcount.asp?action=list_search&s_year=<%=year(now)%>'">
<td width="16%" bgcolor="#ece9d8" align="right">历史查询
<td width="10%" bgcolor="#ece9d8">
<select name="s_year" id="s_year">
<option value="0" selected>选择年</option>
<%for ii=2000 to 2010%>
<option value=<%=ii%>><%=ii%></option>
<%next%>
</select>
<td width="10%" bgcolor="#ece9d8">
<select name="s_month" id="s_month">
<option value="0" selected>选择月</option>
<%for ii=1 to 12%>
<option value=<%=ii%>><%=ii%></option>
<%next%>
</select>
<td width="10%" bgcolor="#ece9d8">
<select name="s_day" id="s_day">
<option value="0" selected>选择日</option>
<%for ii=1 to 31%>
<option value=<%=ii%>><%=ii%></option>
<%next%>
</select>
<td bgcolor="#ece9d8" align="center"><input type="submit" name="Submit" class="bt3" value="查 询" onClick="return checksearch();">
<td bgcolor="#ece9d8" align="center"><input type="button" name="Submit4" class="bt3" value="打 印" onclick="javascript:window.print()">
</tr>
</form>
</table>
<%select case action
case ""%>
<tr><td height=300 valign="top">
<table width="100%" border="0" align="center" cellpadding="1" cellspacing="1" bgcolor="#666666">
<tr>
<td bgcolor="#ece9d8"><div align="center">销售收入</div></td>
<td bgcolor="#ece9d8"><div align="center">销售成本</div></td>
<td bgcolor="#ece9d8"><div align="center">销售毛利</div></td>
</tr>
<tr>
<td bgcolor="#ffffff" height=22></td>
<td bgcolor="#ffffff"></td>
<td bgcolor="#ffffff"></td>
</tr>
</table>
<%
case "list_search"
s_year = request("s_year")
s_month = request("s_month")
s_day = request("s_day")
'//选月了
if s_month<>0 then
'//选日了
if s_day<>0 then
set rs_ac=server.CreateObject("adodb.recordset")
rs_ac.open "SELECT Sum(shop_action.bookcount) AS Sum_xscount,Sum(shop_action.zonger) as Sum_xssy FROM shop_action WHERE (((shop_action.zhuangtai)<>1) AND ((year(shop_action.actiondate))="&s_year&") AND ((Month(shop_action.actiondate))="&s_month&") AND ((day(shop_action.actiondate))="&s_day&")) group by bookid",conn,1,3
set rs_cg=server.CreateObject("adodb.recordset")
rs_cg.open "SELECT Sum(shop_cgaction.cgcount) AS Sum_cgcount,Sum(shop_cgaction.cgsy) as Sum_cgsy FROM shop_cgaction WHERE (((shop_cgaction.cgcount)>0) AND ((year(shop_cgaction.cgdate))="&s_year&") AND ((Month(shop_cgaction.cgdate))="&s_month&") AND ((day(shop_cgaction.cgdate))="&s_day&")) group by bookid",conn,1,3
'//没选日
else
set rs_ac=server.CreateObject("adodb.recordset")
rs_ac.open "SELECT Sum(shop_action.bookcount) AS Sum_xscount,Sum(shop_action.zonger) as Sum_xssy FROM shop_action WHERE (((shop_action.zhuangtai)<>1) AND ((year(shop_action.actiondate))="&s_year&") AND ((Month(shop_action.actiondate))="&s_month&")) group by bookid",conn,1,3
set rs_cg=server.CreateObject("adodb.recordset")
rs_cg.open "SELECT Sum(shop_cgaction.cgcount) AS Sum_cgcount,Sum(shop_cgaction.cgsy) as Sum_cgsy FROM shop_cgaction WHERE (((shop_cgaction.cgcount)>0) AND ((year(shop_cgaction.cgdate))="&s_year&") AND ((Month(shop_cgaction.cgdate))="&s_month&")) group by bookid",conn,1,3
end if
'//没选月
else
set rs_ac=server.CreateObject("adodb.recordset")
rs_ac.open "SELECT Sum(shop_action.bookcount) AS Sum_xscount,Sum(shop_action.zonger) as Sum_xssy FROM shop_action WHERE (((shop_action.zhuangtai)<>1) AND ((year(shop_action.actiondate))="&s_year&")) group by bookid",conn,1,3
set rs_cg=server.CreateObject("adodb.recordset")
rs_cg.open "SELECT Sum(shop_cgaction.cgcount) AS Sum_cgcount,Sum(shop_cgaction.cgsy) as Sum_cgsy FROM shop_cgaction WHERE (((shop_cgaction.cgcount)>0) AND ((year(shop_cgaction.cgdate))="&s_year&")) group by bookid",conn,1,3
end if
%>
<tr><td height=300 valign="top">
<table width="100%" border="0" align="center" cellpadding="1" cellspacing="1" bgcolor="#666666">
<tr>
<td bgcolor="#ece9d8"><div align="center">销售收入</div></td>
<td bgcolor="#ece9d8"><div align="center">销售成本</div></td>
<td bgcolor="#ece9d8"><div align="center">销售毛利</div></td>
</tr>
<% if (rs_ac.bof and rs_ac.eof) or (rs_cg.bof and rs_cg.eof) then
response.write "<tr><td colspan=5 align=center bgcolor=#ffffff><div align=center><font color=blue>没有你要查询的记录!</font></td></tr>"
else
do while not rs_ac.eof
scount=scount+rs_ac("Sum_xscount")
xssy =xssy +rs_ac("Sum_xssy")
rs_ac.MoveNext
loop
do while not rs_cg.eof
ccount=ccount+rs_cg("Sum_cgcount")
cgsy =cgsy +rs_cg("Sum_cgsy")
rs_cg.MoveNext
loop
%>
<tr>
<td bgcolor="#ffffff"><div align="center"><font color=blue><%=formatnumber(xssy,2)%></font></div></td>
<td bgcolor="#ffffff"><div align="center"><font color=red> <%=formatnumber(cgsy,2)%></font></div></td>
<td bgcolor="#ffffff"><div align="center"><font color=blue><%=formatnumber(xssy,2)-formatnumber(cgsy,2)%></font></div></td>
</tr>
<%end if%>
</tr>
</table>
<table width="100%" border="0" align="center" cellpadding="0" cellspacing="0">
<tr height=30>
<%
if s_month=0 then
if s_day=0 then
response.write "<td width=40% align=center>统计日期:<b><font color=red>"&s_year&"</font></b> 年 <b><font color=red> 全年</font></b>"
end if
else
if s_day=0 then
response.write "<td width=40% align=center>统计日期:<b><font color=red>"&s_year&"</font></b> 年 <b><font color=red>"&s_month&"</font></b> 月"
else
response.write "<td width=40% align=center>统计日期:<b><font color=red>"&s_year&"</font></b> 年 <b><font color=red>"&s_month&"</font></b> 月 <b><font color=red>"&s_day&"</font></b> 日"
end if
end if
if scount=0 or ccount=0 then
response.write "<td>合计销售数量:<b><font color=red>0</font></b> 册"
response.write "<td>合计采购数量:<b><font color=red>0</font></b> 册"
else
response.write "<td>合计销售数量:<b><font color=red>"&scount&"</font></b> 册"
response.write "<td>合计采购数量:<b><font color=red>"&ccount&"</font></b> 册"
end if
%>
</tr>
</table>
<%end select%>
</tr>
</table>
</tr>
</table>
</tr>
</table>
</tr>
</table>
</body>
</html>
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?