📄 salesanalyse.asp
字号:
<!--#include file="../config.ini" -->
<!--#include file="../commfunction.inc" -->
<%
Dim objcheck
Set objcheck=Server.CreateObject("SmartSales.CheckFunction")
objcheck.CheckUserFunction "report","read"
sysid=1
set connsalequery=server.createobject("adodb.connection")
connsalequery.open connstring
'
if Request("selMonth")<>"" then
theselMonth=Request("selMonth")
else
theselMonth=month(date)-1
end if
if Request("selMonth2")<>"" then
theselMonth2=Request("selMonth2")
else
theselMonth2=month(date)-1
end if
if Request("selYear")<>"" then
theselYear=Request("selYear")
else
theselYear=Year(date)
end if
'response.write theselMonth&"<br>"
'response.write theselMonth2&"<br>"
if Request("selMonth")<>"" then
strMonth=Request("selMonth")+1
else
strMonth=month(date)
end if
if Request("selMonth2")<>"" then
strMonth2=Request("selMonth2")+1
else
strMonth2=month(date)
end if
savehistory theselYear,strMonth,strMonth2
function savehistory(year,month1,month2)
set conns=server.createobject("adodb.connection")
conns.open session("connstring")
for i=month1 to month2
set rs=conns.execute("select top 1 * from salesanalyse where [year]="&year&" and [month]="&i)
if not rs.eof then
'response.write "已经存在"&year&"年"&i&"月数据<br>"
else
fdate=cdate(year&"-"&i&"-"&"1")
if i=12 then edate=cdate(year&"-12-31") else edate=cdate(year&"-"&i+1&"-"&"1")-1
sql="SELECT top 100 ownername,orderaccount,sum(Qty*price) as subtotalamount FROM v_SalesStatandQuery where transactdate<='"&edate&"' and transactdate>='"&fdate&"' group by ownername,orderaccount order by subtotalamount desc"
set rs=conns.execute(sql)
if not rs.eof then
'response.write "已保存"&year&"年"&i&"月数据<br>"
do while not rs.eof
sql="insert into salesanalyse(account,owner,[year],[month],amount)values('"&rs("orderaccount")&"','"&rs("ownername")&"',"&year&","&i&","&rs("subtotalamount")&")"
'response.write sql
'response.end
conns.execute(sql)
rs.movenext
loop
else
'response.write "无"&year&"年"&i&"月数据<br>"
end if
end if
next
end function
'condition2
if Request("strfield2")<>"" then
strwhere =strwhere&" and "&request("strfield2")&" like '%"&Request("strvalue2")&"%'"
end if
if Request.Form("strfield2")<>"" then
strwhere =strwhere&" and "&Request.Form("strfield2")&" like '%"&Request.Form("strvalue2")&"%'"
end if
'aboutsales1
if Request("namesearch")<>"" then
strwhere =strwhere&" and owner='"&Request("namesearch")&"'"
else
if objcheck.CheckUserFunction2("payment","edit") then
else
strwhere =strwhere &"and (owner='"&session("loginid")&"' or owner in(select userid from v_userreportto_all where reportto='"&session("loginid")&"'))"
end if
end if
'aboutsales2
if Request.Form("namesearch")<>"" then
strwhere =strwhere&" and owner='"&Request.Form("namesearch")&"'"
else
if objcheck.CheckUserFunction2("payment","edit") then
else
strwhere =strwhere &"and (owner='"&session("loginid")&"' or owner in(select userid from v_userreportto_all where reportto='"&session("loginid")&"'))"
end if
end if
'TEMPFDATE=cint(theselYear)&"-"&cint(theselMonth+1)&"-"&"1"
'TEMPFDATE=CDATE(TEMPFDATE)
'if cint(theselMonth2)=11 then
'TEMPEDATE=cint(theselYear+1)&"-"&cint(theselMonth2-10)&"-"&"1"
TEMPyear=cint(theselYear)
'else
'TEMPEDATE=cint(theselYear)&"-"&cint(theselMonth2+2)&"-"&"1"
TEMPEmonth=cint(theselMonth+1)
TEMPFmonth=cint(theselMonth2+1)
'end if
'TEMPEDATE=CDATE(TEMPEDATE)
'aboutstartdate1
strwhere=strwhere&" and [year]='"&TEMPyear&"'"
'aboutenddate1
strwhere=strwhere&" and ("
for j=TEMPEmonth to TEMPFmonth
strwhere=strwhere&"[month]='"&j&"' or"
next
strwhere=left(strwhere,len(strwhere)-2)
strwhere=strwhere&")"
%>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<LINK href="../global.css" rel=stylesheet type=text/css>
<style type="text/css">
.thisselect {
BACKGROUND-COLOR: #EFEFEF}
.titlecn {
font-family: "宋体";
font-size: 12px;
line-height: 20px;
}
.titlecn_s {
font-family: "宋体";
font-size: 10px;
line-height: 20px;
}
.titleen {
font-family: "Verdana", "宋体","Arial", "Helvetica", "sans-serif";
font-size: 12px;
line-height: 18px;
}
.titleen_s{
font-family: "Verdana", "宋体","Arial", "Helvetica", "sans-serif";
font-size: 10px;
line-height: 18px;
}
.coloren {
font-family: "Verdana", "宋体", "Arial", "Helvetica", "sans-serif";
font-size: 12px;
line-height: 18px;
color: C43F0B;
font-weight: bold;
}
.syswarning {
font-family: "Verdana", "宋体", "Arial", "Helvetica", "sans-serif";
font-size: 12px;
line-height: 18px;
color: #FF0000;
font-weight: bold;
}
.colorenit { font-family: "Verdana", "宋体", "Arial", "Helvetica", "sans-serif"; font-size: 12px; line-height: 18px; color: #FF6600; font-weight: bold; ; font-style: italic}
.date { font-family: "Verdana", "宋体", "Arial", "Helvetica", "sans-serif"; font-size: 9px; line-height: 18px; color: #F44722; font-weight: bold; }
.headno { font-family: "Verdana", "宋体", "Arial", "Helvetica", "sans-serif"; font-size: 12px; line-height: 18px; font-weight: bold; }
.DIVDSP1
{
BACKGROUND-COLOR: #99CCFF;
BORDER-BOTTOM: 1px outset;
BORDER-LEFT: 1px outset;
BORDER-RIGHT: 1px outset;
BORDER-TOP: 0px outset;
WIDTH: 30pt;
FONT-SIZE:10;
}
.DIVDSP2
{
BACKGROUND-COLOR: #ff9999;
BORDER-BOTTOM: 1px outset;
BORDER-LEFT: 1px outset;
BORDER-RIGHT: 1px outset;
BORDER-TOP: 0px outset;
WIDTH: 30pt;
FONT-SIZE:10;
}
.DIVDSP3
{
BACKGROUND-COLOR: #ECECEC;
BORDER-BOTTOM: 1px outset;
BORDER-LEFT: 0px outset;
BORDER-RIGHT: 0px outset;
BORDER-TOP: 0px outset;
WIDTH:80;
font-family: "Verdana", "宋体", "Arial", "Helvetica", "sans-serif";
FONT-SIZE:11;
FONT-color:#4A699C;
}
</style>
<title>销售分析</title>
</head>
<SCRIPT language=JavaScript>
function showit(tag,Trid){
var tag_plus = tag+Trid+"_plus"
var tag_minus =tag+Trid+"_minus"
var tag_tr="tr_"+Trid
if(document.all(tag_plus).style.display == "none")
{
document.all(tag_tr).style.display="none"
document.all(tag_plus).style.display=""
document.all(tag_minus).style.display="none"
}
else
{
document.all(tag_tr).style.display=""
document.all(tag_plus).style.display="none"
document.all(tag_minus).style.display=""
}
var NoneDisplay;
NoneDisplay=true;
for(tempI=1;tempI<=form1.hid.value;tempI++){
var strtag=tag+tempI+'_plus';
if(document.all(strtag).style.display=="none"){
NoneDisplay=false;break;
}
}
if(NoneDisplay){
sub_on.style.display="";
sub_off.style.display="none";
sub_2.style.display="none";
}
else{
sub_on.style.display="none";
sub_off.style.display="";
sub_2.style.display="";
}
}
function opensubwin(attrstr,targ1)
{
var tempwin=window.open(targ1,null,attrstr);
tempwin.location.href=targ1;
tempwin.opener=this;
}
function submit1(){
form1.bsubmit.value="ok";
form1.submit();
}
window.onload = on_load;
function on_load() {
var obDate = new Date();
var iYear = obDate.getFullYear();
for ( i=iYear-50; i<iYear+20; i++ ) {
var obOption = document.createElement( "OPTION" );
obOption.value = i; obOption.text = i+"年";
form1.selYear.add( obOption );
_obDate = obDate;
}
form1.selYear.value = "<%=theselYear%>";
form1.selMonth.value = "<%=theselMonth%>";
form1.selMonth2.value = "<%=theselMonth2%>";
}
</SCRIPT>
<body leftmargin="10" rightmargin="10" topmargin="10">
<form name="form1" action="Salesanalyse.asp" method="post">
<input type="hidden" name="bsubmit">
<table width="100%" cellpadding="0" cellspacing="0" bgcolor="#FFFFFF">
<tr>
<td height=5><table width="100%" height="30" border="0" cellpadding="0" cellspacing="0">
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -