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

📄 pub_fun.asp

📁 Activity——活动管理模块 Analyse——分析模块 Client——客户管理系统模块 Email——E-mail管理模块 Fee——费用管理模块 Report——报表模块 Sel
💻 ASP
字号:
<%

'自动获得唯一编号
'取年月日小时分秒
FUNCTION GetAutoID()
	GetAutoID = Right(CStr(Year(Date())),2)&Month(Date())
	GetAutoID =GetAutoID &Day(Date())&hour(Time())
	GetAutoID =GetAutoID &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)
  '去除一些非法的字符
  FOR pI = 0 TO 31
    IF pI<>9 AND pI<>10 AND pI<>13 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

Function htmlencode2(sInput)
  dim sAns
  sAns = replace(sInput, " ", "&nbsp;")
  sAns = replace(sAns, chr(34), "&quot;")
  sAns = replace(sAns, "<!--", "&lt;!--")
  sAns = replace(sAns, "-->", "--&gt;")
  sIllStart = "<" & chr(37)
  sIllEnd = chr(37)  & ">"
  if instr(sAns, sIllStart) > 0 or instr(sAns, sIllEnd) > 0 then
    sAns = replace(sAns, "<" & chr(37), "")
    sAns = replace(sAns, chr(37)  & ">", "")
    bIllegal = true
  end if
  sAns = replace(sAns, ">", "&gt;")
  sAns = replace(sAns, "<", "&lt;")
  sAns = replace(sAns, vbcrlf, "<BR>")
  htmlencode2 = sAns
End Function

''还原被Html格式化的字符串
Function keepformat(output)
dim str
if len(output)<>0 then
   str=replace(output,"<br>",chr(13))   
   str=replace(str,"<BR>",chr(13))
   str=replace(str,"&nbsp;"," ")
   keepformat=replace(str,"<P>",chr(13)+chr(10))
else
   keepformat=""
end if
End function

''根据id 显示操作者名称
Function showoperatorname(id)
    if trim(id)="" then                                   ''判断输入是否为空
	   showoperatorname=""
       exit function
	end if 
	dim rec
	set rec = server.createobject("adodb.recordset")
	sql_show= "select * from [user] where UserID="&trim(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)
    if id="" then
	   showclientname=""
       exit function
	end if 
	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 showtouchmanname(id)
    if id="" then
	   showtouchmanname=""
       exit function
	end if 
    if  isnull(id)  then
	   showtouchmanname=""
       exit function
	end if 	
	dim rec
	set rec = server.createobject("adodb.recordset")
	sql_show= "select * from touchman where touchmanid="&id
	rec.open sql_show,conn,3
	if not rec.eof then
	   showtouchmanname=rec("touchmanname")
	else
	    showtouchmanname=""
	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
%>

⌨️ 快捷键说明

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