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

📄 c_salesum.asp

📁 一个很好的在线购物系统
💻 ASP
📖 第 1 页 / 共 2 页
字号:
<%
'*********************************页面说明 ************************************************** 
'开发者:金寿吉     
'首次开发时间:2001-09-05   
'最后一次修改时间:
'主要功能:促销活动的统计分析
'主要的传递参数描述

'1--vYear,vMonth							 		 起始年月
'2--eYear,eMonth									 终止年月
'3--DepartID										 查询部门
'4--Sales											 查询员工

'5--condition          			 					 查 询条件
 %>
<!--#include file="../include/Pubconn.asp"-->    
<!--#include file="../include/PubFun.asp"-->    
<%    
 dim username    									 '当前用户名
 dim userclass  									 '表示用户的权限级别
 dim userCheck										 '表示用户是否有审核权限
  
 dim AdoRs      									 '数据记录集
 dim lcSql      									 'SQL语句
 dim keyitem(7)										 '表示保存数据的数组
  
 dim vYear,vMonth			 						 '起始年月
 dim eYear,eMonth									 '终止年月
 dim departID,Sales									 '查询的部门和员工
 dim departCode(),departname()						 '所有部门的编码和名称
 dim Count1											 '表示部门查询的结果	
 dim departcode1(),StuffNum(),StuffName()			 '表示查询员工所在的部门,员工号和姓名
 dim Count2											 '查询员工的数量
    
 dim Condition  									 '查询条件
 
'*********************************得到用户名并进行表访问权限判断 *********************************** 

 username=GetUser()									 '得到当前的用户名
 userclass=TableVisitor("C_SalePromotion",username)	 '得到用户对表的最高访问权限 
 'usercheck=TableCheck("C_SalePromotion",username)   '得到文档的审核权
 
 '***********************************设置传递参数的值 *********************************************
 vYear=Request("vYear")
 eYear=Request("eYear")
 vMonth=Request("vMonth")
 eMonth=Request("eMonth")
 
 departId=Request("departID")
 Sales=Request("Sales")
     
 Condition=Request("Condition") 
 '**********************************设置ADO数据 **************************************************** 
 '读取部门信息
 set AdoRs=Server.CreateObject("AdoDB.RecordSet")
 lcsql="select * from A_departInfo  where delflag='0'"

 AdoRS.Open lcSql,PubConn,1,3
 if not adors.eof then
 	Count1=Adors.recordcount
 	redim DepartCode(Count1),departName(Count1)
 	i=1
 	Do while not adors.eof
 		DepartCode(i)=Adors("departcode")
 		departName(i)=Adors("name")
 		AdoRs.MoveNext
 		i=i+1
 	Loop
 else
 	Count1=0
 End if	
 set Adors=Nothing
 
 '读取员工信息
 set AdoRs=Server.CreateObject("AdoDB.RecordSet")
 lcsql="select * from A_StuffInfo where saleflag='1' and delflag<>'1'"
 AdoRS.Open lcSql,PubConn,1,1
 if not adors.eof then
 	Count2=Adors.recordcount
 	redim DepartCode1(Count2),StuffNum(Count2),StuffName(Count2)
 	i=1
 	Do while not adors.eof
 		DepartCode1(i)=Adors("departcode")
 		StuffNum(i)=Adors("StuffNum")
 		StuffName(i)=Adors("name")
 		AdoRs.MoveNext
 		i=i+1
 	Loop
 else
 	Count2=0
 End if	
 set Adors=Nothing

 set AdoRs=Server.CreateObject("AdoDB.RecordSet")
 lcsql="select Count(*) as DataRow,Sum(planCost) as PlanCost1, Sum(FactCost) as FactCost1,Sum(SaleMoney) as SaleMoney1,"
 lcsql=lcsql+" Sum (Assorts) as Assorts1, sum(Guests) as Guests1, Sum(Consumes) as Consumes1  from C_SalePromotion where delflag<>'1'"
 
 '******************************根据查询条件和排序条件修改lcSQL语句 ********************************  
 if Condition<>"" then
 	lcSql=lcSql+" AND "+Condition	
 End if
 'response.write lcsql
 'response.end
  AdoRS.Open lcSql,PubConn,1,3
 if not Adors.eof then
 	Keyitem(1)=Adors("DataRow")
 	Keyitem(2)=Adors("PlanCost1")
 	Keyitem(3)=Adors("FactCost1")
 	Keyitem(4)=Adors("SaleMoney1")
 	Keyitem(5)=Adors("Assorts1")+Keyitem(1)
 	Keyitem(6)=Adors("Guests1")
 	Keyitem(7)=Adors("Consumes1")
 	for i=1 to 7
 		if isNull(keyitem(i)) then keyitem(i)=0
 	next
 end if
 
 Set Adors=Nothing  								'关闭数据集和连接                 
 Set PubConn=Nothing                           
 %>    
  
 <Script Language="VBScript">
  dim count1,count2  	
  dim departcode(),departname() 
  dim departcode1(),stuffnum(),stuffname()
  
  Sub DepartCodeIni()  										'部门初始化
    if Count1>0 then
    	Redim departcode(Count1),departname(count1)
    	<% for i=1 to Count1 %>
	   		departcode(<%=i%>)="<%=departcode(i)%>"
	   		departName(<%=i%>)="<%=departName(i)%>"
		<% Next %>   	
    	document.forms(0).departID.length=Count1+1
    	for i=1 to Count1
    		document.forms(0).departID.options(i).text=departcode(i)+"-"+departName(i)
    		document.forms(0).departID.options(i).value=departcode(i)
    	next
    end if
    document.forms(0).departID.selectedindex=0
  End Sub

  Sub StuffIni()  										'部门初始化
     if Count2>0 then
    	Redim departcode1(Count2),StuffNum(count2),StuffName(Count2)
    	<% for i=1 to Count2 %>
	   		departcode1(<%=i%>)="<%=departcode1(i)%>"
	   		StuffNum(<%=i%>)="<%=StuffNum(i)%>"
	   		StuffName(<%=i%>)="<%=StuffName(i)%>"
		<% Next %>   	
    	document.forms(0).Sales.length=Count2+1
    	for i=1 to Count2
    		document.forms(0).Sales.options(i).text=StuffNum(i)+"-"+StuffName(i)
    		document.forms(0).Sales.options(i).value=StuffNum(i)
    	next
    end if
     document.forms(0).sales.selectedindex=0
  End Sub

  '改变部门编码,调整员工编码
  Sub departcodeclick() 
  	dim sindex
    dim Childstuff,Childname		  							 '表示调整后的员工编码和姓名
    
  	sindex=document.forms(0).departid.selectedindex
  	if sindex>0 then
  		
  		'*****************计算相应的员工工号*******************
  		ChildSecond=""
  		ChildMode=""	
  		for i=1 to Count2
  			if departcode1(i)=departcode(sindex) then
  				if ChildStuff<>"" then
  					ChildStuff=ChildStuff+","+stuffnum(i)
  					Childname=Childname+","+stuffname(i)
  				else
  					ChildStuff=ChildStuff+stuffnum(i)
  					Childname=Childname+stuffname(i)
  				end if
  			end if
  		next
  		ChildStuff=Split(ChildStuff,",")
  		Childname=Split(Childname,",")
  		
  		'*****************调整相应的员工编码和信息*******************
  		document.forms(0).sales.length=UBound(Childstuff)+2
    	for i=1 to UBound(Childstuff)+1
    		document.forms(0).sales.options(i).text=ChildStuff(i-1)+"-"+Childname(i-1)
    		document.forms(0).sales.options(i).value=ChildStuff(i-1)
    	next
    	document.forms(0).sales.selectedindex=0
  	else
  		Call DepartCodeIni()  	
  		Call StuffIni()
  	end if 	
  End sub

  '改变员工编码,调整部门编码
  Sub stuffcodeclick() 
  	dim sindex
    dim childdepart,childname		  							 '表示调整后的部门编码和名称
    
  	sindex=document.forms(0).sales.selectedindex
  	if sindex>0 then
  		'*****************计算相应的部门编码和名称*******************
  		childstuff=document.forms(0).sales.value
  		for i=1 to count2
  			if stuffnum(i)=childstuff then
  				childdepart=departcode1(i)
  				exit for
  			end if
  		next
  		
  		for i=1 to Count1
  			if departcode(i)=childdepart then
  				childname=departname(i)
  				exit for		
  			end if
  		next
  		  		
  		'*****************调整相应的部门编码*******************
  		document.forms(0).departID.length=2
    	document.forms(0).departID.options(1).text=childdepart+"-"+childname
    	document.forms(0).departID.options(1).value=childdepart
    	document.forms(0).departID.selectedindex=1
  	else
  		Call DepartCodeIni()  	
  		Call StuffIni()
  	end if 	

⌨️ 快捷键说明

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