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

📄 function.asp

📁 一个比较完整的企业erp系统
💻 ASP
📖 第 1 页 / 共 3 页
字号:
'		   if isnumeric(mid(val_,iisNum,1)) = false then
'			  isNumber = isNumberLast
'			  exit function
'		   else
'			  isNumber = val
'		   end if
'	   next
'	case "dec"
'	   if UBound(Split(val_,".")) > 1 then
'		  isNumber = isNumberLast
'		  exit function
'	   end if
'	   val__ = Replace(val_,".","")
'	   valLen = len(val__)
'	   for iisNum = 1 to valLen
'		   if isnumeric(mid(val__,iisNum,1)) = false then
'			  isNumber = isNumberLast
'			  exit function
'		   else
'			  isNumber = val
'		   end if
'	   next	
' end select
' if csng(isNumber) < 0 then isNumber = -(abs(isNumber)) else isNumber = abs(isNumber)
' if inStrRev(isNumber,".") = 1 then isNumber = "0" & isNumber
'End function




Public Function GetText(Textname,selgp,selstr,minLen,maxLen,lastGetText)
         if lastGetText = "" then lastGetText = "…"
		 if lastGetText = "none" then lastGetText = " "
		 dim Textname_
		 Textname_ = trim(Request(Textname))
         if selgp = "P" then Textname_ = trim(Request.form(Textname))
		 Select case selstr
		    case "Str",""
			  if Len(Textname_) < minLen or Len(Textname_) > maxLen then Textname_ = lastGetText
			case "number"
			  Textname_ = isNumber(Textname_,"dec",lastGetText)
			  if Len(Textname_) < minLen or Len(TextStr) > maxLen then Textname_ = lastGetText
         End Select
		 GetText = Textname_
End Function

Public Function SelectZD(SQL,SelectZDLast)
         Set SZ = conn.Execute(SQL)
	         if not SZ.eof then
			    SelectZD = trim(SZ(0))
			 else
			    SelectZD = SelectZDLast
			 end if
			 if SelectZD = "" or isnull(SelectZD) then SelectZD = SelectZDLast
		 SZ.Close
		 Set SZ = Nothing
End Function





'选择多字段
'SQL = "select uid,userLoginid,userName from TABuserList "
'Public ZD(2)
'Call SAZD(SQL,ZD,"SAZDLast")
'Response.Write ZD(0)
'Response.Write ZD(1)
'Response.Write ZD(2)
Public Function SAZD(SQL,ZD,SAZDLast)
    dim SZ
    Set SZ = Conn.Execute(SQL)
	if SZ.eof then
	   for iSAZD = 0 to Ubound(ZD) 
	       ZD(iSAZD) = SAZDLast 
	   next
	else
	   for iSAZD = 0 to Ubound(ZD)
		   ZD(iSAZD) = trim(SZ(iSAZD))
		   if isnull(ZD(iSAZD)) or ZD(iSAZD) = "" then ZD(iSAZD) = SAZDLast
	   next
    end if
	SZ.Close
	Set SZ = Nothing
End Function









Public Function viewinfo(sel,info,gourl)
     dim ST , SE
	     ST = "<script type = 'text/javascript'>"
		 SE = "</script>"
     Select case sel
	    case "alertBack"
		     vi = " alert('" & info & "');history.go(-1); "
		case "alertLoca"
		     vi = " alert('" & info & "');location.href = '" & gourl & "'; "
		case "Location"
             vi = "location.href = '" & gourl & "';"
		case "LocaparentTime"
             vi = "setTimeout('parent.location.href = \'" & gourl & "\'',2000);"
	    case "alertClose"
		     vi = "alert('" & info & "');window.close();"
	    case "divLoca"
		     vi = "var BW = document.body.clientWidth ;var BH = document.body.clientHeight ;" & _
			      "document.write(""<div style='position: absolute; left:""+((BW-300)/2)+""px;top:""+((BH-100)/2)+""px;width:300px;height:10px;z-index:100;border:solid red 3px ;background-color:#eeeeee;text-align:center;padding:5px;'>" & info & "</div>"");"
		case "LocaTimeself"
             vi = "setTimeout('location.href = \'" & gourl & "\'',2000);"
	    case "Logingo"
		     vi = "parent.top.location.href='" & HOME_PATH & "index.asp';" 
		case "LoginC"
             vi = "window.close();" 
	    case "CloseTime"
		     vi = gourl & "setTimeout('window.close()'," & info & ");"
	 End Select
	 viewinfo = ST & vi & SE
End Function

		
Public Function outPriceinPrice(inprice_ALL,EveryKCP_Sum_ALL)
	Set CS = Server.CreateObject("adodb.RecordSet")
	A__ = ("select stockid from salelist where not isnull(saleid) " & DATE_SQL & keySQL & " group by stockid")
	CS.Open(A__),Conn,1,1
	if not CS.eof then
	   CSCount = CS.RecordCount
	   for i_C = 1 to CSCount
		   inpriceOne = SelectZD("select inprice from stock where stockid = " & CS("stockid") & "",0)
		   inhowSum = SelectZD("select Sum(inhow) from stock where stockid = " & CS("stockid") & "",0)
		   outhowSum = SelectZD("select Sum(outhow) from salelist where stockid = " & CS("stockid") & "",0)
		   KCP = (inhowSum-outhowSum)
		   inpriceOne_Sum = inpriceOne*inhowSum
		   inprice_ALL = inprice_ALL + inpriceOne_Sum
		   EveryKCP_Sum = inpriceOne * KCP
		   EveryKCP_Sum_ALL = EveryKCP_Sum_ALL + EveryKCP_Sum
		   CS.movenext
	   next
	else
	end if
	CS.Close
	Set CS = Nothing
End Function















Public Function RowCount(textName)
         if isnull(textName) or textName = "" then 
		    RowCount = 0
		    Exit Function
		 end if
		 textNameReplace = Replace(textName," ","")
		 textNameUBound = UBound(Split(textNameReplace,","))
		 if textNameUBound < 0 then textNameUBound = 0
		 RowCount = textNameUBound
End Function


Public Function Split_(invalue,boxoff)
    if isnull(invalue) or invalue = "" then
	   Split_ = Split("")
	   Exit Function
	end if
	if boxoff = "" then boxoff = ","
    SplitValue = Split(Replace(invalue," ",""),boxoff)
	Split_ = SplitValue
End Function


Public Function SearchSupplier(Rs,SQL,Rsupplierid,boxName,boxStyle)
   Rs.Open(SQL),Conn,1,1
      if not Rs.eof then
	     dim S
		 S = "<select name = '" & boxName & "' style = '" & boxStyle & "'>"
	     for i_uid = 1 to Rs.RecordCount
		     Suid = Rs("uid")
			 SFullName = Rs("FullName")
			 if Rsupplierid = Suid then 
			    Selected_ = " style = 'color:red;' selected = 'selected' " 
			 else 
			    Selected_ = ""
			 end if
		     SO = SO & "<option value = '" & Suid & "' " & Selected_ & ">" & SFullName &  "</option>"
			 Rs.movenext
		 Next

		 if Rsupplierid = 0 then Selected__ = " style = 'color:red;' selected = 'selected' " else Selected__ = ""
		 SearchSupplier = S & SO & "<option value = '' " & Selected__ & ">全部供应商</option></select>"
	  else
	     SearchSupplier = "请先添加一个供应商!"
	  end if
	  Rs.Close
End Function



Public Function SelectSupplier(supplierid)
   Rs.Open("select * From supplier Order By supplierid Desc"),Conn,1,1
      if not Rs.eof then
	     dim i_supplierid , supplierid__ , supplier__ , OptionList
	     SelectSupplier = "<select name = 'supplierid' size = '1'>"
		 for i_supplierid = 1 to Rs.RecordCount
		     supplierid__ = Rs("supplierid")
			 supplier__ = Rs("supplier")
		     if supplierid = supplierid__ then option__ = " style = 'color:red;' selected = 'selected' " else option__ = ""
		     OptionList_ = OptionList_ & "<option value = '" & supplierid__ & "' " & option__ & ">" & supplier__ & "</option>"
			 Rs.movenext
		 Next
		 SelectSupplier = SelectSupplier & OptionList_ & "</select>"
	  else
	     SelectSupplier = "请先添加一个供应商类别!"
	  end if
	  Rs.Close
End Function

















Function v1v2(v1,v2,view,Lastv1v2)
         if v1 = v2 then 
		    v1v2 = view
		 else
		    v1v2 = Lastv1v2
		 end if
end Function




Public ProductZDArr
       ProductZDArr = array(stockid , supplierid , productname , unit , inprice , inhow , total , intotime , uid , uuid , remark , SQL)
Public Function Productview(ProductZDArr)
       dim PS
       Set PS = Server.CreateObject("Adodb.RecordSet")
	       PS.Open(SQL),Conn,1,1
		   if not PS.eof then
			  stockid = PS("stockid")
			  supplierid = PS("supplierid")'相应供应商id
			  mtypeid = PS("mtypeid")'所属商品类别id
			  Code = PS("Code")'代码
			  cName = PS("cName")'中文名
			  eName = PS("eName")'英文名
			  eRemark = PS("eRemark")'英文备注
			  cRemark = PS("cRemark")'中文备注
			  typeCode = PS("typeCode")'型号条码
			  Quality = PS("Quality")'性质-
			  inprice = PS("inprice")'参考进货价
			  outprice = PS("outprice")'参考预出售价
			  productname = PS("productname")
			  unit = PS("unit")

			  inprice = isNumber(PS("inprice"),"dec",0)
			  inhow = isNumber(PS("inhow"),"dec",0)
			  total = isNumber(PS("total"),"dec",0)

			  intotime = PS("intotime")
			  thisDate = PS("thisDate")
			  uid = PS("uid")
			  uuid = PS("uuid")
			  remark = PS("remark")
		   else
		      id = 0
		   end if
		   PS.Close
		   Set PS = Nothing
End Function


Public SaleZDArr
       SaleZDArr = array(saleid , stockid , outprice , outhow , uid , outtime , outdate , outremark)
Public Function Saleview(SaleZDArr)
       dim sRs
	   Set sRs = Server.CreateObject("Adodb.RecordSet")
	       sRs.Open(SQL),Conn,1,1
		   if not sRs.eof then
			  saleid = sRs("saleid")
			  stockid = sRs("stockid")
			  outprice = sRs("outprice")

			  outhow = isNumber(sRs("outhow"),"dec",0)
			  inhow = isNumber(sRs("inhow"),"dec",0)

			  intotime = sRs("intotime")
			  thisDate = sRs("thisDate")
			  uid = sRs("uid")
			  uuid = sRs("uuid")
			  remark = sRs("remark")
		   else
		      id = 0
		   end if
		   sRs.Close
		   Set sRs = Nothing
End Function


Public Function PaginatinoGoogle(byref Rs,noteTotal,thisPageSize,LinkFile,LUrl,LArr)
		 noteTotal = Rs.RecordCount '记录总数
		 thisPageSize = abs(isNumber(thisPageSize,"int",10))
		 rs.PageSize = thisPageSize '每页显示记录数
		 Page = trim(request("Page"))
		 Page = abs(isNumber(Page,"int",1))
		 MaxPage = Rs.PageCount
		 if Page > MaxPage then Page = MaxPage
		 if Page = 0 then Page = 1
		 rs.AbsolutePage = Page
		 PPrevPagePic = "首页"
		 NNextPagePic = "尾页"
		 if Page > 1 then 
		    PagePrint = "<a href='" & LinkFile &"?Page=1" & "&" & LUrl & "'>" & PPrevPagePic & "</a> <a href='" & LinkFile &"?Page=" & (Page - 1) & "&" & LUrl & "'>" & PrevPagePic & "</a>"
		 else
		    PagePrint =  " " & PPrevPagePic & " " & PrevPagePic & " "
		 end if  

         'PCount-当前页面前,循环显示4页-->
         '1---PCount页要特殊对待
		 dim i_P
		 PCount = isNumber(PCount,"int",5)
		 For i_P = 1 to PCount
			 if Page > i_P then 
			    A = i_P
			 else
			 end if
		 Next
		 'Response.Write "A = " & A
         '当前页面前,循环显示PCount页
         i = ""
         for i = (Page - A) to (Page - 1)
             PagePrint = PagePrint & " <a href='" & LinkFile & "?Page=" & i & "&" & LUrl & "'>" & i & "</a> "
         next

         '当前所在页面
         PagePrint = PagePrint & " <span style='color:red;'>" & Page & "</span> "

         '当前页面后,循环显示PCount页
         i = ""
         for i = (Page + 1) to (Page + PCount)
             if i > MaxPage then exit for
                PagePrint = PagePrint & " <a href='" & LinkFile & "?Page=" & i & "&" & LUrl & "'>" & i & "</a> "
         next

		 if Page = MaxPage or Page > MaxPage then
		    PagePrint = PagePrint & " " & NextPagePic & " " & NNextPagePic & " "
		 else
		    PagePrint = PagePrint & " <a href='" & LinkFile & "?Page=" & (Page+1) & "&" & LUrl & "'>" & NextPagePic & "</a> <a href='" & LinkFile & "?Page=" & MaxPage & "&" & LUrl &"'>" & NNextPagePic & "</a> "
		 end if
         
     PaginatinoGoogle = "总记录:" & noteTotal & " " & thisPageSize & "/页 页次:" & Page & "/" & MaxPage & " " & PagePrint 
End Function



Function Pagination(ByRef rs,Page,thisPageSize,SELPageSize,LinkFile,LUrl,LB,LC,LD)

         dim total,retval,MaxPage
		     total = Rs.RecordCount
             Page = trim(request("Page"))
             Page = abs(isNumber(Page,"int",1))
			 SELPageSize = trim(request("PageSize"))
			 SELPageSize = abs(isNumber(SELPageSize,"int",10))
             thisPageSize = SELPageSize
			 rs.PageSize = thisPageSize '每页条数
		     MaxPage = Rs.PageCount '总页数
		     if Page > MaxPage then Page = MaxPage
		     if Page <= 0 then Page = 1
             rs.absolutepage = Page


			 PageSizeArr = Array(10,20,40,80,160,total)
			 PageSizeArrCount = Ubound(PageSizeArr)
			 For i_PSArr = 0 to PageSizeArrCount
			     if thisPageSize = PageSizeArr(i_PSArr) then viewPage = "<span style='color:red;'>" & PageSizeArr(i_PSArr) & "</span>" else viewPage = PageSizeArr(i_PSArr) end if
				 viewPageA = viewPageA & viewPage
				 SELPAGE = " <a href = '" & LinkFile & "?Page=" & Page & "&PageSize=" & PageSizeArr(i_PSArr) & LUrl & "'>" & viewPage & "</a> "
				 SELPAGEA = SELPAGEA & SELPAGE 
			 Next
		     SELPAGE = SELPAGEA 
             
			 if Page = 1 then 
			    retval = "首页 前页"
			 else
			    if Page > MaxPage then Page = MaxPage
			    retval = "<a href='"&LinkFile&"?page=1" & LUrl & "' title='第一页'>首页</a> <a href='"&LinkFile&"?page=" & (Page-1) & LUrl &"' title='前一页'>前页</a>"
			 end if

		     retval = retval &" 页次:<span style='color:red;'>" & Page & "</span>/<span style='color:blue;'>" & MaxPage & "</span> "


			 retval = retval & "每页显示" & SELPAGE & "记录  总记录:<span style='color:red;'>" & total & "</span> "

			 if Page = MaxPage then 
			    retval = retval & "后页 尾页"
			 else
			    retval = retval & "<a href='" & LinkFile & "?page="&(Page+1) & LUrl & "' title='后一页'>后页</a> <a href='" &LinkFile&"?page=" & MaxPage & LUrl & "' title='最后一页'>尾页</a> "
			 end if
             Pagination = retval
			 LB = total
End Function











Public Function ConnClose()
	if IsObject(Rs) then
		Set Rs=NoThing
	end if
	if IsObject(Conn) then
		Conn.close
		Set Conn=NoThing
	end if
End Function

%>

		        

⌨️ 快捷键说明

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