📄 function.asp
字号:
<%
Public Function SELVAR(SEL,LASTSELVAR)
dim S
Y = Year(now)
M = month(now)
if Len(M) < 2 then M = "0" & M
D = day(now)
if Len(D) < 2 then D = "0" & D
Select Case SEL
Case "FN"
URL = trim(Request.ServerVariables("SCRIPT_NAME"))
FN = Right(url, Len(URL) - InStrRev(URL, "/"))
S = FN
Case "YY"
S = year(now)
Case "MM"
if Len(M) < 2 then M = "0" & M
S = M
Case "DD"
if Len(D) < 2 then D = "0" & D
S = D
Case "SaleNum"
if Len(D) < 2 then D = "0" & D
LastNum = SelectZD("select saleid from sale Order by saleid desc",0)
if Len(LastNum)< 6 then LastNum = left("00000000",6-len(LastNum+1)) & LastNum+1
S = Year(now) & M & D & LastNum
Case "thisDate"
S = Y & "-" & M & "-" & D
Case "DateNum"
S = Y & M & D & hour(now) & Minute(Now)
Case "stockNum"
if Len(D) < 2 then D = "0" & D
LastNum = SelectZD("select stockmid from stockm Order by stockmid desc",0)
if Len(LastNum)< 6 then LastNum = left("00000000",6-len(LastNum+1)) & LastNum+1
S = Year(now) & M & D & LastNum
End Select
SELVAR = S
End Function
Function SOBJ(n,ServerObj)
On Error Resume Next
dim ServerObject(18)
ServerObject(0) = "MSWC.AdRotator"
ServerObject(1) = "MSWC.BrowserType"
ServerObject(2) = "MSWC.NextLink"
ServerObject(3) = "MSWC.Tools"
ServerObject(4) = "MSWC.Status"
ServerObject(5) = "MSWC.Counters"
ServerObject(6) = "IISSample.ContentRotator"
ServerObject(7) = "IISSample.PageCounter"
ServerObject(8) = "MSWC.PermissionChecker"
ServerObject(9) = "Scripting.FileSystemObject"
ServerObject(10) = "adodb.connection"
ServerObject(11) = "SoftArtisans.FileUp"
ServerObject(12) = "SoftArtisans.FileManager"
ServerObject(13) = "JMail.SMTPMail"
ServerObject(14) = "CDONTS.NewMail"
ServerObject(15) = "Persits.MailSender"
ServerObject(16) = "LyfUpload.UploadFile"
ServerObject(17) = "Persits.Upload.1"
ServerObject(18) = "ADODB.Stream"
SOBJ = False
Set ServerObj = Server.CreateObject(ServerObject(n))
if Err = 0 then
SOBJ = true
else
Err.Clear
end if
End Function
Sub Create_Folder(PATH_NAME)
if not Right(PATH_NAME,1) = "/" then PATH_NAME = PATH_NAME & "/"
if SOBJ(9,ServerObj) = false then
else
if ServerObj.FolderExists(Server.MapPath(PATH_NAME)) = False Then
F_PATHA = split(PATH_NAME,"/")
F_PATHB = F_PATHA(0)
For i_FPATH = 0 to (ubound(F_PATHA))
if i_FPATH = 0 then F_PATHC = F_PATHB else F_PATHC = F_PATHC & "\" & F_PATHA(i_FPATH)
if not i_FPATH = ubound(F_PATHA) then
if ServerObj.FolderExists(Server.MapPath(F_PATHC)) = False Then ServerObj.CreateFolder(Server.MapPath(F_PATHC))
end if
next
end if
end if
Set ServerObj = Nothing
End Sub
'***************************************************************************************************
Function StrLen(textStr,textLen,ShowLast)
ShowLast = ShowLast
if ShowLast = "" then ShowLast = "…"
if Len(textStr) > textLen then
textStr = Left(textStr,textLen)&ShowLast
else
textStr = textStr
end if
StrLen = textStr
End Function
'***************************************************************************************************
Public SupplierinfoArr
SupplierinfoArr = array(USuid, USCode, USForShort , USHelpMarkCode, USFullName , USLinkman , USPlace , USLinkPhone , USmobileTelehone , USfax , USEmail , USArrearageTime , USArrearageTether , USBankNumber , USWebSite , USScopeOfOperation , USAddress , USdisabled , USPriceType , USutypeid , USregtime , USlasttime , USRemark)
Public AdmininfoArr
AdmininfoArr = array(AAid , ALoginid , ALoginPassWord , ATrueName , APcNum , APlace , APhone , AMobileTelephone , AWebsite , AEmail , AZip , AIdCard , ABirthday , ANativePlace , AFolk , ASex , AMarital , APassDegree , AFlag , ARank , AAddress , Adisabled , AAtypeid , ARegtime , Alasttime , ARemark )
Public mArray
mArray = array(Mstockid , Misstockid , MstockNum , Msupplierid , Mmtypeid , MCode , McName , Mmodel , MeName , MeRemark , McRemark , MtypeCode , MQuality , Minprice , Moutprice , Minhow , Munit , Mtotal , Minpayment , Mintotime , Mupdatetime , MguarantyTime , MguarantyRemark , MstockMax , MstockMin , MthisDate , Maid , Mauid , Mdisabled , MinModel )
CLASS CL01
Public us
Private Sub Class_Initialize()
Set us = Server.CreateObject("Adodb.RecordSet" )
End Sub
Public function Supplierinfo
us.Open(SQL),Conn,1,3
if not us.eof then
USuid = us("uid")
USCode = us("Code")'代码
USForShort = us("ForShort")'简称
USHelpMarkCode = us("HelpMarkCode")'助记码
USFullName = us("FullName")'全称
USLinkman = us("Linkman")'联系人
USPlace = us("Place")'职位
USLinkPhone = us("LinkPhone")'联系电话
USmobileTelehone = us("mobileTelehone")'手机
USfax = us("fax")'
USEmail = us("Email")'
USArrearageTime = us("ArrearageTime")'欠款期限
USArrearageTether = us("ArrearageTether")'欠款限额
USBankNumber = us("BankNumber")'银行帐号
USWebSite = us("WebSite")'网址
USScopeOfOperation = us("ScopeOfOperation")'经营范围
USAddress = us("Address")'详细地址
USdisabled = us("disabled")'是否可用
USPriceType = us("PriceType")'价格类型
USutypeid = us("utypeid")'注册到-相应id
USregtime = us("regtime")'注册时间
USlasttime = us("lasttime")'最后活动时间
USRemark = us("Remark")'备注
else
USutypeid = 0
USuid = 0
USLinkman = "未知"
end if
us.Close
End function
Public function Admininfo
us.Open(SQL),Conn,1,3
if not us.eof then
AAid = us("aid")
ALoginid = us("Loginid")'登陆名
ALoginPassWord = us("LoginPassWord")'登陆密码
ATrueName = us("TrueName")'真名
APcNum = us("PcNum")'电脑编号
APlace = us("Place")'职位
APhone = us("Phone")'联系电话
AMobileTelephone = us("MobileTelephone")'移动电话
AWebsite = us("Website")'网址
AEmail = us("Email")'Email
AZip = us("Zip")'邮编
AIdCard = us("IdCard")'身份证
ABirthday = us("Birthday")'生日
ANativePlace = us("NativePlace")'籍贯
AFolk = us("Folk")'民族
ASex = us("Sex")'
AMarital = us("Marital")'婚姻否
APassDegree = us("PassDegree")'学位
AFlag = us("Flag")'权限
ARank = us("Rank")'等级
AAddress = us("Address")'详细地址
Adisabled = us("disabled")'是否可用
AAtypeid = us("Atypeid")
ARegtime = us("Regtime")
Alasttime = us("lasttime")
ARemark = us("Remark")'备注
else
AAid = 0
end if
us.Close
End function
Public function mArray
us.Open(SQL),Conn,1,3
if not us.eof then
Mstockid = us("stockid")'
Misstockid = us("isstockid")'相关主记录id
MstockNum = us("stockNum") '进货号
Msupplierid = isNumber(us("supplierid"),"int",0)'相应供应商id
Mmtypeid = isNumber(us("mtypeid"),"int",0)'所属商品类别id
MCode = us("Code")'代码
McName = us("cName")'中文名
Mmodel = us("model")'型号
MeName = us("eName")'英文名
MeRemark = us("eRemark")'英文备注
McRemark = us("cRemark")'中文备注
MtypeCode = us("typeCode")'型号条码
MQuality = us("Quality") '性质
Minprice = us("inprice")'参考进货价
Moutprice = us("outprice")'参考预出售价
Minhow = us("inhow")'数量
Munit = us("unit")'单位
Mtotal = us("total")'总价格
Minpayment = us("inpayment")'已支付给供应商
Mintotime = us("intotime")'进货时间
Mupdatetime = us("updatetime")'最后修改时间
MguarantyTime = us("guarantyTime")'保修期
MguarantyRemark = us("guarantyRemark")'保修期备注
MstockMax = us("stockMax")'库存上限
MstockMin = us("stockMin")'库存下限
MthisDate = us("thisDate")'
Maid = isNumber(us("aid"),"int",0)'
Mauid = isNumber(us("auid"),"int",0)'
Mdisabled = isNumber(us("disabled"),"int",0)'
MinModel = us("inModel")'入库模式-是直接录入或销售时同步录入
else
Mmtypeid = 0
Mstockid = 0
Misstockid = 0
Msupplierid = 0
end if
us.Close
End function
Public function HtmlF(val)
if isnull(val) or val = "" then exit function
HtmlF = Replace(Replace(val,"<br/>",chr(13))," "," ")
end function
Public Function splitList(inv,sgin,lastsplitList)
if isNull(inv) or inv = "" then
splitList = lastsplitList
exit function
end if
invReplace = Replace(inv," ","")
splitinv = Split(invReplace,sgin)
invUbound = UBound(splitinv)
for i_sp = 0 to invUbound
Oneinv = isNumber(splitinv(i_sp),"int",0)
if not i_sp = invUbound then Oneinv = Oneinv & "," else Oneinv = Oneinv
Oneinv_ = Oneinv_ & Oneinv
next
splitList = Oneinv_
End Function
Private Sub Class_Terminate()
if isobject(us) then Set us = nothing
End Sub
End CLASS
Public function classagin(aName,val)
dim c , ed0 , ed1
if val = 0 then ed0 = " selected = 'selected' style = 'color:red;' " else ed0 = ""
if val = 1 then ed1 = " selected = 'selected' style = 'color:red;' " else ed1 = ""
c = "<select name = '" & aName & "' size = '1'>"
c = c & "<option value = '0' " & ed0 & ">客户</option>"
c = c & "<option value = '1' " & ed1 & ">商家</option>"
c = c & "</select>"
classagin = c
end function
Function DateSearch(DateStar,DateEnd,DateSQL,Dateindex,Dateinfo)
DateStar = trim(Request("DateStar"))
DateEnd = trim(Request("DateEnd"))
if isDate(DateStar) = true and isDate(DateEnd) = true then
DateSQL = " and (thisDate Between '" & DateStar & "' and '" & DateEnd & "') "
Dateinfo = "从 " & DateStar &" 到 " & DateEnd
else
dim YY , MM , DD
YY = Year(now)
MM = month(now):if Len(MM) < 2 then MM = "0" & MM
DD = day(now):if Len(DD) < 2 then DD = "0" & DD
SELD = YY & "-" & MM & "-" & DD
SELM = YY & "-" & MM
SELY = YY
SELECT CASE Dateindex
Case "D"
DateSQL = " and left(thisDate,10) = '" & SELD & "'"
Dateinfo = YY & "年" & MM & "月" & DD & "日"
Case "M"
DateSQL = " and left(thisDate,7) = '" & SELM & "'"
Dateinfo = YY & "年" & MM & "月"
Case "Y"
DateSQL = " and left(thisDate,4) = '" & SELY & "'"
Dateinfo = YY & "年"
Case "ALL"
DateSQL = ""
Dateinfo = "全部"
End Select
end if
End Function
Public function htmlencode(str,selhtml)
if not selhtml = "Y" then
htmlencode = str
exit function
end if
dim result
dim l
if isNULL(str) then
htmlencode=""
exit function
end if
l=len(str)
result=""
dim i
for i = 1 to l
select case mid(str,i,1)
case "<"
result=result&"<"
case ">"
result=result&">"
case chr(13)
result=result&"<br/>"
case chr(34)
result=result&"""
case "&"
result=result&"&"
case chr(32)
'result=result&" "
if i+1<=l and i-1>0 then
if mid(str,i+1,1)=chr(32) or mid(str,i+1,1)=chr(9) or mid(str,i-1,1)=chr(32) or mid(str,i-1,1)=chr(9) then
result=result&" "
else
result=result&" "
end if
else
result=result&" "
end if
case chr(9)
result=result&" "
case else
result=result&mid(str,i,1)
end select
next
htmlencode=result
end function
Public AboutDateSelect
AboutDateSelect = array(Byear , Bmonth , Bday , Bin , Eyear , Emonth , Eday , Ein , DATE_INDEX , SearchYmd , Bymd , Eymd , DATE_SQL , DATE_INFO )
Public Function DateSelect(AboutDateSelect)
Byear = trim(GetText(Byear & Bin,"G","number",4,4,"none"))
if Len(Byear) < 4 then Byear = "20" & Byear
Bmonth = trim(GetText(Bmonth & Bin,"G","number",1,2,"none"))
if Len(Bmonth) < 2 then Bmonth = "0" & Bmonth
Bday = trim(GetText(Bday & Bin,"G","number",1,2,"none"))
if Len(Bday) < 2 then Bday = "0" & Bday
Eyear = trim(GetText(Eyear & Ein,"G","number",4,4,"none"))
if Len(Eyear) < 4 then Eyear = "20" & Eyear
Emonth = trim(GetText(Emonth & Ein,"G","number",1,2,"none"))
if Len(Emonth) < 2 then Emonth = "0" & Emonth
Eday = trim(GetText(Eday & Ein,"G","number",1,2,"none"))
if Len(Eday) < 2 then Eday = "0" & Eday
THIS_YEAR = YEAR(NOW)
THIS_MONTH = MONTH(NOW):if Len(THIS_MONTH) < 2 then THIS_MONTH = "0" & THIS_MONTH
THIS_DAY = DAY(NOW):if Len(THIS_DAY) < 2 then THIS_DAY = "0" & THIS_DAY
SearchYmd = trim(Request("SearchYmd"))
if SearchYmd = "YES" then
dim RBymd , BEymd
RBymd = trim(Request("Bymd"))
REymd = trim(Request("Eymd"))
if isDate(RBymd) and isDate(REymd) then
Bymd = RBymd
Eymd = REymd
Byear = SplitAbout(Bymd,"-",0,"20")
Bmonth = SplitAbout(Bymd,"-",1,"0")
Bday = SplitAbout(Bymd,"-",2,"0")
Eyear = SplitAbout(Eymd,"-",0,"20")
Emonth = SplitAbout(Eymd,"-",1,"0")
Eday = SplitAbout(Eymd,"-",2,"0")
DATE_SQL = " and (thisDate Between '" & Bymd & "' and '" & Eymd & "') "
DATE_INFO = "从" & Bymd & "至" & Eymd & ""
else
Bymd = Byear & "-" & Bmonth & "-" & Bday
Eymd = Eyear & "-" & Emonth & "-" & Eday
DATE_SQL = " and (thisDate Between '" & Bymd & "' and '" & Eymd & "') "
DATE_INFO = "从" & Bymd & "至" & Eymd & ""
end if
else
DATE_SQL = ""
Select Case DATE_INDEX
Case "Y"
DATE_SQL = " and left(thisDate,4) = '" & THIS_YEAR & "'"
DATE_INFO = THIS_YEAR & "年"
Case "M"
DATE_SQL = " and left(thisDate,7) = '" & THIS_YEAR & "-" & THIS_MONTH & "'"
DATE_INFO = THIS_YEAR & "年" & THIS_MONTH & "月"
Case "D"
DATE_SQL = " and left(thisDate,11) = '" & THIS_YEAR & "-" & THIS_MONTH & "-" & THIS_DAY & "'"
DATE_INFO = THIS_YEAR & "年" & THIS_MONTH & "月" & THIS_DAY & "日"
End Select
end if
End Function
Public Function Check(BadStr,inputStr,viewBadStr,mode)
valLen = Len(inputStr)
BadLen = Len(BadStr)
vieLen = Len(viewBadStr)
For i_C = 1 to valLen
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -