📄 htlist.asp
字号:
If sOrder = "合同号" Then
sSortField = "[合同号]"
sLastSort = Session("ht_x_5408540C53F7_Sort")
If sLastSort = "ASC" Then sThisSort = "DESC" Else sThisSort = "ASC"
Session("ht_x_5408540C53F7_Sort") = sThisSort
Else
If Session("ht_x_5408540C53F7_Sort") <> "" Then Session("ht_x_5408540C53F7_Sort") = ""
End If
' Field 客户名称
If sOrder = "客户名称" Then
sSortField = "[客户名称]"
sLastSort = Session("ht_x_5BA26237540D79F0_Sort")
If sLastSort = "ASC" Then sThisSort = "DESC" Else sThisSort = "ASC"
Session("ht_x_5BA26237540D79F0_Sort") = sThisSort
Else
If Session("ht_x_5BA26237540D79F0_Sort") <> "" Then Session("ht_x_5BA26237540D79F0_Sort") = ""
End If
' Field 产品型号
If sOrder = "产品型号" Then
sSortField = "[产品型号]"
sLastSort = Session("ht_x_4EA754C1578B53F7_Sort")
If sLastSort = "ASC" Then sThisSort = "DESC" Else sThisSort = "ASC"
Session("ht_x_4EA754C1578B53F7_Sort") = sThisSort
Else
If Session("ht_x_4EA754C1578B53F7_Sort") <> "" Then Session("ht_x_4EA754C1578B53F7_Sort") = ""
End If
' Field 数量
If sOrder = "数量" Then
sSortField = "[数量]"
sLastSort = Session("ht_x_657091CF_Sort")
If sLastSort = "ASC" Then sThisSort = "DESC" Else sThisSort = "ASC"
Session("ht_x_657091CF_Sort") = sThisSort
Else
If Session("ht_x_657091CF_Sort") <> "" Then Session("ht_x_657091CF_Sort") = ""
End If
' Field 价格
If sOrder = "价格" Then
sSortField = "[价格]"
sLastSort = Session("ht_x_4EF7683C_Sort")
If sLastSort = "ASC" Then sThisSort = "DESC" Else sThisSort = "ASC"
Session("ht_x_4EF7683C_Sort") = sThisSort
Else
If Session("ht_x_4EF7683C_Sort") <> "" Then Session("ht_x_4EF7683C_Sort") = ""
End If
' Field 金额
If sOrder = "金额" Then
sSortField = "[金额]"
sLastSort = Session("ht_x_91D1989D_Sort")
If sLastSort = "ASC" Then sThisSort = "DESC" Else sThisSort = "ASC"
Session("ht_x_91D1989D_Sort") = sThisSort
Else
If Session("ht_x_91D1989D_Sort") <> "" Then Session("ht_x_91D1989D_Sort") = ""
End If
' Field 月度
If sOrder = "月度" Then
sSortField = "[月度]"
sLastSort = Session("ht_x_67085EA6_Sort")
If sLastSort = "ASC" Then sThisSort = "DESC" Else sThisSort = "ASC"
Session("ht_x_67085EA6_Sort") = sThisSort
Else
If Session("ht_x_67085EA6_Sort") <> "" Then Session("ht_x_67085EA6_Sort") = ""
End If
' Field 交期
If sOrder = "交期" Then
sSortField = "[交期]"
sLastSort = Session("ht_x_4EA4671F_Sort")
If sLastSort = "ASC" Then sThisSort = "DESC" Else sThisSort = "ASC"
Session("ht_x_4EA4671F_Sort") = sThisSort
Else
If Session("ht_x_4EA4671F_Sort") <> "" Then Session("ht_x_4EA4671F_Sort") = ""
End If
' Field 承办
If sOrder = "承办" Then
sSortField = "[承办]"
sLastSort = Session("ht_x_627F529E_Sort")
If sLastSort = "ASC" Then sThisSort = "DESC" Else sThisSort = "ASC"
Session("ht_x_627F529E_Sort") = sThisSort
Else
If Session("ht_x_627F529E_Sort") <> "" Then Session("ht_x_627F529E_Sort") = ""
End If
' Field 备注
If sOrder = "备注" Then
sSortField = "[备注]"
sLastSort = Session("ht_x_59076CE8_Sort")
If sLastSort = "ASC" Then sThisSort = "DESC" Else sThisSort = "ASC"
Session("ht_x_59076CE8_Sort") = sThisSort
Else
If Session("ht_x_59076CE8_Sort") <> "" Then Session("ht_x_59076CE8_Sort") = ""
End If
' Field 反馈报酬
If sOrder = "反馈报酬" Then
sSortField = "[反馈报酬]"
sLastSort = Session("ht_x_53CD998862A5916C_Sort")
If sLastSort = "ASC" Then sThisSort = "DESC" Else sThisSort = "ASC"
Session("ht_x_53CD998862A5916C_Sort") = sThisSort
Else
If Session("ht_x_53CD998862A5916C_Sort") <> "" Then Session("ht_x_53CD998862A5916C_Sort") = ""
End If
Session("ht_OrderBy") = sSortField & " " & sThisSort
Session("ht_REC") = 1
End If
sOrderBy = Session("ht_OrderBy")
If sOrderBy = "" Then
sOrderBy = sDefaultOrderBy
Session("ht_OrderBy") = sOrderBy
Session("ht_x_5408540C53F7_Sort") = "DESC"
End If
End Sub
'-------------------------------------------------------------------------------
' Function SetUpStartRec
' - Set up Starting Record parameters based on Pager Navigation
' - Variables setup: nStartRec
Sub SetUpStartRec()
Dim nPageNo
' Check for a START parameter
If Request.QueryString("start").Count > 0 Then
nStartRec = Request.QueryString("start")
Session("ht_REC") = nStartRec
ElseIf Request.QueryString("pageno").Count > 0 Then
nPageNo = Request.QueryString("pageno")
If IsNumeric(nPageNo) Then
nStartRec = (nPageNo-1)*nDisplayRecs+1
If nStartRec <= 0 Then
nStartRec = 1
ElseIf nStartRec >= ((nTotalRecs-1)\nDisplayRecs)*nDisplayRecs+1 Then
nStartRec = ((nTotalRecs-1)\nDisplayRecs)*nDisplayRecs+1
End If
Session("ht_REC") = nStartRec
Else
nStartRec = Session("ht_REC")
If Not IsNumeric(nStartRec) Or nStartRec = "" Then
nStartRec = 1 ' Reset start record counter
Session("ht_REC") = nStartRec
End If
End If
Else
nStartRec = Session("ht_REC")
If Not IsNumeric(nStartRec) Or nStartRec = "" Then
nStartRec = 1 'Reset start record counter
Session("ht_REC") = nStartRec
End If
End If
End Sub
'-------------------------------------------------------------------------------
' Function ResetCmd
' - Clear list page parameters
' - RESET: reset search parameters
' - RESETALL: reset search & master/detail parameters
' - RESETSORT: reset sort parameters
Sub ResetCmd()
Dim sCmd
' Get Reset Cmd
If Request.QueryString("cmd").Count > 0 Then
sCmd = Request.QueryString("cmd")
' Reset Search Criteria
If UCase(sCmd) = "RESET" Then
sSrchWhere = ""
Session("ht_searchwhere") = sSrchWhere
' Reset Search Criteria & Session Keys
ElseIf UCase(sCmd) = "RESETALL" Then
sSrchWhere = ""
Session("ht_searchwhere") = sSrchWhere
' Reset Sort Criteria
ElseIf UCase(sCmd) = "RESETSORT" Then
sOrderBy = ""
Session("ht_OrderBy") = sOrderBy
If Session("ht_x_ID_Sort") <> "" Then Session("ht_x_ID_Sort") = ""
If Session("ht_x_5408540C53F7_Sort") <> "" Then Session("ht_x_5408540C53F7_Sort") = ""
If Session("ht_x_5BA26237540D79F0_Sort") <> "" Then Session("ht_x_5BA26237540D79F0_Sort") = ""
If Session("ht_x_4EA754C1578B53F7_Sort") <> "" Then Session("ht_x_4EA754C1578B53F7_Sort") = ""
If Session("ht_x_657091CF_Sort") <> "" Then Session("ht_x_657091CF_Sort") = ""
If Session("ht_x_4EF7683C_Sort") <> "" Then Session("ht_x_4EF7683C_Sort") = ""
If Session("ht_x_91D1989D_Sort") <> "" Then Session("ht_x_91D1989D_Sort") = ""
If Session("ht_x_67085EA6_Sort") <> "" Then Session("ht_x_67085EA6_Sort") = ""
If Session("ht_x_4EA4671F_Sort") <> "" Then Session("ht_x_4EA4671F_Sort") = ""
If Session("ht_x_627F529E_Sort") <> "" Then Session("ht_x_627F529E_Sort") = ""
If Session("ht_x_59076CE8_Sort") <> "" Then Session("ht_x_59076CE8_Sort") = ""
If Session("ht_x_53CD998862A5916C_Sort") <> "" Then Session("ht_x_53CD998862A5916C_Sort") = ""
End If
' Reset Start Position (Reset Command)
nStartRec = 1
Session("ht_REC") = nStartRec
End If
End Sub
'-------------------------------------------------------------------------------
' Function ExportData
' - Export Data in Xml or Csv format
Sub ExportData(sExport, sSql)
Dim oXmlDoc, oXmlTbl, oXmlRec, oXmlFld
Dim sCsvStr
Dim rs
' Set up Record Set
Set rs = Server.CreateObject("ADODB.Recordset")
rs.CursorLocation = 3
rs.Open sSql, conn, 1, 2
nTotalRecs = rs.RecordCount
nStartRec = 1
SetUpStartRec() ' Set Up Start Record Position
If sExport = "xml" Then
Set oXmlDoc = Server.CreateObject("MSXML.DOMDocument")
Set oXmlTbl = oXmlDoc.createElement("table")
End If
If sExport = "csv" Then
sCsvStr = sCsvStr & """ID""" & ","
sCsvStr = sCsvStr & """合同号""" & ","
sCsvStr = sCsvStr & """客户名称""" & ","
sCsvStr = sCsvStr & """产品型号""" & ","
sCsvStr = sCsvStr & """数量""" & ","
sCsvStr = sCsvStr & """价格""" & ","
sCsvStr = sCsvStr & """金额""" & ","
sCsvStr = sCsvStr & """月度""" & ","
sCsvStr = sCsvStr & """交期""" & ","
sCsvStr = sCsvStr & """承办""" & ","
sCsvStr = sCsvStr & """备注""" & ","
sCsvStr = sCsvStr & """反馈报酬""" & ","
sCsvStr = Left(sCsvStr, Len(sCsvStr)-1) ' Remove last comma
sCsvStr = sCsvStr & vbCrLf
End If
' Avoid starting record > total records
If CLng(nStartRec) > CLng(nTotalRecs) Then
nStartRec = nTotalRecs
End If
' Set the last record to display
If nDisplayRecs < 0 Then
nStopRec = nTotalRecs
Else
nStopRec = nStartRec + nDisplayRecs - 1
End If
' Move to first record directly for performance reason
nRecCount = nStartRec - 1
If Not rs.Eof Then
rs.MoveFirst
rs.Move nStartRec - 1
End If
nRecActual = 0
Do While (Not rs.Eof) And (nRecCount < nStopRec)
nRecCount = nRecCount + 1
If CLng(nRecCount) >= CLng(nStartRec) Then
nRecActual = nRecActual + 1
x_ID = rs("ID")
x_5408540C53F7 = rs("合同号")
x_5BA26237540D79F0 = rs("客户名称")
x_4EA754C1578B53F7 = rs("产品型号")
x_657091CF = rs("数量")
x_4EF7683C = rs("价格")
x_91D1989D = rs("金额")
x_67085EA6 = rs("月度")
x_4EA4671F = rs("交期")
x_627F529E = rs("承办")
x_59076CE8 = rs("备注")
x_53CD998862A5916C = rs("反馈报酬")
If sExport = "xml" Then
Set oXmlRec = oXmlDoc.createElement("record")
Call oXmlTbl.appendChild(oXmlRec)
' Field ID
Set oXmlFld = oXmlDoc.createElement("ID")
sTmp = x_ID
if IsNull(sTmp) then sTmp = "<Null>"
oXmlFld.Text = sTmp
Call oXmlRec.AppendChild(oXmlFld)
' Field 合同号
Set oXmlFld = oXmlDoc.createElement("5408540C53F7")
sTmp = x_5408540C53F7
if IsNull(sTmp) then sTmp = "<Null>"
oXmlFld.Text = sTmp
Call oXmlRec.AppendChild(oXmlFld)
' Field 客户名称
Set oXmlFld = oXmlDoc.createElement("5BA26237540D79F0")
sTmp = x_5BA26237540D79F0
if IsNull(sTmp) then sTmp = "<Null>"
oXmlFld.Text = sTmp
Call oXmlRec.AppendChild(oXmlFld)
' Field 产品型号
Set oXmlFld = oXmlDoc.createElement("4EA754C1578B53F7")
sTmp = x_4EA754C1578B53F7
if IsNull(sTmp) then sTmp = "<Null>"
oXmlFld.Text = sTmp
Call oXmlRec.AppendChild(oXmlFld)
' Field 数量
Set oXmlFld = oXmlDoc.createElement("657091CF")
sTmp = x_657091CF
if IsNull(sTmp) then sTmp = "<Null>"
oXmlFld.Text = sTmp
Call oXmlRec.AppendChild(oXmlFld)
' Field 价格
Set oXmlFld = oXmlDoc.createElement("4EF7683C")
sTmp = x_4EF7683C
if IsNull(sTmp) then sTmp = "<Null>"
oXmlFld.Text = sTmp
Call oXmlRec.AppendChild(oXmlFld)
' Field 金额
Set oXmlFld = oXmlDoc.createElement("91D1989D")
sTmp = x_91D1989D
if IsNull(sTmp) then sTmp = "<Null>"
oXmlFld.Text = sTmp
Call oXmlRec.AppendChild(oXmlFld)
' Field 月度
Set oXmlFld = oXmlDoc.createElement("67085EA6")
sTmp = x_67085EA6
if IsNull(sTmp) then sTmp = "<Null>"
oXmlFld.Text = sTmp
Call oXmlRec.AppendChild(oXmlFld)
' Field 交期
Set oXmlFld = oXmlDoc.createElement("4EA4671F")
sTmp = x_4EA4671F
if IsNull(sTmp) then sTmp = "<Null>"
oXmlFld.Text = sTmp
Call oXmlRec.AppendChild(oXmlFld)
' Field 承办
Set oXmlFld = oXmlDoc.createElement("627F529E")
sTmp = x_627F529E
if IsNull(sTmp) then sTmp = "<Null>"
oXmlFld.Text = sTmp
Call oXmlRec.AppendChild(oXmlFld)
' Field 备注
Set oXmlFld = oXmlDoc.createElement("59076CE8")
sTmp = x_59076CE8
if IsNull(sTmp) then sTmp = "<Null>"
oXmlFld.Text = sTmp
Call oXmlRec.AppendChild(oXmlFld)
' Field 反馈报酬
Set oXmlFld = oXmlDoc.createElement("53CD998862A5916C")
sTmp = x_53CD998862A5916C
if IsNull(sTmp) then sTmp = "<Null>"
oXmlFld.Text = sTmp
Call oXmlRec.AppendChild(oXmlFld)
Set oXmlRec = Nothing
End If
If sExport = "csv" Then
' Field ID
sCsvStr = sCsvStr & """" & Replace(x_ID&"","""","""""") & """" & ","
' Field 合同号
sCsvStr = sCsvStr & """" & Replace(x_5408540C53F7&"","""","""""") & """" & ","
' Field 客户名称
sCsvStr = sCsvStr & """" & Replace(x_5BA26237540D79F0&"","""","""""") & """" & ","
' Field 产品型号
sCsvStr = sCsvStr & """" & Replace(x_4EA754C1578B53F7&"","""","""""") & """" & ","
' Field 数量
sCsvStr = sCsvStr & """" & Replace(x_657091CF&"","""","""""") & """" & ","
' Field 价格
sCsvStr = sCsvStr & """" & Replace(x_4EF7683C&"","""","""""") & """" & ","
' Field 金额
sCsvStr = sCsvStr & """" & Replace(x_91D1989D&"","""","""""") & """" & ","
' Field 月度
sCsvStr = sCsvStr & """" & Replace(x_67085EA6&"","""","""""") & """" & ","
' Field 交期
sCsvStr = sCsvStr & """" & Replace(x_4EA4671F&"","""","""""") & """" & ","
' Field 承办
sCsvStr = sCsvStr & """" & Replace(x_627F529E&"","""","""""") & """" & ","
' Field 备注
sCsvStr = sCsvStr & """" & Replace(x_59076CE8&"","""","""""") & """" & ","
' Field 反馈报酬
sCsvStr = sCsvStr & """" & Replace(x_53CD998862A5916C&"","""","""""") & """" & ","
sCsvStr = Left(sCsvStr, Len(sCsvStr)-1) ' Remove last comma
sCsvStr = sCsvStr & vbCrLf
End If
End If
rs.MoveNext
Loop
' Close recordset and connection
rs.Close
Set rs = Nothing
If sExport = "xml" Then
Response.Write "<?xml version=""1.0"" encoding=""gb2312"" standalone=""yes""?>" & vbcrlf
Response.Write oXmlTbl.xml
Set oXmlTbl = Nothing
Set oXmlDoc = Nothing
End If
If sExport = "csv" Then
Response.Write sCsvStr
End If
End Sub
%>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -