⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 salesstat.asp

📁 1 除掉了 时间 限制 2 除掉了 人数 限制 改为 500人 原为5人 3 发现一点小缺陷 增加人员的时候没有判断 登陆名是否重复! 自己写吧~~~:) 4 又 是一点缺陷
💻 ASP
📖 第 1 页 / 共 3 页
字号:
<!--#include file="../config.ini" -->
<!--#include file="../commfunction.inc" -->
<%
sysid=checkandgetsysaccountid()
set connsalereport=server.createobject("adodb.connection")
connsalereport.open connstring

if request("statSearch")<>"" then
	strstatSearch=request.form("statSearch")
else
	strstatSearch="ownername"
end if

if Request.Form("namesearch")<>"" then
	strwhere =strwhere&" and owner='"&Request.Form("namesearch")&"'"
else
	strwhere =strwhere &"and (owner='"&session("loginid")&"' or owner in(select userid from v_userreportto_all where reportto='"&session("loginid")&"'))"
end if

if Request.Form("FdateSearch")<>"" then
	strFdate=Request.Form("FdateSearch")
	strwhere=strwhere&" and TransactDate>='"&cdate(strFdate)&"'"
else
	strFdate=date()-7
	strwhere=strwhere&" and TransactDate>='"&cdate(strFdate)&"'"
end if

if  Request.Form("EdateSearch")<>"" then
	strEdate=Request.Form("EdateSearch")
	strwhere=strwhere&" and TransactDate<='"&cdate(strEdate)&"'"
else
	strEdate=date()
	strwhere=strwhere&" and TransactDate<='"&cdate(strEdate)&"'"
end if

if Request.Form("TransNameSearch")="send" then
	strwhere=strwhere&" and Transactcode='发货单发货'"
elseif Request.Form("TransNameSearch")="return" then
	strwhere=strwhere&" and Transactcode='发货单退货'"
end if

if Request.Form("CollectionStat")="Collected" then
	strwhere=strwhere&" and collectionstatus='已收'"
elseif Request.Form("CollectionStat")="Collecting" then
	strwhere=strwhere&" and collectionstatus='未收'"
end if

if Request.Form("InvoiceStat")="Invoiced" then
	strwhere=strwhere&" and invoicestatus='已开'"
elseif Request.Form("InvoiceStat")="Invoicing" then
	strwhere=strwhere&" and invoicestatus='未开'"
elseif Request.Form("InvoiceStat")="NoInvoice" then
	strwhere=strwhere&" and invoice=0"
end if

Set rssalereport=Server.CreateObject("ADODB.Recordset")
if request("statSearch2")="" and request("statSearch3")="" then
	sql="SELECT "&strstatSearch&",SUM(qty) AS subQty, sum(receivedamount) AS subreceivedamount,sum(qty * adjustcost) AS subcost, SUM(qty * price) AS subprice FROM v_SalesStatandQuery where 1=1 "&strwhere&" and sysaccountid="&sysid
	sql=sql & " GROUP BY "&strstatSearch&" ORDER BY subprice DESC "
elseif request("statSearch2")<>"" and request("statSearch3")="" then
	sql="SELECT "&strstatSearch&","&request("statSearch2")&",SUM(qty) AS subQty, sum(receivedamount) AS subreceivedamount,sum(qty * adjustcost) AS subcost, SUM(qty * price) AS subprice FROM v_SalesStatandQuery where 1=1 "&strwhere&" and sysaccountid="&sysid
	sql=sql & " GROUP BY "&strstatSearch&","&request("statSearch2")&" ORDER BY "&strstatSearch&" DESC "
elseif request("statSearch2")<>"" and request("statSearch3")<>"" then
	sql="SELECT "&strstatSearch&","&request("statSearch2")&","&request("statSearch3")&",SUM(qty) AS subQty, sum(receivedamount) AS subreceivedamount,sum(qty * adjustcost) AS subcost, SUM(qty * price) AS subprice FROM v_SalesStatandQuery where 1=1 "&strwhere&" and sysaccountid="&sysid
	sql=sql & " GROUP BY "&strstatSearch&","&request("statSearch2")&" ,"&request("statSearch3")&" ORDER BY "&strstatSearch&" DESC "
end if

'response.write sql
rssalereport.open sql,connsalereport,1,1
alls=rssalereport.Recordcount

if request.form("statSearch")="orderaccount" then
	dispname="客户"
elseif request.form("statSearch")="ownername" or request.form("statSearch")="" then
	dispname="销售员"
elseif request.form("statSearch")="orderaccounttype" then
	dispname="客户类型"
elseif request.form("statSearch")="transactdate" then
	dispname="每日"
elseif request.form("statSearch")="transactmonth" then
	dispname="每月"
elseif request.form("statSearch")="model" then
	dispname="型号"
elseif request.form("statSearch")="producttype" then
	dispname="产品类型"
elseif request.form("statSearch")="deliveryno" then
	dispname="发货单"
elseif request.form("statSearch")="ordernum" then
	dispname="合同"
end if

if request.form("statSearch2")="orderaccount" then
	dispname2="客户"
elseif request.form("statSearch2")="ownername" then
	dispname2="销售员"
elseif request.form("statSearch2")="orderaccounttype" then
	dispname2="客户类型"
elseif request.form("statSearch2")="transactdate" then
	dispname2="每日"
elseif request.form("statSearch2")="transactmonth" then
	dispname2="每月"
elseif request.form("statSearch2")="model" then
	dispname2="型号"
elseif request.form("statSearch2")="producttype" then
	dispname2="产品类型"
elseif request.form("statSearch2")="deliveryno" then
	dispname2="发货单"
elseif request.form("statSearch2")="ordernum" then
	dispname2="合同"
elseif request.form("statSearch2")="transactid" then
	dispname2="销售明细"
end if

if request.form("statSearch3")="orderaccount" then
	dispname3="客户"
elseif request.form("statSearch3")="ownername" then
	dispname3="销售员"
elseif request.form("statSearch3")="orderaccounttype" then
	dispname3="客户类型"
elseif request.form("statSearch3")="transactdate" then
	dispname3="每日"
elseif request.form("statSearch3")="transactmonth" then
	dispname3="每月"
elseif request.form("statSearch3")="model" then
	dispname3="型号"
elseif request.form("statSearch3")="producttype" then
	dispname3="产品类型"
elseif request.form("statSearch3")="deliveryno" then
	dispname3="发货单"
elseif request.form("statSearch3")="ordernum" then
	dispname3="合同"
elseif request.form("statSearch3")="transactid" then
	dispname3="销售明细"
end if
%>
<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"></style>
<title>按发货统计销售</title>
</head>
<SCRIPT language=JavaScript>
function opensubwin(attrstr,targ1)
{
	var tempwin=window.open(targ1,null,attrstr);
	tempwin.location.href=targ1;
	tempwin.opener=this;
}
function submit1(){
	if (form1.statSearch2.value==""){
		form1.statSearch3.value="";
	}
	window.form1.submit();
	return true;
}
function submit2(){
	if (form1.statSearch2.value==""){
		alert("先选择第二条件!");
		form1.statSearch3.value="";
		return false;
	}
	window.form1.submit();
	return true;
}
function submit3(){
	if (form1.StatMethod.value=="aboutdelivery"){
		link="SalesStat.asp";
		document.location.href=link;
	}
	if (form1.StatMethod.value=="aboutrecieve"){
		link="SalesRecieveStat.asp";
		document.location.href=link;
	}
	if (form1.StatMethod.value=="aboutinvoice"){
		link="SalesInvoiceStat.asp";
		document.location.href=link;
	}
}

</SCRIPT>
<script language=javascript src="../tools/newcalendar.js"></script>
<body leftmargin="10" rightmargin="10" topmargin="10">
<table align="center" border="0" cellPadding="0" width="100%"  style="font-size:10pt">
<form id=form1 name=form1 action="" method=post>
	<tr><td><select name=statSearch size=1 ID=Select1 LANGUAGE=javascript  onchange="submit1()">
	<option value="ownername" <%if request("statSearch")="ownername" then Response.Write " selected"%>>按销售员</option>
	<option value="orderaccount" <%if request("statSearch")="orderaccount" then Response.Write " selected"%>>按客户</option>
	<option value="orderaccounttype" <%if request("statSearch")="orderaccounttype" then Response.Write " selected"%>>按客户类型</option>
	<option value="ordernum" <%if request("statSearch")="ordernum" then Response.Write " selected"%>>按合同</option>
	<option value="deliveryno" <%if request("statSearch")="deliveryno" then Response.Write " selected"%>>按发货单</option>
	<option value="transactdate" <%if request("statSearch")="transactdate" then Response.Write " selected"%>>按每日</option>
	<option value="transactmonth" <%if request("statSearch")="transactmonth" then Response.Write " selected"%>>按每月</option>
	<option value="model" <%if request("statSearch")="model" then Response.Write " selected"%>>按产品</option>
	<option value="producttype" <%if request("statSearch")="producttype" then Response.Write " selected"%>>按产品类型</option>
	</select>
	<select name=statSearch2 size=1 ID=Select1 LANGUAGE=javascript  onchange="submit1()">
	<option value="" <%if request("statSearch2")="" then Response.Write " selected"%>>--第二条件--</option>
	<option value="ownername" <%if request("statSearch2")="ownername" then Response.Write " selected"%>>按销售员</option>
	<option value="orderaccount" <%if request("statSearch2")="orderaccount" then Response.Write " selected"%>>按客户</option>
	<option value="orderaccounttype" <%if request("statSearch2")="orderaccounttype" then Response.Write " selected"%>>按客户类型</option>
	<option value="ordernum" <%if request("statSearch2")="ordernum" then Response.Write " selected"%>>按合同</option>
	<option value="deliveryno" <%if request("statSearch2")="deliveryno" then Response.Write " selected"%>>按发货单</option>
	<option value="transactdate" <%if request("statSearch2")="transactdate" then Response.Write " selected"%>>按每日</option>
	<option value="transactmonth" <%if request("statSearch2")="transactmonth" then Response.Write " selected"%>>按每月</option>
	<option value="model" <%if request("statSearch2")="model" then Response.Write " selected"%>>按产品</option>
	<option value="producttype" <%if request("statSearch2")="producttype" then Response.Write " selected"%>>按产品类型</option>
	<option value="transactid" <%if request("statSearch2")="transactid" then Response.Write " selected"%>>按销售明细</option>
	</select>
	<select name=statSearch3 size=1 ID=Select1 LANGUAGE=javascript  onchange="submit2()">
	<option value="" <%if request("statSearch3")="" then Response.Write " selected"%>>--第三条件--</option>
	<option value="ownername" <%if request("statSearch3")="ownername" then Response.Write " selected"%>>按销售员</option>
	<option value="orderaccount" <%if request("statSearch3")="orderaccount" then Response.Write " selected"%>>按客户</option>
	<option value="orderaccounttype" <%if request("statSearch3")="orderaccounttype" then Response.Write " selected"%>>按客户类型</option>
	<option value="ordernum" <%if request("statSearch3")="ordernum" then Response.Write " selected"%>>按合同</option>
	<option value="deliveryno" <%if request("statSearch3")="deliveryno" then Response.Write " selected"%>>按发货单</option>
	<option value="transactdate" <%if request("statSearch3")="transactdate" then Response.Write " selected"%>>按每日</option>
	<option value="transactmonth" <%if request("statSearch3")="transactmonth" then Response.Write " selected"%>>按每月</option>
	<option value="model" <%if request("statSearch3")="model" then Response.Write " selected"%>>按产品</option>
	<option value="producttype" <%if request("statSearch3")="producttype" then Response.Write " selected"%>>按产品类型</option>
	<option value="transactid" <%if request("statSearch3")="transactid" then Response.Write " selected"%>>按销售明细</option>
	</select>
	从<input name=FdateSearch size=10 language=javascript id=dupdatetime value='<%=strFdate%>'  readonly><% call AddImg("date")%>
                <input type = hidden name=clicksource>
                <input type = hidden name=clickresult >
	到<input name=EdateSearch size=10 language=javascript id=dupdatetime2 value='<%=strEdate%>'  readonly><% call AddImg("date2")%>
	<select name=TransNameSearch size=1 LANGUAGE=javascript  onchange="submit1()">
	<option value="" <%if request("TransNameSearch")="" then Response.Write " selected"%>>扣除退货</option>
	<option value="send" <%if request("TransNameSearch")="send" then Response.Write " selected"%>>所有发货</option>&nbsp;
	<option value="return" <%if request("TransNameSearch")="return" then Response.Write " selected"%>>所有退货</option>
	</select>
	<select name=nameSearch size=1 ID=Select1 LANGUAGE=javascript  onchange="submit1()">
	<option value="">--选择销售员--</option>
	<%getsubordinate Request.Form("namesearch")%>
	</select>
	<input type=submit name="Search" value="提交"></td></tr>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -