Activity——活动管理模块 Analyse——分析模块 Client——客户管理系统模块 Email——E-mail管理模块 Fee——费用管理模块 Report——报表模块 Sel

源代码在线查看: function.asp

软件大小: 261 K
上传用户: peterzhang1982
关键词: 模块 Activity Analyse Client
下载地址: 免注册下载 普通下载 VIP

相关代码

								
				'自动获得唯一编号
				'取年月日小时分秒
				FUNCTION GetAutoID()
					GetAutoID = Right(CStr(Year(Date())),1)&Month(Date())&Day(Date())&hour(Time())&Minute(Time())&Second(Time())
				END FUNCTION
				
				
				'**********************************************************************
				'Comment: Replace T-SQL special character
				'Input:   (must)theString - The String that need to Insert or Update DateBase
				'         (must)IsGetSql - if need to replace ' 
				'Returns: The String that can use in T-SQL
				'Modify:   # delete some transform "--, Chr(34)"
				'          # remove some invalid char
				'**********************************************************************
				FUNCTION CheckStrInput(theString)
				  DIM pI
				  
				  IF IsNull(theString) or isEmpty(theString) THEN 
				     CheckStrInput = ""
				     Exit FUNCTION
				  END IF
				  
				  CheckStrInput = TRIM(theString)
				  'remove invalid char
				  FOR pI = 0 TO 31
				    IF pI9 AND pI10 AND pI13 THEN CheckStrInput = Replace(CheckStrInput,CHR(pI),"")
				  NEXT
				  
				  CheckStrInput = Replace(CheckStrInput,"'"," ")
				END FUNCTION
				
				'字符加密
				FUNCTION encrypt(strsource)
					
					dim intkey,intoffset,i,strback,lngasc,intlength
					
					intkey=119
					Randomize
					intoffset = Int(101 * Rnd + 100)	'设置偏移量
				
					strback = Hex(intoffset) '把偏移量转换为16进制
					If Len(strback) = 1 Then strback = "0" & strback   '偏移量为2位,不足的补齐
				
					For i = 1 To Len(strsource)
						lngasc = Asc(Mid(strsource, i, 1)) + intoffset
						lngasc = lngasc Xor intkey
				    
						intlength = Len(Hex(lngasc))
						strback = strback & intlength & Hex(lngasc)
					Next 
				
					encrypt=strback
				END FUNCTION
				
				'字符解密
				FUNCTION decrypt(strsource)
					dim intkey,i,strtemp,intpos,flag,intlength,intnumber,lngasc,strback,intoffset	
					intkey=119	
					'取出偏移量
					strtemp = " &H" & Left(strsource, 2)	
					intoffset =clng(strtemp)	
					intpos = 3
					flag = True
					For i = 3 To Len(strsource)
						If flag = True Then
							intlength = cint(Mid(strsource, i, 1))
							intnumber = 0
							intpos = i + 1
							flag = False
						Else
							intnumber = intnumber + 1
							If intnumber = intlength Then
								strtemp = " &H" & Trim(Mid(strsource, intpos, intlength))
				
								lngasc = clng(strtemp)
								lngasc = lngasc Xor intkey
								lngasc = lngasc - intoffset
								strback = strback & Chr(lngasc)
				           
								flag = True
							End If
						End If
					Next 
				
					decrypt=strback
				END FUNCTION
				
				
				''根据id 显示操作者名称
				Function showoperatorname(id)
					dim rec
					set rec = server.createobject("adodb.recordset")
					sql_show= "select * from [user] where UserID="&id
					rec.open sql_show,conn,3
					if not rec.eof then
					   showoperatorname=rec("Username")
					else
					    showoperatorname=""
					end if
					set rec=nothing
				End Function
				
				
				''根据id 显示客户名称
				Function showclientname(id)
					dim rec
					set rec = server.createobject("adodb.recordset")
					sql_show= "select * from client where clientid="&id
					rec.open sql_show,conn,3
					if not rec.eof then
					   showclientname=rec("clientname")
					else
					    showclientname=""
					end if
					set rec=nothing
				End Function
				
				''根据id显示部门
				Function showsection(id)
					dim rec
					set rec = server.createobject("adodb.recordset")
					sql_show= "select * from section where sectionid="&id
					rec.open sql_show,conn,3
					if not rec.eof then
					   showsection=rec("sectionname")
					else
					     showsection=""
					end if
					set rec=nothing
				End Function
				
				''按照客户统计金额
				Function showsellsum_c(id)
					dim rec
					set rec = server.createobject("adodb.recordset")
					sql_show= "select sum(sellmoney) as total_s from sell where sellclientid="&id
					rec.open sql_show,conn,3
					if not rec.eof then
					   showsellsum_c=rec("total_s")
					else
					     showsellsum_c=""
					end if
					set rec=nothing
				End Function
				
				'''按照操作者统计金额
				Function showsellsum_o(id)
					dim rec
					set rec = server.createobject("adodb.recordset")
					sql_show= "select sum(sellmoney) as total_s from sell where sellcreatorid="&id
					rec.open sql_show,conn,3
					if not rec.eof then
					   showsellsum_o=rec("total_s")
					else
					     showsellsum_o=""
					end if
					set rec=nothing
				End Function
				
				'''按照产品统计金额
				Function showsellsum_p(id)
					dim rec
					set rec = server.createobject("adodb.recordset")
					sql_show= "select sum(sellmoney) as total_s from sell where sellproduct='"&id&"'"
					rec.open sql_show,conn,3
					if not rec.eof then
					   showsellsum_p=rec("total_s")
					else
					     showsellsum_p=""
					end if
					set rec=nothing
				End Function
				
				''按照销售单统计金额
				Function showsellsum_x(id,topic)
					dim rec
					set rec = server.createobject("adodb.recordset")
					sql_show= "select sum(sellmoney) as total_x from sell where sellclientid="&id&" and selltopic='"&topic&"'"
					rec.open sql_show,conn,3
					if not rec.eof then
					   showsellsum_x=rec("total_x")
					else
					     showsellsum_x=""
					end if
					set rec=nothing
				End Function
				
				''统计总金额
				Function showselltotalmoney()
					dim rec
					set rec = server.createobject("adodb.recordset")
					sql_show= "select sum(sellmoney) as total_x from sell "
					rec.open sql_show,conn,3
					if not rec.eof then
					   showselltotalmoney=rec("total_x")
					else
					     showselltotalmoney=""
					end if
					set rec=nothing
				End Function
				
				''统计总数量
				Function showselltotalsum()
					dim rec
					set rec = server.createobject("adodb.recordset")
					sql_show= "select sum(sellproductnum) as total_x from sell"
					rec.open sql_show,conn,3
					if not rec.eof then
					   showselltotalsum=rec("total_x")
					else
					     showselltotalsum=""
					end if
					set rec=nothing
				End Function
				%>			

相关资源